Twilio Recordings Integration

Automate ingestion of telephony call recordings. Upload audio logs from Twilio to your own private vault, verify file size boundaries, and delete files from Twilio servers automatically.

HTTP Endpoint

POST /api/v1/twilio/recording
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Authentication & Account Resolution

To identify your destination workspace account, callers should provide their workspace API key via Authorization: Bearer YOUR_API_KEY header. Alternatively, direct webhook callers can pass account_id in the JSON body or query string (e.g. ?account_id=123).

If neither a valid Bearer token nor a workspace account_id is provided, the endpoint returns an HTTP 400 Bad Request with error code invalid_account:

{
  "error": true,
  "code": "invalid_account",
  "message": "Invalid or missing workspace account ID parameter."
}

Request Parameters (JSON Body)

Field Type Required Description
call_sid string Yes The unique Twilio Call SID (e.g. CA..., or Twilio param CallSid).
recording_sid string Yes The unique Twilio Recording SID (e.g. RE..., or Twilio param RecordingSid).
recording_url string Yes The Twilio mp3 recording file URL (or Twilio param RecordingUrl).
duration integer No The duration of the call recording in seconds (or Twilio param RecordingDuration).
delete_from_twilio boolean No If true, deletes the source recording from Twilio after successful vault ingestion.
account_id integer No Destination workspace account ID (required only if Bearer header is omitted).

Success Response (HTTP 202 Accepted)

{
  "success": true,
  "message": "Twilio call recording queued for background ingestion."
}

Telephony Backend Workflow

Normally, your webhook handler receives a callback from Twilio when a call completes. In your handler code, trigger Elept:

Guzzle HTTP Client (PHP):
use GuzzleHttp\Client;

$client = new Client();
$response = $client->post('https://elept.com/api/v1/twilio/recording', [
  'headers' => [
    'Authorization' => 'Bearer YOUR_API_KEY',
    'Content-Type' => 'application/json'
  ],
  'json' => [
    'call_sid' => $_POST['CallSid'] ?? '',
    'recording_sid' => $_POST['RecordingSid'] ?? '',
    'recording_url' => $_POST['RecordingUrl'] ?? '',
    'duration' => (int)($_POST['RecordingDuration'] ?? 0),
    'delete_from_twilio' => true
  ]
]);
Native PHP cURL:
$ch = curl_init('https://elept.com/api/v1/twilio/recording');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_KEY',
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    'call_sid' => $_POST['CallSid'] ?? '',
    'recording_sid' => $_POST['RecordingSid'] ?? '',
    'recording_url' => $_POST['RecordingUrl'] ?? '',
    'duration' => (int)($_POST['RecordingDuration'] ?? 0),
    'delete_from_twilio' => true
]));
$response = curl_exec($ch);
curl_close($ch);
Back to Welcome Guide