/v2/lang-model

    You can use this endpoint to create custom Language Models, and to retrieve the status of your Language Model. This endpoint, like all endpoints, expects to receive JSON data with the 'content-type: application/json' header.

    POST Params

    Param Example Info Required
    text ["I want to cancel my account.", "Welcome to Verizon how can I help you.", "CT Scan"] A list of words or phrases, with each word or phrase as an individual string in the array. Punctuation and other text formatting is ok. For more info, see the guide on custom Language Models. Yes
    name "foo_bar_lm" A unique name for your Language Model. This is how you will request your Language Model when using it for transcription requests. Yes
    closed_domain false Can be true or false. If true, will create a new Language Model from scratch using your text versus adapting our default Language Model. Warning, the API can only transcribe words that are in the Language Model's vocabulary, so if you create a closed domain model with one word, for example, "foo", your custom Language Model will only be able to transcribe the word "foo". No
    webhook_url "http://myserver.com/receive" Instead of polling for the status of your Language Model, we will make a POST request to your webhook_url when your Language Model is ready. For more info see the guide on custom Language Models. No

    POST Response

    After a successful POST, the API will respond with the following JSON response. The most important fields to note are the "status" and "id" fields. You'll need the "id" field to make GET requests against the API to get the result/status of your Language Model as it trains.

    For a complete rundown of what all the below fields mean, view the table in the GET Response section below.

    {
        "closed_domain": false,
        "id": "145557-e909-491c-bc03-46d619292156",
        "name": "foo_bar_lm",
        "status": "queued",
        "webhook_status_code": null,
        "webhook_url": null
    }

    GET Params

    When making GET requests against this endpoint, you need to include the "id" of your Language Model in the URL. For example, this would be the full URL to GET one of your Language Models.

    https://api.assemblyai.com/v2/lang-model/145557-e909-491c-bc03-46d619292156
    Make sure you include the authorization header in the GET request! You can read more about Authentication here.

    GET Response

    When you make a GET request, the API will respond with the following JSON response.

    Param Example Info
    id "145557-e909-491c-bc03-46d619292156" The unique id for your Language Model.
    name "foo_bar_lm" The unique name of your Language Model. You'll use this name to select this Language Model when making transcription requests.
    closed_domain false Indicates whether the Language Model was trained with the closed_domain flag enabled not.
    status "trained" The status of the Language Model. Will be either "queued", "training", "trained", or "error". Language Models can only be used for transcription when they are "trained". If the status is "error", the "error" key below will contain more info about the error that was encountered during training.
    webhook_status_code 200 The status code we received when attempting to make a POST to your webhook_url. If the code is 999, that means we were unable to reach the webhook_url you supplied.
    webhook_url "http://myserver.com/receive" If supplied, the URL we'll send webhooks to when your Language Model is complete.
    error "No text found after cleaning" If your status is "error", this key will be present in the JSON response and will contain more information about why the Language Model training failed. Usually, you can look at the error message to fix whatever is causing the Language Model to fail.