Recording downloads
Download, play, stream, and range-request call audio through Sonik.
Use Sonik call id from GET /calls, not 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. Missing call or recording returns 404; invalid range returns 416; provider failure returns 502.
Recording streams through Sonik. Provider URL and credentials are never exposed.
Updated 9 days ago
Did this page help you?
