Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Transcript Resource


A Transcript resource represents a voice conversation that has automatically been converted to text through Voice Intelligence. The Transcript resource is a container and includes links to individual transcribed Sentence, Media, and OperatorResults resources.


Transcript Properties

transcript-properties page anchor
Property nameTypePIIDescription
account_sidSID<AC>
Not PII

The unique SID identifier of the Account.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

service_sidSID<GA>

The unique SID identifier of the Service.

Pattern: ^GA[0-9a-fA-F]{32}$Min length: 34Max length: 34

sidSID<GT>

A 34 character string that uniquely identifies this Transcript.

Pattern: ^GT[0-9a-fA-F]{32}$Min length: 34Max length: 34

date_createdstring<date-time>

The date that this Transcript was created, given in ISO 8601 format.


date_updatedstring<date-time>

The date that this Transcript was updated, given in ISO 8601 format.


statusenum<string>

The Status of this Transcript. One of queued, in-progress, completed, failed or canceled.

Possible values:
queuedin-progresscompletedfailedcanceled

channelobject

Media Channel describing Transcript Source and Participant Mapping


data_loggingboolean

Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent.


language_codestring

The default language code of the audio.


customer_keystring

media_start_timestring<date-time>

The date that this Transcript's media was started, given in ISO 8601 format.


durationinteger

The duration of this Transcript's source


urlstring<uri>

The URL of this resource.


redactionboolean

If the transcript has been redacted, a redacted alternative of the transcript will be available.


linksobject<uri-map>

POST https://intelligence.twilio.com/v2/Transcripts

(information)

Info

You can only create one Transcript per RecordingSid. To re-transcribe a recording, you will need to delete the original Transcript resource and create a new one.

This limitation does not apply if you are supplying a MediaUrl to create a Transcript.

Transcripts can be created in one of two ways:

  • Use a recording SID
    To transcribe Recordings made via Twilio and stored within Twilio's infrastructure, send a POST request to the Transcript resource and include the Recording's SID as the SourceSid in the Channel object (see Specifying channel information below for an example).
  • Use a media URL
    If you're storing a recording outside of Twilio — for example, in your own S3 bucket — or if you're transcribing a dual-channel recording that was made on another system, such as another contact center product like Amazon Connect, you can transcribe the recording by making a POST request to the Transcript API and including the MediaUrl parameter with the recording's location as its value in the Channel object (see Specifying channel information below for an example). The URL must be accessible, either publicly or through a mechanism like a pre-signed URL.

If both MediaUrl and SourceSid are present in the Transcript creation request, MediaUrl takes precedence over SourceSid.

Transcripts cannot be created for recordings made by projects with Voice Recording Encryption enabled, as Voice Intelligence is unable to decrypt those resources. Twilio recommends offloading those recordings to your own storage and generating a pre-signed URL to supply them to the Transcript API.

Supported media formats for Transcriptions with MediaUrl

supported-media-formats-for-transcriptions-with-mediaurl page anchor

Twilio's Transcript resource using the MediaUrl parameter supports the following audio formats:

  • WAV (PCM-encoded)
  • MP3
  • FLAC

All these formats support both mono and stereo audio channels.

  • Use one of the supported formats to ensure compatibility with the Transcript resource.
  • For better transcription accuracy and to differentiate between the participants speaking, use stereo / dual-channel recordings.
  • Audio processing is optimized for transcription accuracy.
  • Recording file size cannot be larger than 3GB for both Twilio recordings and external files.
  • Audio duration cannot exceed eight hours for both Twilio recordings and external files.
  • Sample rate should be at least 8 kHz (telephony grade). 16 KHz is the recommended sample rate for better results.
  • Twilio will try to download the external recording for a maxium of 10 minutes. If the 10-minute limit is reached, the Transcription will fail.
  • Encrypted recordings are not supported.
  • To create Transcripts for Twilio Recordings in external storage, use the MediaUrl parameter. The SourceSid parameter is not supported for externally-stored Twilio Recordings.
Property nameTypeRequiredPIIDescription
ServiceSidSID<GA>required

The unique SID identifier of the Service.

Pattern: ^GA[0-9a-fA-F]{32}$Min length: 34Max length: 34

Channelobjectrequired

JSON object describing Media Channel including Source and Participants


CustomerKeystringOptional

Used to store client provided metadata. Maximum of 64 double-byte UTF8 characters.


MediaStartTimestring<date-time>Optional

The date that this Transcript's media was started, given in ISO 8601 format.

Create Transcript

create-transcript page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function createTranscript() {
_19
const transcript = await client.intelligence.v2.transcripts.create({
_19
channel: {},
_19
serviceSid: "GAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_19
});
_19
_19
console.log(transcript.accountSid);
_19
}
_19
_19
createTranscript();

