Skip to contentSkip to navigationSkip to topbar
On this page

Recording Transcription


A Transcription represents the transcribed text and metadata from a transcribed recording of a voice call.

The transcription text itself is the result of converting an audio recording to readable text. To generate transcriptions from call recordings, use the TwiML <Record> verb and set transcribe="true". Note that

(warning)

Warning

Your account will be charged if you request transcription for a recording, as this is a paid feature. Additionally, transcription is currently limited to recordings initiated with the TwiML <Record> verb and are at most two minutes in length.
For pricing information, see the transcriptions pricing page(link takes you to an external page).


Transcription Properties

transcription-properties page anchor
Property nameTypeRequiredDescriptionChild properties
account_sidSID<AC>Optional
Not PII

The SID of the Account that created the Transcription resource.

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

api_versionstringOptional

The API version used to create the transcription.


date_createdstring<date-time-rfc-2822>Optional

The date and time in GMT that the resource was created specified in RFC 2822(link takes you to an external page) format.


date_updatedstring<date-time-rfc-2822>Optional

The date and time in GMT that the resource was last updated specified in RFC 2822(link takes you to an external page) format.


durationstringOptional

The duration of the transcribed audio in seconds.


pricenumberOptional

The charge for the transcript in the currency associated with the account. This value is populated after the transcript is complete so it may not be available immediately.


price_unitstring<currency>Optional

The currency in which price is measured, in ISO 4127(link takes you to an external page) format (e.g. usd, eur, jpy).


recording_sidSID<RE>Optional

The SID of the Recording from which the transcription was created.

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

sidSID<TR>Optional

The unique string that that we created to identify the Transcription resource.

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

statusenum<string>Optional

The status of the transcription. Can be: in-progress, completed, failed.

Possible values:
in-progresscompletedfailed

transcription_textstringOptional
PII MTL: 30 days

The text content of the transcription.


typestringOptional

The transcription type. Can only be: fast.


uristringOptional

The URI of the resource, relative to https://api.twilio.com.


Fetch a Transcription resource

fetch-a-transcription-resource page anchor
GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Transcriptions/{Sid}.json

Twilio will respond with the JSON metadata for the Transcription. If you append ".txt" to the end of the Transcription resource's URI, Twilio will return only the text of the transcription:

/2010-04-01/Accounts/{AccountSid}/Transcriptions/{TranscriptionSid}.txt

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that created the Transcription resource to fetch.

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

SidSID<TR>required

The Twilio-provided string that uniquely identifies the Transcription resource to fetch.

Pattern: ^TR[0-9a-fA-F]{32}$Min length: 34Max length: 34
Fetch a specific TranscriptionLink to code sample: Fetch a specific Transcription
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 fetchTranscription() {
11
const transcription = await client
12
.transcriptions("TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
13
.fetch();
14
15
console.log(transcription.accountSid);
16
}
17
18
fetchTranscription();

Output

1
{
2
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
3
"api_version": "2008-08-01",
4
"date_created": "Sun, 13 Feb 2011 02:12:08 +0000",
5
"date_updated": "Sun, 13 Feb 2011 02:30:01 +0000",
6
"duration": "1",
7
"price": "-0.05000",
8
"price_unit": "USD",
9
"recording_sid": "REaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
10
"sid": "TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
11
"status": "failed",
12
"transcription_text": "(blank)",
13
"type": "fast",
14
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Transcriptions/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
15
}

Read multiple Transcription resources

read-multiple-transcription-resources page anchor
GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Transcriptions.json

Returns the full set of Transcriptions generated from all recordings in an account.

The list Twilio returns includes paging information.

Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that created the Transcription resources to read.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34
Property nameTypeRequiredPIIDescription
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.

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 listTranscription() {
11
const transcriptions = await client.transcriptions.list({ limit: 20 });
12
13
transcriptions.forEach((t) => console.log(t.accountSid));
14
}
15
16
listTranscription();

Output

1
{
2
"end": 0,
3
"first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Transcriptions.json?PageSize=1&Page=0",
4
"last_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Transcriptions.json?PageSize=1&Page=3",
5
"next_page_uri": null,
6
"num_pages": 4,
7
"page": 0,
8
"page_size": 1,
9
"previous_page_uri": null,
10
"start": 0,
11
"total": 4,
12
"transcriptions": [
13
{
14
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
15
"api_version": "2008-08-01",
16
"date_created": "Thu, 25 Aug 2011 20:59:45 +0000",
17
"date_updated": "Thu, 25 Aug 2011 20:59:45 +0000",
18
"duration": "10",
19
"price": "0.00000",
20
"price_unit": "USD",
21
"recording_sid": "REaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
22
"sid": "TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
23
"status": "completed",
24
"transcription_text": null,
25
"type": "fast",
26
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Transcriptions/TRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
27
}
28
],
29
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Transcriptions.json?PageSize=1&Page=0"
30
}

You can also access a full list of Transcriptions directly from a given Recording by passing the RecordingSid to the Recording resource:

1
/2010-04-01/Accounts/{YourAccountSid}/Recordings/{RecordingSid}/Transcriptions.json
2

The cURL command to fetch Transcriptions from a Recording looks like this:

1
curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings/REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Transcriptions.json \
2
-u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'

If you prefer that Twilio responds with XML, change .json to .xml.


Delete a Transcription resource

delete-a-transcription-resource page anchor
DELETE https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Transcriptions/{Sid}.json

Delete a transcription from your account.

If the request is successful, Twilio will return HTTP 204 (No Content) with no body.

Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that created the Transcription resources to delete.

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

SidSID<TR>required

The Twilio-provided string that uniquely identifies the Transcription resource to delete.

Pattern: ^TR[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 deleteTranscription() {
11
await client.transcriptions("TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").remove();
12
}
13
14
deleteTranscription();

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.