Generate pre-signed URL


To perform a transcription, the following steps must be followed:

  • Generate a pre-signed URL
  • Upload the file to the generated URL

Below we will describe the functionality that allows you to generate these pre-signed URLs.

Request description

Important: we are able to process audio files with the following mime types: audio/x-wav, audio/wav, audio/mp3, audio/m4a, audio/flac, audio/ogg,audio/webm

Endpoint: /api/v1/generate-presigned-url
Method: POST

Remember: you can see the URL to consume this API in the Introduction section.

{
  "Content-Type": "application/json",
  "Authorization": "Bearer <accessToken>"
}

Authorization: We'll pass the token obtained during the authentication process. You can reuse the generated tokens, as they have a 2-hour lifespan. Review this page: Credentials

Payload

{ 
  "mimeType": " audio/mpeg",
  "callbackUrl": "https://mock-callback.mydomain.com"
}

Payload structure

type GeneratePresignUrlPayloadType = {
  mimeType: string, // Mime type related to the audio file
  callbackUrl?: string // If this attribute is passed, once the audio processing is finished, the transcription result is sent to the specified url
}

Responses

Correct response

Successful request

Describe the characteristics of a satisfactory response

200

Response structure:

{
  "presignedUrl": "https://mock-presigned-url",
  "requestId": "mock-request-id"
}

Response structure

type GeneratePresignUrlResponseType = {
  presignedUrl: string,
  requestId: string
}

Note: If the callbackUrl attribute is passed in the input body, once the audio processing has been completed, the result of the transcription will be sent to the URL specified in this parameter.

The sending to the external source will have the following structure:

Method: POST

Payload

{
  "requestId": "mock-request-id", 
  "transcription": [
    {
      "text": "mock transcription text",
      "start": 0.05,
      "end": 2.26,
      "speaker": "0",
    },
  ],
  "signature": "requestSignature",
  "createdAt": 222222222
}

Payload structure

type SendCallbackPayload = {
    requestId: string,
    transcription: ITranscriptionSegment[],
    signature: string,
    createdAt: string
}

interface ITranscriptionSegment {
    text: string
    start: number
    end: number
    speaker?: string
  }

Wrong responses

Unauthorized request

Describes the response when the request is not authorized


401

Response body

type GenerateReportResponseType = {
    messsage: string
}


Forbidden request

Describes the response when the API Key is not allowed to consume this service


403

Response body

type GenerateReportResponseType = {
    messsage: string
    errorType: string
}

Remember that to consume this service, the API Key must have the permission: BATCH-TRANSCRIBE

Invalid request

Bad request

Describe the characteristics of a bad request

400

Response body

type GeneratePresignUrlResponseType = {
    messsage: string
    errorType: GENERATE_PRESIGNURL_ERROR_TYPE
}

enum GENERATE_PRESIGNURL_ERROR_TYPE {
  INCONSISTENT_INPUT= 'inconsistentInput'
  INVALID_REQUEST_BODY = 'invalidRequestBody'
}