Output

_17
{
_17
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_17
"channel": {},
_17
"customer_key": "CustomerKey",
_17
"data_logging": false,
_17
"date_created": "2009-07-06T20:30:00Z",
_17
"date_updated": "2009-07-06T20:30:00Z",
_17
"duration": 158,
_17
"language_code": "LanguageCode",
_17
"links": {},
_17
"media_start_time": "2009-07-06T20:30:00Z",
_17
"redaction": false,
_17
"service_sid": "GAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_17
"sid": "GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_17
"status": "queued",
_17
"url": "https://www.example.com"
_17
}

Specifying channel information

specifying-channel-information page anchor

Channel is the object representing the media channel. It has information about the source of the media, either a Twilio recording or a 3rd party recording, and the participants information.


_34
{
_34
"$schema": "https://json-schema.org/draft/2019-09/schema",
_34
"type": "object",
_34
"items": {
_34
"$ref": "#/definitions/Channel"
_34
},
_34
"definitions": {
_34
"Channel": {
_34
"type": "object",
_34
"additionalProperties": false,
_34
"properties": {
_34
"media_properties": {
_34
"type": "object",
_34
"properties": {
_34
"source_sid": {
_34
"type": "string",
_34
"$comment": "Twilio Recording Sid"
_34
},
_34
"media_url": {
_34
"type": "string",
_34
"format": "uri",
_34
"$comment": "url to the 3rd party recording"
_34
}
_34
},
_34
"$comment": "Either source_sid or media_url is required"
_34
},
_34
"participants": {
_34
"type": "array"
_34
}
_34
},
_34
"title": "Channel"
_34
}
_34
}
_34
}

If the Transcript was generated from a Twilio Recording, the Channel information would look like the following:


_10
{
_10
"media_properties":{
_10
"source_sid": "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_10
}
_10
}

If the Transcript was generated from an external recording, the Channel information would look like the following:


_10
{
_10
"media_properties":{
_10
"media_url": "http://www.example.com/recording/call.wav"
_10
}
_10
}

Specifying participant information

specifying-participant-information page anchor

By default, Voice Intelligence assumes that the left channel (channel One) is the agent and the right channel (channel Two) is the customer. The order of these channels may be inverted, depending on how your call flow works and which call leg is being recorded.

You can specify information about channel structure, as well as information about who each participant is, by passing in a URL-encoded JSON array containing information about each participant into the Participants parameter in the Channel object. The Participants array follows this JSON schema:


_48
{
_48
"$schema": "http://json-schema.org/draft-06/schema#",
_48
"type": "array",
_48
"maxItems": 2,
_48
"items": {
_48
"$ref": "#/definitions/Participant"
_48
},
_48
"definitions": {
_48
"Participant": {
_48
"type": "object",
_48
"additionalProperties": false,
_48
"properties": {
_48
"channel_participant": {
_48
"type": "integer",
_48
"enum": [
_48
1,
_48
2
_48
],
_48
"$comment": "You can only specify one participant per channel"
_48
},
_48
"user_id": {
_48
"type": "string"
_48
},
_48
"media_participant_id": {
_48
"type": "string"
_48
},
_48
"role": {
_48
"type": "string"
_48
},
_48
"full_name": {
_48
"type": "string"
_48
},
_48
"email": {
_48
"type": "string",
_48
"format": "email"
_48
},
_48
"image_url": {
_48
"type": "string",
_48
"format": "uri"
_48
}
_48
},
_48
"required": [
_48
"channel_participant"
_48
],
_48
"title": "Participant"
_48
}
_48
}
_48
}

Specifying both participants

specifying-both-participants page anchor

_20
[
_20
{
_20
"user_id" : "id1",
_20
"channel_participant": 1,
_20
"media_participant_id": "+1505959545",
_20
"email": "veronica.meyer@example.com",
_20
"full_name": "Veronica Meyer",
_20
"image_url": "https://images.unsplash.com/photo-1438761681033-6461ffad8d80",
_20
"role": "Agent"
_20
},
_20
{
_20
"user_id" : "id2",
_20
"channel_participant": 2,
_20
"media_participant_id": "+1505959505",
_20
"email": "lauryn.trujillo@example.com",
_20
"full_name": "Lauryn Trujillo",
_20
"image_url": "https://images.unsplash.com/photo-1554384645-13eab165c24b",
_20
"role": "Customer"
_20
}
_20
]


Fetch an existing Transcript

fetch-an-existing-transcript page anchor
GET https://intelligence.twilio.com/v2/Transcripts/{Sid}

Property nameTypeRequiredPIIDescription
SidSID<GT>required

