Skip to contentSkip to navigationSkip to topbar
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 nameTypeRequiredDescriptionChild properties
account_sidSID<AC>

Optional

Not PII

The unique SID identifier of the Account.

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

service_sidSID<GA>

Optional

The unique SID identifier of the Service.

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

sidSID<GT>

Optional

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>

Optional

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


date_updatedstring<date-time>

Optional

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


statusenum<string>

Optional

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

Possible values:
queuedin-progresscompletedfailedcanceled

channelobject

Optional

Media Channel describing Transcript Source and Participant Mapping


data_loggingboolean

Optional

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

Optional

The default language code of the audio.


customer_keystring

Optional


media_start_timestring<date-time>

Optional

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


durationinteger

Optional

The duration of this Transcript's source

Default: 0

urlstring<uri>

Optional

The URL of this resource.


redactionboolean

Optional

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


linksobject<uri-map>

Optional


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.
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
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


CustomerKeystring

Optional

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 TranscriptLink to code sample: Create Transcript
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createTranscript() {
11
const transcript = await client.intelligence.v2.transcripts.create({
12
channel: {},
13
serviceSid: "GAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
14
});
15
16
console.log(transcript.accountSid);
17
}
18
19
createTranscript();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"service_sid": "GAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"sid": "GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"date_created": "2010-08-31T20:36:28Z",
6
"date_updated": "2010-08-31T20:36:28Z",
7
"status": "queued",
8
"channel": {
9
"media_properties": {
10
"media_url": "http://foobar.test/ClusterTests/call1.wav"
11
}
12
},
13
"data_logging": false,
14
"language_code": "en-US",
15
"media_start_time": null,
16
"duration": 0,
17
"customer_key": "aaaaaaaa",
18
"url": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
19
"redaction": true,
20
"links": {
21
"sentences": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sentences",
22
"media": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media",
23
"operator_results": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OperatorResults"
24
}
25
}

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.

1
{
2
"$schema": "https://json-schema.org/draft/2019-09/schema",
3
"type": "object",
4
"items": {
5
"$ref": "#/definitions/Channel"
6
},
7
"definitions": {
8
"Channel": {
9
"type": "object",
10
"additionalProperties": false,
11
"properties": {
12
"media_properties": {
13
"type": "object",
14
"properties": {
15
"source_sid": {
16
"type": "string",
17
"$comment": "Twilio Recording Sid"
18
},
19
"media_url": {
20
"type": "string",
21
"format": "uri",
22
"$comment": "url to the 3rd party recording"
23
}
24
},
25
"$comment": "Either source_sid or media_url is required"
26
},
27
"participants": {
28
"type": "array"
29
}
30
},
31
"title": "Channel"
32
}
33
}
34
}

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

1
{
2
"media_properties":{
3
"source_sid": "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
4
}
5
}

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

1
{
2
"media_properties":{
3
"media_url": "http://www.example.com/recording/call.wav"
4
}
5
}

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:

1
{
2
"$schema": "http://json-schema.org/draft-06/schema#",
3
"type": "array",
4
"maxItems": 2,
5
"items": {
6
"$ref": "#/definitions/Participant"
7
},
8
"definitions": {
9
"Participant": {
10
"type": "object",
11
"additionalProperties": false,
12
"properties": {
13
"channel_participant": {
14
"type": "integer",
15
"enum": [
16
1,
17
2
18
],
19
"$comment": "You can only specify one participant per channel"
20
},
21
"user_id": {
22
"type": "string"
23
},
24
"media_participant_id": {
25
"type": "string"
26
},
27
"role": {
28
"type": "string"
29
},
30
"full_name": {
31
"type": "string"
32
},
33
"email": {
34
"type": "string",
35
"format": "email"
36
},
37
"image_url": {
38
"type": "string",
39
"format": "uri"
40
}
41
},
42
"required": [
43
"channel_participant"
44
],
45
"title": "Participant"
46
}
47
}
48
}

Specifying both participants

specifying-both-participants page anchor
1
[
2
{
3
"user_id" : "id1",
4
"channel_participant": 1,
5
"media_participant_id": "+1505959545",
6
"email": "veronica.meyer@example.com",
7
"full_name": "Veronica Meyer",
8
"image_url": "https://images.unsplash.com/photo-1438761681033-6461ffad8d80",
9
"role": "Agent"
10
},
11
{
12
"user_id" : "id2",
13
"channel_participant": 2,
14
"media_participant_id": "+1505959505",
15
"email": "lauryn.trujillo@example.com",
16
"full_name": "Lauryn Trujillo",
17
"image_url": "https://images.unsplash.com/photo-1554384645-13eab165c24b",
18
"role": "Customer"
19
}
20
]
21

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
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function fetchTranscript() {
11
const transcript = await client.intelligence.v2
12
.transcripts("GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.fetch();
14
15
console.log(transcript.accountSid);
16
}
17
18
fetchTranscript();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"service_sid": "GAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"sid": "GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"date_created": "2010-08-31T20:36:28Z",
6
"date_updated": "2010-08-31T20:36:28Z",
7
"status": "queued",
8
"channel": {},
9
"data_logging": false,
10
"language_code": "en-US",
11
"media_start_time": null,
12
"duration": 0,
13
"customer_key": null,
14
"url": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
15
"redaction": true,
16
"links": {
17
"sentences": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sentences",
18
"media": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media",
19
"operator_results": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OperatorResults"
20
}
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

BeforeStartTimestring

Optional

Filter by before StartTime.


AfterStartTimestring

Optional

Filter by after StartTime.


BeforeDateCreatedstring

Optional

Filter by before DateCreated.


AfterDateCreatedstring

Optional

Filter by after DateCreated.


Statusstring

Optional

Filter by status.


LanguageCodestring

Optional

Filter by Language Code.


SourceSidstring

Optional

Filter by SourceSid.


PageSizeinteger

Optional

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

Minimum: 1Maximum: 1000

Pageinteger

Optional

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

Minimum: 0

PageTokenstring

Optional

The page token. This is provided by the API.

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function listTranscript() {
11
const transcripts = await client.intelligence.v2.transcripts.list({
12
limit: 20,
13
});
14
15
transcripts.forEach((t) => console.log(t.accountSid));
16
}
17
18
listTranscript();

Output

1
{
2
"transcripts": [
3
{
4
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"service_sid": "GAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
6
"sid": "GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
7
"date_created": "2010-08-31T20:36:28Z",
8
"date_updated": "2010-08-31T20:36:28Z",
9
"status": "queued",
10
"channel": {},
11
"data_logging": false,
12
"language_code": "en-US",
13
"media_start_time": null,
14
"duration": 0,
15
"customer_key": null,
16
"url": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
17
"redaction": true,
18
"links": {
19
"sentences": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Sentences",
20
"media": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media",
21
"operator_results": "https://intelligence.twilio.com/v2/Transcripts/GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OperatorResults"
22
}
23
}
24
],
25
"meta": {
26
"key": "transcripts",
27
"page": 0,
28
"page_size": 50,
29
"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",
30
"next_page_url": null,
31
"previous_page_url": null,
32
"url": "https://intelligence.twilio.com/v2/Transcripts?LanguageCode=en-US&SourceSid=REaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&ServiceSid=GAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&AfterDateCreated=2019-11-22T23%3A46%3A00Z&PageSize=50&Page=0"
33
}
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
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function deleteTranscript() {
11
await client.intelligence.v2
12
.transcripts("GTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.remove();
14
}
15
16
deleteTranscript();

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.