Basketball V1
Team Recent Form
Get recent game results and form for a basketball team
GET
/
competitors
/
recentForm
Team Recent Form
curl --request GET \
--url https://api.sportsapipro.com/v1/basketball/competitors/recentForm \
--header 'x-api-key: <api-key>'import requests
url = "https://api.sportsapipro.com/v1/basketball/competitors/recentForm"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.sportsapipro.com/v1/basketball/competitors/recentForm', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sportsapipro.com/v1/basketball/competitors/recentForm",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sportsapipro.com/v1/basketball/competitors/recentForm"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.sportsapipro.com/v1/basketball/competitors/recentForm")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sportsapipro.com/v1/basketball/competitors/recentForm")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_bodyV1 Legacy Endpoint — This is a V1 API endpoint. For new integrations, we recommend using the Basketball V2 API which provides richer data and more endpoints.
Overview
Returns recent game results for a basketball team, useful for analyzing current form, win streaks, and performance trends.Query Parameters
integer
required
Team/Competitor ID (e.g., 2827 for LA Lakers)
integer
Number of recent games to return (default: 5)
Code Examples
curl -X GET "https://api.sportsapipro.com/v1/basketball/competitors/recentForm?competitor=2827&numOfGames=10" \
-H "x-api-key: YOUR_API_KEY"
const response = await fetch(
'https://api.sportsapipro.com/v1/basketball/competitors/recentForm?competitor=2827&numOfGames=10',
{ headers: { 'x-api-key': 'YOUR_API_KEY' } }
);
const { recentForm } = await response.json();
// Calculate win/loss record
const wins = recentForm.games.filter(g => g.isWin).length;
const losses = recentForm.games.length - wins;
console.log(`Recent form: ${wins}W - ${losses}L`);
// Calculate average points
const avgPoints = recentForm.games.reduce((sum, g) => sum + g.score, 0) / recentForm.games.length;
console.log(`Average points: ${avgPoints.toFixed(1)}`);
import requests
response = requests.get(
'https://api.sportsapipro.com/v1/basketball/competitors/recentForm',
params={'competitor': 2827, 'numOfGames': 10},
headers={'x-api-key': 'YOUR_API_KEY'}
)
form = response.json().get('recentForm', {})
# Calculate current streak
games = form.get('games', [])
if games:
current_result = games[0].get('isWin')
streak = 1
for game in games[1:]:
if game.get('isWin') == current_result:
streak += 1
else:
break
print(f"Current streak: {'W' if current_result else 'L'}{streak}")
Response Structure
object
Recent form data
Show Recent Form Object
Show Recent Form Object
object
Team information (id, name, imageUrl)
string
Form string (e.g., “WWLWW”)
Example Response
{
"recentForm": {
"competitor": {
"id": 2827,
"name": "Los Angeles Lakers",
"imageUrl": "..."
},
"form": "WWLWW",
"games": [
{
"gameId": 123456,
"date": "2026-01-25T20:00:00Z",
"opponent": {
"id": 2765,
"name": "Boston Celtics",
"imageUrl": "..."
},
"score": 118,
"opponentScore": 112,
"isHome": true,
"isWin": true,
"competition": {
"id": 132,
"name": "NBA"
}
}
]
}
}
Use Cases
- Pre-game analysis: Show team’s current form before a matchup
- Betting insights: Identify hot/cold streaks
- Performance tracking: Monitor team improvements or declines
- Head-to-head context: Compare both teams’ recent form before a game
Last modified on June 29, 2026
Was this page helpful?
⌘I
Team Recent Form
curl --request GET \
--url https://api.sportsapipro.com/v1/basketball/competitors/recentForm \
--header 'x-api-key: <api-key>'import requests
url = "https://api.sportsapipro.com/v1/basketball/competitors/recentForm"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.sportsapipro.com/v1/basketball/competitors/recentForm', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sportsapipro.com/v1/basketball/competitors/recentForm",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sportsapipro.com/v1/basketball/competitors/recentForm"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.sportsapipro.com/v1/basketball/competitors/recentForm")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sportsapipro.com/v1/basketball/competitors/recentForm")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body