A 34 character string that uniquely identifies this Transcript.

Pattern: ^GT[0-9a-fA-F]{32}$Min length: 34Max length: 34
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function fetchTranscript() {
_18
const transcript = await client.intelligence.v2
_18
.transcripts("GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.fetch();
_18
_18
console.log(transcript.accountSid);
_18
}
_18
_18
fetchTranscript();

Output

_21
{
_21
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_21
"service_sid": "GAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_21
"sid": "GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_21
"date_created": "2010-08-31T20:36:28Z",
_21
"date_updated": "2010-08-31T20:36:28Z",
_21
"status": "queued",
_21
"channel": {},
_21
"data_logging": false,
_21
"language_code": "en-US",
_21
"media_start_time": null,
_21
"duration": 0,
_21
"customer_key": null,
_21
"url": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_21
"redaction": true,
_21
"links": {
_21
"sentences": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sentences",
_21
"media": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media",
_21
"operator_results": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OperatorResults"
_21
}
_21
}


Fetch multiple Transcripts

fetch-multiple-transcripts page anchor
GET https://intelligence.twilio.com/v2/Transcripts

Property nameTypeRequiredPIIDescription
ServiceSidSID<GA>Optional

The unique SID identifier of the Service.

Pattern: ^GA[0-9a-fA-F]{32}$Min length: 34Max length: 34

BeforeStartTimestringOptional

Filter by before StartTime.


AfterStartTimestringOptional

Filter by after StartTime.


BeforeDateCreatedstringOptional

Filter by before DateCreated.


AfterDateCreatedstringOptional

Filter by after DateCreated.


StatusstringOptional

Filter by status.


LanguageCodestringOptional

Filter by Language Code.


SourceSidstringOptional

Filter by SourceSid.


PageSizeintegerOptional

How many resources to return in each list page. The default is 50, and the maximum is 1000.

Minimum: 1Maximum: 1000

PageintegerOptional

The page index. This value is simply for client state.

Minimum: 0

PageTokenstringOptional

The page token. This is provided by the API.

List multiple Transcripts

list-multiple-transcripts page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function listTranscript() {
_18
const transcripts = await client.intelligence.v2.transcripts.list({
_18
limit: 20,
_18
});
_18
_18
transcripts.forEach((t) => console.log(t.accountSid));
_18
}
_18
_18
listTranscript();

Output

_34
{
_34
"transcripts": [
_34
{
_34
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_34
"service_sid": "GAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_34
"sid": "GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_34
"date_created": "2010-08-31T20:36:28Z",
_34
"date_updated": "2010-08-31T20:36:28Z",
_34
"status": "queued",
_34
"channel": {},
_34
"data_logging": false,
_34
"language_code": "en-US",
_34
"media_start_time": null,
_34
"duration": 0,
_34
"customer_key": null,
_34
"url": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_34
"redaction": true,
_34
"links": {
_34
"sentences": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sentences",
_34
"media": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media",
_34
"operator_results": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OperatorResults"
_34
}
_34
}
_34
],
_34
"meta": {
_34
"key": "transcripts",
_34
"page": 0,
_34
"page_size": 50,
_34
"first_page_url": "https://intelligence.twilio.com/v2/Transcripts?LanguageCode=en-US&SourceSid=REaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&ServiceSid=GAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&AfterDateCreated=2019-11-22T23%3A46%3A00Z&PageSize=50&Page=0",
_34
"next_page_url": null,
_34
"previous_page_url": null,
_34
"url": "https://intelligence.twilio.com/v2/Transcripts?LanguageCode=en-US&SourceSid=REaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&ServiceSid=GAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&AfterDateCreated=2019-11-22T23%3A46%3A00Z&PageSize=50&Page=0"
_34
}
_34
}


Delete an existing Transcript

delete-an-existing-transcript page anchor
DELETE https://intelligence.twilio.com/v2/Transcripts/{Sid}

Property nameTypeRequiredPIIDescription
SidSID<GT>required

A 34 character string that uniquely identifies this Transcript.

Pattern: ^GT[0-9a-fA-F]{32}$Min length: 34Max length: 34
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_16
// Download the helper library from https://www.twilio.com/docs/node/install
_16
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_16
_16
// Find your Account SID and Auth Token at twilio.com/console
_16
// and set the environment variables. See http://twil.io/secure
_16
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_16
const authToken = process.env.TWILIO_AUTH_TOKEN;
_16
const client = twilio(accountSid, authToken);
_16
_16
async function deleteTranscript() {
_16
await client.intelligence.v2
_16
.transcripts("GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_16
.remove();
_16
}
_16
_16
deleteTranscript();


Rate this page: