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 allows you to login and get an account token

Request Body

{
    "accessToken": "Your token"
}

Register

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

This endpoint allows you to register an account

Request Body

{
    "role": "user",
    "isVerified": false,
    "_id": "user_id",
    "email": "user_email",
    "createdAt": "created date",
    "message": "Please check your inbox for verification email"
}

After successfully register your account, there will be an email sent to your inbox 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

Request Body

{
    "result": null,
    "status": "created",
    "formats": [
        "stm",
        "srt",
        "TextGrid"
    ],
    "sampling": "16khz",
    "lang": "english",
    "name": "Note",
    "_id": "5f11c797b6d18b0029b60975", // Note this ID
    "queue": "normal",
    "createdAt": "2020-07-17T15:45:27.882Z"
}

Note: If you can provide audioType and audioTrack that best describe your audio file, we'll try to use our best-fit model to give you better result.

After request successfully, in response returned, you'll see a field name _id, this is ID of your speech, we also call it SpeechID. Notice this for further requests.

About webhook: an audio may take long time to decode (depends on its duration, type,...), and the processing time is not exact, not same even if you submit 2 identical jobs. So instead of keep calling us to get the status, You can provide your HTTP endpoint in webhook field and we'll send your audio's status, and when status is done you just need to call our endpoint to download your transcription

About queue: a queue is where your job will be running in, each queue will have some workers to pick up your job and process, by default your job will be submitted to normal queue and this queue is shared among others, because of that sometimes your job will have to be queued until our workers available. If you want to have dedicated queue to not share with others, contact our support to get in detail.

Get job status

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

This api is to retrieve speech's status. If you mean to call this api many times to get speech's status, consider passing webhook when submitting your job as described in above section

Path Parameters

Headers

{
    "status": "processing",
    "formats": [
        "stm",
        "srt",
        "TextGrid"
    ],
    "sampling": "16khz",
    "lang": "english",
    "name": "Note",
    "_id": "5f11c797b6d18b0029b60975",
    "queue": "normal",
    "input": [
        {
            "isSubmitted": true,
            "errorCode": null,
            "status": "processing",
            "progress": [{
                "content": "Decoding",
                "createdAt": "2020-07-17T15:45:27.941Z"
            }],
            "_id": "5f11c798b6d18b0029b60977",
            "file": {
                "_id": "5f11c797b6d18b0029b60976",
                "originalName": "james-test.wav",
                "mimeType": "audio/wave",
                "filename": "5f11c797b6d18b0029b60976.wav",
                "size": 187404,
                "duration": 5.855,
                "createdAt": "2020-07-17T15:45:27.941Z"
            }
        }
    ],
    "createdAt": "2020-07-17T15:45:27.882Z",
    "sourceFile": {
        "_id": "5f11c797b6d18b0029b60976",
        "originalName": "james-test.wav",
        "mimeType": "audio/wave",
        "filename": "5f11c797b6d18b0029b60976.wav",
        "size": 187404,
        "duration": 5.855,
        "createdAt": "2020-07-17T15:45:27.941Z"
    }
}

Get transcription (Deprecated)

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

This API is used to download transcription when speech's status is done

Path Parameters

Headers

Return transcription downloadable file

Get transcription (New)

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

This API returns transcription when speech's status is done

Path Parameters

Headers

{
    url: "a downloadable link"
}

Change account's password

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

Request Body

{
    "message": "Password changed successfully"
}

Forgot account's password

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

This API is used to reset account password

Request Body

{
    "message": "Please check your inbox for reset password code"
}

After sending this API, there's an email will be sent to your email address which contains a code used to reset password (see the API below)

Reset password

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

Request Body

{
    "message": "Your password has been reset"
}

Send verification email

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

Verification email is sent right after account registration, and will be valid for 12 hours. This api endpoint is used in case you want to send new verification email

Headers

{
    "message": "Please check your inbox for verification email"
}

Create an application

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

This endpoint is used to create a third-party application that make uses of Gateway APIs. Note: if success, app secret will only be shown once, be sure to save it somewhere privately

Headers

Request Body

{
    "_id": "5f8d581e87bf680b226d3cc1", // App ID
    "name": "Test App",
    "key": "5f8d581e87bf680b226d3cc0", // Key ID (used to get public key to verify JWT token)
    "createdAt": "2020-10-19T09:10:54.482Z",
    "secret": "41d29bb4c52389441c1647764de94493c16a8c42e9529bdaa7502cccc7f111e7" // App secret
}

Get JWT Public Key

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

This endpoints return JWT public key, third party will use this key in order to verify JWT token generated from API gateway

Path Parameters

public key in file

Last updated