Getting Started
This page walks you from a fresh API key to a working end‑to‑end integration that authenticates, finds a call by date range, fetches its transcription and downloads the audio. Every step uses plain curl so you can paste it straight into a terminal.
For a per‑endpoint reference (request shapes, filters, response schemas) see the Endpoint Reference, or the auto‑generated Focus API (OpenAPI) reference if you want the exact schema for a call and an interactive "Try it" console. This walkthrough links each step to its OpenAPI page so you can run the same call live.
Prerequisites#
Before you can call the API you need three things from your Focus account:
| Item | Where it comes from | Notes |
|---|---|---|
| API key | Admin → Account → Integrations → Native Focus REST API | A Super User must enable the API and generate the key. Treat it like a password. |
clientId | Same admin page (numeric account id) | Identifies your tenant. |
Integration username | Auto‑generated and shown next to the API key | Focus provisions a dedicated service user when you enable the API; you don't choose its name. The token inherits this user's roles and rights. |
| Base URL | Determined by your tenant's region — see Base URLs | The API is regionally deployed. |
Base URLs and environments#
The API is deployed regionally. Your base URL follows the pattern:
https://<region>.focus.subphonic.ai/apiWhere <region> is one of:
| Region code | Region |
|---|---|
uk | United Kingdom |
eu | European Union |
us | United States |
ca | Canada |
For example, a UK tenant uses https://uk.focus.subphonic.ai/api. Throughout these docs we refer to your base URL as {{baseUrl}}. Routes shown in the reference are exact paths to append, e.g. {{baseUrl}}/client/recording.search.
Authentication#
All authenticated calls take a short‑lived bearer JWT in the Authorization header. You exchange your API key for that JWT (and a refresh token) via POST /authWithApiKey.
Request#
Method:
POSTURL:
{{baseUrl}}/authWithApiKeyHeaders:
Content-Type: application/jsonBody:
{
"clientId": 1234567,
"apiKey": "YOUR-API-KEY-XYZ",
"username": "YOUR-INTEGRATION-USERNAME"
}All three values are shown together in the admin portal when you enable the API. The username is auto‑generated by Focus — use it exactly as displayed.
Example#
curl -X POST "$BASE_URL/authWithApiKey" \
-H "Content-Type: application/json" \
-d '{
"clientId": 1234567,
"apiKey": "YOUR-API-KEY-XYZ",
"username": "YOUR-INTEGRATION-USERNAME"
}'Response#
{
"token": "eyJhbGciOi...",
"refreshToken": "eyJhbGciOi..."
}Use token as the bearer for subsequent calls:
curl -H "Authorization: Bearer $TOKEN" "$BASE_URL/admin/retentionGroup"Token lifetime & refresh#
Bearer tokens are short‑lived (minutes, not hours). When a call returns 401 Unauthorized your token has expired — request a new one by calling POST /authWithApiKey again with the same credentials. There is no need to cache or rotate the API key itself.
End‑to‑end walkthrough: search → transcript → download#
The diagram below shows the typical flow for an integration that finds calls and pulls their content. Every numbered step maps to a curl example below.
Step 1 — Authenticate#
See Authentication above. Capture the token value into an environment variable:
TOKEN=$(curl -s -X POST "$BASE_URL/authWithApiKey" \
-H "Content-Type: application/json" \
-d '{"clientId":1234567,"apiKey":"YOUR-API-KEY-XYZ","username":"YOUR-INTEGRATION-USERNAME"}' \
| jq -r .token)Step 2 — Search for recordings#
Find every recording in a 24‑hour window, newest first, 100 per page:
curl -X POST "$BASE_URL/client/recording.search" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"dateTimeRange": {
"from": "2026-05-12T00:00:00Z",
"to": "2026-05-13T00:00:00Z"
},
"startTimeDirection": "DESC",
"page": 1,
"pageSize": 100
}'Each item in the recordings array carries both an interactionId (numeric, used for transcripts and detail) and a thirdPartyId (string, used for audio download). Page through results using the page and pageSize fields and the total count in the response.
See recording.search for the full filter list (free text, person ids, endpoints, communication type, direction, tags, duration, etc.), or Search recordings in the OpenAPI reference to inspect the full schema and run the call live.
Step 3 — Fetch the transcription#
curl -X POST "$BASE_URL/client/recording.transcription.get" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "interactionIds": [9876543] }'The response contains the transcript segments with timestamps and speaker information. If the recording has no transcript (e.g. transcription is disabled, or the call hasn't been processed yet) the array is empty.
→ OpenAPI reference: Get transcriptions.
Step 4 — Download the audio#
Audio download is keyed on thirdPartyId (taken from the search result), and lets you pick the format:
curl -X POST "$BASE_URL/client/recording.playBackByThirdPartyId" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "thirdPartyId": "abc-123-call-id", "format": "mp3-mono" }' \
--output recording.mp3This is the download path as well as the playback one — there is no separate download endpoint, and no download URL. The response is a binary stream; pipe it to a file as shown.
Supported formats are mp3-mono, wav-mono, wav, raw and mp4. The mono formats are a true downmix, so on a two‑channel recording both parties are mixed into the single channel rather than one being dropped. Always set format explicitly: the default (mp3) does not return an MP3, and an unrecognised value is not rejected. See Download audio → Formats for the full behaviour of each value.
→ OpenAPI reference: Download recording media.
Pagination#
All search endpoints accept page (1‑based) and pageSize and return a total count alongside the result array. Pick a pageSize that keeps response payloads under a few MB — 100–500 is a sensible default for recording search; 1000 is fine for lighter resources like users.
{
"page": 1,
"pageSize": 100,
"total": 4321,
"recordings": [ /* ... */ ]
}For long‑running synchronisation jobs, prefer narrowing by dateTimeRange over deep paging — it is more efficient and resilient to data being added concurrently.
Errors#
The API uses standard HTTP status codes. JSON error bodies always include a human‑readable message and, where applicable, a well‑known error prefix you can pattern‑match against.
| Status | Meaning | Typical cause |
|---|---|---|
400 | Validation error | Body failed schema validation; required field missing; forced‑comment not supplied. |
401 | Unauthenticated | Missing, malformed or expired bearer token — re‑authenticate. |
403 | Forbidden | The service user lacks the required right for this endpoint. |
404 | Not found | The requested recordingId / thirdPartyId doesn't exist or isn't visible to your user. |
429 | Too many requests | Rate limit exceeded — back off and retry. |
5xx | Server error | Transient — retry with exponential backoff. |
Always inspect the response body for diagnostic detail; do not rely on status code alone.
Rate limits#
The API applies per‑tenant rate limits to protect overall service health.
Build your client to:
Stay at or below 100 requests per minute, spread evenly rather than in bursts.
Treat
429 Too Many Requestsas a signal to back off (start with 1s, double on each retry, cap at ~30s).Honour any
Retry-Afterheader if present.Avoid bursts: throttle bulk synchronisation jobs to a steady request rate rather than firing in parallel.
Next steps#
Browse the full Endpoint Reference for every documented call, or the Focus API (OpenAPI) reference to try each call live.
Review the Data Dictionary to understand the fields returned in
recording.searchandrecording.detail.get.For bulk metadata sync without per‑call polling, look at Cursor Synchronisation.
For low-volume event notifications when transcripts complete, look at Push API.