Usage

Note: If you have your own app/backend, and you want to integrate the API gateway as a service, we recommend you to read through Integration, to help you reduce user management part and delegate to the API gateway instead

Login

POST https://gateway.speechlab.sg/auth/login

This endpoint is used to log in into an existing account.

Request Body

Name
Type
Description

email

string

Account's email

password

string

Account's password

{
    "accessToken": "Your token"
}

Register

POST https://gateway.speechlab.sg/auth/register

This endpoint is used to register an account.

Request Body

Name
Type
Description

name

string

Account's name Must be longer than 2 characters

email

string

Account's email

password

string

Account's password Must be longer than 5 characters

After successfully registering an account, an email verification link will sent to the email address to verify your email address. You need to click into verification link which is sent along with the email.

Submit a job

POST https://gateway.speechlab.sg/speech

Headers

Name
Type
Description

Authorization

string

Access Token. Bearer <access token obtained from login>

Request Body

Name
Type
Description

file

object

File Object

lang

string

Language code Examples (not exhaustive): 'english', 'mandarin', 'malay', 'english-mandarin', 'english-malay'

queue

string

Queue that speech job will be assigned to Example (not exhaustive): 'normal' If not specified, will default to 'normal' queue

audioType

string

Examples: 'fartalk', 'closetalk', 'mobile', 'telephony', 'boundary'

audioTrack

string

Examples: 'single', 'multi'

sampling

string

Example: '16khz' If not specified, will default to '16khz'

keywords

array

An array of strings

numChn

number

Number of audio channels

outputFormats

array

An array of file extensions Example: ['txt', 'srt']

checksum

string

md5 checksum string of the file object to check if received file is identical

webhook

string

API endpoint to receive update when your speech is completed Example: 'http://your-api.com/status'

customData

JSON object

To pass other extra metadata such as num_spk and orgID. Example:

{"num_spk":-1} -1 if no. of speaker is unknown.

After request successfully, in the response returned, the field _id is the ID of the job, also referred to as 'SpeechID'. Note this value down (to be used in future requests).

About audioType and audioTrack: If audioType and audioTrack fields can be provided that best describes the audio file, our system will try to use our best-fit model to give a better result.

About webhook: An audio file may take a long time to decode (dependent on its duration, type,...), and the processing time is not deterministic (likely not the same for 2 identical jobs). Instead of calling our endpoint to check on the status of a job, a HTTP endpoint can be provided via the webhook field, and when the job is done, the HTTP endpoint provided will be notified of the job's completion. Subsequently, our other endpoint can be called to download the transcription file(s).

About queue: A queue is where the job will be running in, each queue will have some workers to pick up jobs and process. If not specified, the job will be submitted to normal queue and where this queue is shared among others. Therefore, when there are already existing jobs in the queue, this job will be pending until there are workers available. If you want to have dedicated queue that is not shared with others, please contact our support to get in touch.

Get user's speech history

GET https://gateway.speechlab.sg/speech/history

This endpoint is used to retrieve a user's speech history. Filter options "queue", "status", "lang", and "type" are optionally available to filter returned results.

Path Parameters

Name
Type
Description

email

string

Email of user's history to retrieve For 'normal' accounts, only user's own email is accepted (but is optional as user can be identified by their token already)

queue

string

Queue of speech jobs Example (not exhaustive): 'normal'

status

string

Status of speech jobs Examples (not exhaustive): 'done', 'processing'

lang

string

Language code of speech jobs Examples (not exhaustive): 'english', 'mandarin', 'malay', 'english-mandarin', 'english-malay'

type

string

Type of speech jobs Examples: 'live', 'batch'

Headers

Name
Type
Description

Authorization

string

Access Token. Format: Bearer <access token obtained from login>

Get job status

GET https://gateway.speechlab.sg/speech/:id

This endpoint is used to retrieve a speech job's status. Alternatively, consider passing webhook field when submitting a job as described in "Submit a job" endpoint above.

Path Parameters

Name
Type
Description

id

string

Speech's ID

Headers

Name
Type
Description

Authorization

string

Access Token. Format: Bearer <access token obtained from login>

Get transcription (Deprecated)

GET https://gateway.speechlab.sg/speech/result/:id

This endpoint will redirect to a URL to download the transcription files if Speech status is done.

Path Parameters

Name
Type
Description

id

string

Speech's ID

Headers

Name
Type
Description

Authorization

string

Access Token. Format: Bearer <access token obtained from login>

Get transcription (New)

GET https://gateway.speechlab.sg/speech/:id/result

This endpoint will return a URL to download the transcription files if Speech status is done.

Path Parameters

Name
Type
Description

id

string

Speech's ID

Headers

Name
Type
Description

Authorization

string

Access Token. Format: Bearer <access token obtained from login>

Change account's password

POST https://gateway.speechlab.sg/auth/change-password

This endpoint is used to change an existing account's password.

Request Body

Name
Type
Description

email

string

Account's email

currentPassword

string

Account's current password

newPassword

string

New password

confirmNewPassword

string

New password for confirmation

Forgot account's password

POST https://gateway.speechlab.sg/auth/forgot-password

This endpoint is used to reset an existing account's password. An email will be sent to the email address which contains a code used to reset password.

Request Body

Name
Type
Description

email

string

Account's email

Reset password

POST https://gateway.speechlab.sg/auth/reset-password

This endpoint is used to reset an account's password with a code obtained from the "Forgot account's password" endpoint.

Request Body

Name
Type
Description

email

string

Account's email

code

string

Forgot password code

newPassword

string

New password

confirmNewPassword

string

Confirm new password

Change account's name

GET https://gateway.speechlab.sg/users/change-name

This endpoint is for users to change their own account's name.

Headers

Name
Type
Description

Authorization

string

Access Token. Format: Bearer <access token obtained from login>

Request Body

Name
Type
Description

newName

string

John Doe

Create an application

POST https://gateway.speechlab.sg/applications

The endpoint is used to create a third-party applications that makes use of Gateway's APIs. Note: If successful, app's secret will only be shown once, be sure to save it somewhere privately.

Headers

Name
Type
Description

Authorization

string

Access Token. Format: Bearer <access token obtained from login>

Request Body

Name
Type
Description

name

string

Application's name

Get JWT Public Key

GET https://gateway.speechlab.sg/keys/:keyId

This endpoint returns JWT public key, third-party will use this key in order to verify JWT token generated from API gateway.

Path Parameters

Name
Type
Description

keyId

string

Key ID returned after creating application (see above)

Last updated