Recording downloads
Download, play, stream, and range-request call audio through Sonik.
When a call has a recording, GET /calls includes a recordingUrl. This is a signed Sonik URL that can be opened directly without an Authorization header. It expires after 24 hours; request GET /calls again to obtain a fresh URL.
The signed URL forces a file download:
RECORDING_URL='recordingUrl_from_the_calls_response'
curl --silent --show-error --fail \
--get "$RECORDING_URL" \
--output recording.mp3The existing bearer-authenticated route remains available. Use the Sonik call id from GET /calls, not a provider call SID:
API_KEY='your_sonik_api_key'
BASE_URL='https://api.sonik.ai/v1'
CALL_ID='your_sonik_call_uuid'
curl --silent --show-error --fail \
--get "$BASE_URL/calls/$CALL_ID/recording" \
--header "Authorization: Bearer $API_KEY" \
--output "recording-$CALL_ID.mp3"Play on macOS:
afplay "recording-$CALL_ID.mp3"Stream through ffplay:
curl --silent --show-error --fail \
--get "$BASE_URL/calls/$CALL_ID/recording" \
--header "Authorization: Bearer $API_KEY" \
| ffplay -nodisp -autoexit -loglevel error -i pipe:0Request byte range:
curl --silent --show-error --fail \
--get "$BASE_URL/calls/$CALL_ID/recording" \
--header "Authorization: Bearer $API_KEY" \
--header 'Range: bytes=0-99999' \
--output recording-part.mp3Successful full response uses 200; valid range uses 206. An invalid or expired signed URL returns 401; a missing call or recording returns 404; an invalid range returns 416; provider failure returns 502.
Recording streams through Sonik. Provider URL and credentials are never exposed.
Updated about 1 month ago
