curl -X GET "https://api.tracklysms.com/api/v2/audiences/664f1a2b3c4d5e6f7a8b9c0d/size" \
-H "X-Api-Key: trk_your_api_key_here"
import requests
audience_id = "664f1a2b3c4d5e6f7a8b9c0d"
response = requests.get(
f"https://api.tracklysms.com/api/v2/audiences/{audience_id}/size",
headers={"X-Api-Key": "trk_your_api_key_here"},
)
data = response.json()
print(f"Audience size: {data['size']} contacts (as of {data['calculated_at']})")
const audienceId = "664f1a2b3c4d5e6f7a8b9c0d";
const response = await fetch(
`https://api.tracklysms.com/api/v2/audiences/${audienceId}/size`,
{
headers: { "X-Api-Key": "trk_your_api_key_here" },
}
);
const data = await response.json();
console.log(`Audience size: ${data.size} contacts (as of ${data.calculated_at})`);
{
"audience_id": "664f1a2b3c4d5e6f7a8b9c0d",
"size": 12480,
"calculated_at": "2025-11-20T10:30:45"
}
{
"error": "Audience not found",
"code": "not_found"
}
{
"error": "Invalid credentials",
"code": "invalid_credentials"
}
Audiences (v2)
Get Audience Size
Calculate the current size of an audience in real time.
GET
/
v2
/
audiences
/
{id}
/
size
curl -X GET "https://api.tracklysms.com/api/v2/audiences/664f1a2b3c4d5e6f7a8b9c0d/size" \
-H "X-Api-Key: trk_your_api_key_here"
import requests
audience_id = "664f1a2b3c4d5e6f7a8b9c0d"
response = requests.get(
f"https://api.tracklysms.com/api/v2/audiences/{audience_id}/size",
headers={"X-Api-Key": "trk_your_api_key_here"},
)
data = response.json()
print(f"Audience size: {data['size']} contacts (as of {data['calculated_at']})")
const audienceId = "664f1a2b3c4d5e6f7a8b9c0d";
const response = await fetch(
`https://api.tracklysms.com/api/v2/audiences/${audienceId}/size`,
{
headers: { "X-Api-Key": "trk_your_api_key_here" },
}
);
const data = await response.json();
console.log(`Audience size: ${data.size} contacts (as of ${data.calculated_at})`);
{
"audience_id": "664f1a2b3c4d5e6f7a8b9c0d",
"size": 12480,
"calculated_at": "2025-11-20T10:30:45"
}
{
"error": "Audience not found",
"code": "not_found"
}
{
"error": "Invalid credentials",
"code": "invalid_credentials"
}
Calculates the current number of contacts matching the audience’s filter in real time. This operation runs the filter query against your contact database and updates the audience’s
cached_size and cached_size_updated_at fields.
Size calculations run in real time against your contact database. For audiences with complex filters or large contact lists, this may take several seconds to complete.
Path Parameters
string
required
The unique identifier of the audience.
Response Fields
string
The audience ID that was calculated.
integer
The current number of contacts matching the audience filter.
datetime
Timestamp when the calculation was performed.
Examples
curl -X GET "https://api.tracklysms.com/api/v2/audiences/664f1a2b3c4d5e6f7a8b9c0d/size" \
-H "X-Api-Key: trk_your_api_key_here"
import requests
audience_id = "664f1a2b3c4d5e6f7a8b9c0d"
response = requests.get(
f"https://api.tracklysms.com/api/v2/audiences/{audience_id}/size",
headers={"X-Api-Key": "trk_your_api_key_here"},
)
data = response.json()
print(f"Audience size: {data['size']} contacts (as of {data['calculated_at']})")
const audienceId = "664f1a2b3c4d5e6f7a8b9c0d";
const response = await fetch(
`https://api.tracklysms.com/api/v2/audiences/${audienceId}/size`,
{
headers: { "X-Api-Key": "trk_your_api_key_here" },
}
);
const data = await response.json();
console.log(`Audience size: ${data.size} contacts (as of ${data.calculated_at})`);
{
"audience_id": "664f1a2b3c4d5e6f7a8b9c0d",
"size": 12480,
"calculated_at": "2025-11-20T10:30:45"
}
{
"error": "Audience not found",
"code": "not_found"
}
{
"error": "Invalid credentials",
"code": "invalid_credentials"
}
Error Codes
| HTTP Status | Error Code | Description |
|---|---|---|
| 401 | invalid_credentials | API key is missing or invalid |
| 403 | account_suspended | Your account is suspended. Resolve outstanding billing or contact support. |
| 404 | not_found | No audience exists with the specified ID |
Next Steps
Creating Audiences
Build and size audiences
Create Schedule
Schedule a campaign to your audience