Sample - Twilio API
POST/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Recordings.json

Create a recording for a call

Creates a recording for a specific call. Use the optional form fields to configure recording callbacks, trimming, channel layout, audio track selection, and recording processing. A 200 or 201 response returns the created recording resource.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

2 parameters · 7 body fields
AccountSidstringrequired
The account SID that creates the recording. Must be a 34-character value matching the `AC` SID format.
CallSidstringrequired
The call SID to associate with the recording. Must be a 34-character value matching the `CA` SID format.

Optional URL-encoded recording configuration and callback settings.

RecordingStatusCallbackEventarray<string>optional
The recording status events on which we should call the `recording_status_callback` URL. Can be: `in-progress`, `completed` and `absent` and the default is `completed`. Separate multiple event values with a space.
RecordingStatusCallbackstringoptional
The URL we should call using the `recording_status_callback_method` on each recording event specified in `recording_status_callback_event`. For more information, see [RecordingStatusCallback parameters](https://www.twilio.com/docs/voice/api/recording#recordingstatuscallback).
RecordingStatusCallbackMethodstringoptional
The HTTP method we should use to call `recording_status_callback`. Can be: `GET` or `POST` and the default is `POST`.
Allowed:GETPOST
Trimstringoptional
Whether to trim any leading and trailing silence in the recording. Can be: `trim-silence` or `do-not-trim` and the default is `do-not-trim`. `trim-silence` trims the silence from the beginning and end of the recording and `do-not-trim` does not.
RecordingChannelsstringoptional
The number of channels used in the recording. Can be: `mono` or `dual` and the default is `mono`. `mono` records all parties of the call into one channel. `dual` records each party of a 2-party call into separate channels.
RecordingTrackstringoptional
The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio.
RecordingConfigurationIdstringoptional
The identifier of the configuration to be used when creating and processing the recording

2 status codes
200Returns the recording object, including its account and call associations, timestamps, status, duration, pricing, channel count, and resource URI.
account_sidstringoptional
The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource.
api_versionstringoptional
The API version used to make the recording.
call_sidstringoptional
The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Recording resource is associated with.
conference_sidstringoptional
The Conference SID that identifies the conference associated with the recording, if a conference recording.
date_createdstringoptional
The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
date_updatedstringoptional
The date and time in GMT that the resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
start_timestringoptional
The start time of the recording in GMT and in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format.
durationstringoptional
The length of the recording in seconds.
sidstringoptional
The unique string that that we created to identify the Recording resource.
pricenumberoptional
The one-time cost of creating the recording in the `price_unit` currency.
uristringoptional
The URI of the resource, relative to `https://api.twilio.com`.
encryption_detailsunknownoptional
How to decrypt the recording if it was encrypted using [Call Recording Encryption](https://www.twilio.com/docs/voice/tutorials/voice-recording-encryption) feature.
price_unitstringoptional
The currency used in the `price` property. Example: `USD`.
statusstringoptional
The status of the recording. Can be: `processing`, `completed` and `absent`. For more detailed statuses on in-progress recordings, check out how to [Update a Recording Resource](https://www.twilio.com/docs/voice/api/recording#update-a-recording-resource).
Allowed:in-progresspausedstoppedprocessingcompletedabsent
channelsintegeroptional
The number of channels in the final recording file. Can be: `1`, or `2`. Separating a two leg call into two separate channels of the recording file is supported in [Dial](https://www.twilio.com/docs/voice/twiml/dial#attributes-record) and [Outbound Rest API](https://www.twilio.com/docs/voice/make-calls) record options.
Default:0
sourcestringoptional
How the recording was created. Can be: `DialVerb`, `Conference`, `OutboundAPI`, `Trunking`, `RecordVerb`, `StartCallRecordingAPI`, and `StartConferenceRecordingAPI`.
Allowed:DialVerbConferenceOutboundAPITrunkingRecordVerbStartCallRecordingAPIStartConferenceRecordingAPI
error_codeintegeroptional
The error code that describes why the recording is `absent`. The error code is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`.
trackstringoptional
The recorded track. Can be: `inbound`, `outbound`, or `both`.
201Returns the newly created recording object, including its account and call associations, timestamps, status, duration, pricing, channel count, and resource URI.
account_sidstringoptional
The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource.
api_versionstringoptional
The API version used to make the recording.
call_sidstringoptional
The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Recording resource is associated with.
conference_sidstringoptional
The Conference SID that identifies the conference associated with the recording, if a conference recording.
date_createdstringoptional
The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
date_updatedstringoptional
The date and time in GMT that the resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
start_timestringoptional
The start time of the recording in GMT and in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format.
durationstringoptional
The length of the recording in seconds.
sidstringoptional
The unique string that that we created to identify the Recording resource.
pricenumberoptional
The one-time cost of creating the recording in the `price_unit` currency.
uristringoptional
The URI of the resource, relative to `https://api.twilio.com`.
encryption_detailsunknownoptional
How to decrypt the recording if it was encrypted using [Call Recording Encryption](https://www.twilio.com/docs/voice/tutorials/voice-recording-encryption) feature.
price_unitstringoptional
The currency used in the `price` property. Example: `USD`.
statusstringoptional
The status of the recording. Can be: `processing`, `completed` and `absent`. For more detailed statuses on in-progress recordings, check out how to [Update a Recording Resource](https://www.twilio.com/docs/voice/api/recording#update-a-recording-resource).
Allowed:in-progresspausedstoppedprocessingcompletedabsent
channelsintegeroptional
The number of channels in the final recording file. Can be: `1`, or `2`. Separating a two leg call into two separate channels of the recording file is supported in [Dial](https://www.twilio.com/docs/voice/twiml/dial#attributes-record) and [Outbound Rest API](https://www.twilio.com/docs/voice/make-calls) record options.
Default:0
sourcestringoptional
How the recording was created. Can be: `DialVerb`, `Conference`, `OutboundAPI`, `Trunking`, `RecordVerb`, `StartCallRecordingAPI`, and `StartConferenceRecordingAPI`.
Allowed:DialVerbConferenceOutboundAPITrunkingRecordVerbStartCallRecordingAPIStartConferenceRecordingAPI
error_codeintegeroptional
The error code that describes why the recording is `absent`. The error code is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`.
trackstringoptional
The recorded track. Can be: `inbound`, `outbound`, or `both`.

Error handling

AccountSid must be a 34-character account SID beginning with AC, and CallSid must be a 34-character call SID beginning with CA. When supplied, RecordingStatusCallbackMethod must be GET or POST, Trim must be trim-silence or do-not-trim, RecordingChannels must be mono or dual, and RecordingTrack must be inbound, outbound, or both.