Skip to main content
Two endpoints are available for accessing call recordings:
  1. Stream endpoint - Returns a JSON object with a presigned URL for browser-native streaming
  2. Download endpoint - Returns the binary audio file for download

Stream Recording

Get a presigned URL for streaming the call recording in a browser.

Endpoint

GET /api/calls/{call_sid}/recording/stream

Path Parameters

call_sid
string
required
The unique identifier of the call (format: call_ prefix + alphanumeric).

Response

Returns a JSON object containing a presigned S3 URL that can be used directly with an HTML5 audio element.
success
boolean
Indicates if the request was successful.
data
object
Recording URL data.
data.url
string
required
Presigned S3 URL for accessing the recording. Expires after 1 hour.
data.expires_in
number
required
URL expiration time in seconds (3600 = 1 hour).
data.content_type
string
required
Content type of the recording (e.g., audio/wav, audio/mpeg).
data.filename
string
required
Suggested filename for the recording.
{
  "success": true,
  "data": {
    "url": "https://bucket.s3.amazonaws.com/recordings/call_abc123.wav?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...",
    "expires_in": 3600,
    "content_type": "audio/wav",
    "filename": "recording_+15559876543.wav"
  }
}
The presigned URL supports HTTP range requests, allowing the browser to stream the audio file without downloading the entire file first. Use this endpoint for playback in audio players.

Download Recording

Download the recording as a binary audio file.

Endpoint

GET /api/calls/{call_sid}/recording/download

Path Parameters

call_sid
string
required
The unique identifier of the call (format: call_ prefix + alphanumeric).

Response

Returns the audio file as a binary stream with appropriate headers for download.
Content-Type
string
audio/wav
Content-Disposition
string
attachment; filename="recording_{to_number}.wav"
Content-Length
number
Size of the audio file in bytes.
HTTP/1.1 200 OK
Content-Type: audio/wav
Content-Disposition: attachment; filename="recording_+15559876543.wav"
Content-Length: 1924506

[Binary WAV data...]
This endpoint returns binary audio data, not JSON. The presigned URL used internally expires after 5 minutes. Use this endpoint when you want to save the recording to disk.

Comparison

FeatureStream EndpointDownload Endpoint
Endpoint/recording/stream/recording/download
Response TypeJSONBinary (WAV)
Content-Typeapplication/jsonaudio/wav
URL Expiration1 hour5 minutes
Use CaseBrowser streamingFile download
Supports SeekingYesNo
Must Download AllNoYes

Frontend Usage Examples

Streaming (for playback)

// Get presigned URL
const response = await fetch(`/api/calls/${callSid}/recording/stream`, {
  headers: { 'X-Organization-Id': 'org_123' }
});
const { data } = await response.json();

// Use with HTML5 Audio element
const audio = new Audio(data.url);
audio.play();

Download (for saving)

// Fetch binary data
const response = await fetch(`/api/calls/${callSid}/recording/download`, {
  headers: { 'X-Organization-Id': 'org_123' }
});
const blob = await response.blob();

// Create download link
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `recording_${toNumber}.wav`;
a.click();
window.URL.revokeObjectURL(url);