Retrieving the documents

Your order is ready once it is in the "Complete" state. The files you requested will appear in the "attachments" attribute in the body of the response. There will be one attachment object per each completed file, as well as one per each source file you provided upon order placement.

Each attachment object contains a kind attribute, which you can use to identify its type. The value of a kind attribute will be one of the following:

  • media: a source file you provided
  • caption: a completed caption file
  • transcript: a completed transcript

Here is an example of such attribute:

"attachments": [
...
    {
      "kind": "caption",
      "name": "sample.srt",
      "id": "F3heEsEHAgAAAAAA",
      "links": [
        {
          "rel": "content",
          "href": "https://api-sandbox.rev.com/api/v1/attachments/F3heEsEHAgAAAAAA/content"
        }
      ]
    }
  ]

We've highlighted in bold the important parts:

  • “kind”: This attribute refers to the type of the attachment.
  • “name”: The name of the attachment.
  • “id”: The id is a unique string needed for you to fetch the files.

To get the raw data of an attachment with a given ID, make a GET request to https://api-sandbox.rev.com/api/v1/attachments/[ID]/content. The following example fetches the sample.srt from the excerpt above:

curl -H "Authorization: Rev [ClientAPIKey]:[UserAPIKey]" https://api-sandbox.rev.com/api/v1/attachments/F3heEsEHAgAAAAAA/content

The contents of the file is printed in the console:

1
00:00:00,000 --> 00:00:10,500
Rebecca: This is a sample first line with a speaker
2
00:00:10,500 --> 00:00:20,761
^and this is the second line with the same speaker, shown at top

You can also specify to retrieve the attachment in different representations. For example, in the case of Captions, you can opt to receive an attachment in the Scenarist Closed Caption format. Similarly, in the case of Transcriptions, you can choose to retrieve an attachment in PDF. To specify a desired format, you just need to add an Accept header to the /attachments/[ID]/content request, specifying the media type as its value.

For a detailed description of retrieving attachments, please visit https://www.rev.com/api/attachmentsgetcontent.