# Transcripts

At the core of Castmagic is transcription. Transcription is an async process and can vary in duration based on factors such as audio language, however it is typically complete in around 15 minutes or less.

Transcription supports speaker diarization by default. You will find paragraphs labled by speaker in the `"utterances"` key of a completed transcript response.

[See a sample of a full transcript JSON](https://gist.githubusercontent.com/jtormey/00fa4944c5af3a04cd54a6ae70fe2ecb/raw/0e420ae370f42f8b7c20ceac86b3e2bdba3e7f38/castmagic_sample_transcript.json).

## Submit a request to transcribe from a URL

<mark style="color:green;">`POST`</mark> `https://app.castmagic.io/v1/transcripts`

#### Headers

| Name                                            | Type   | Description        |
| ----------------------------------------------- | ------ | ------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer API\_SECRET |

#### Request Body

| Name                                  | Type      | Description                                                                                             |
| ------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------- |
| url<mark style="color:red;">\*</mark> | String    | URL of file to transcribe                                                                               |
| boosted\_words                        | String\[] | List of words to boost when transcribing                                                                |
| language\_code                        | String    | Language code. Defaults to `"en"`. See Supported Languages section for all language codes               |
| language\_detection                   | Boolean   | Attempt to automatically detect the content language. Will be overridden by `language_code` if included |

{% tabs %}
{% tab title="201: Created Request to transcribe was successful" %}

```
{
    "id": "ae844ebc-ad12-444e-8310-1049a12cf139",
    "status": "queued"
}
```

{% endtab %}

{% tab title="400: Bad Request Request to transcribe included bad parameter" %}

```
{
    "errors": {
        "url": [
            "must be a valid url"
        ]
    },
    "valid": false       
}
```

{% endtab %}
{% endtabs %}

## Fetch details for a transcript given an identifier

<mark style="color:blue;">`GET`</mark> `https://app.castmagic.io/v1/transcripts/:id`

#### Path Parameters

| Name                                 | Type   | Description                 |
| ------------------------------------ | ------ | --------------------------- |
| id<mark style="color:red;">\*</mark> | String | ID of the transcript to get |

#### Headers

| Name                                            | Type   | Description        |
| ----------------------------------------------- | ------ | ------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer API\_SECRET |

{% tabs %}
{% tab title="200: OK Transcript is processing" %}

```
{
    "id": "ae844ebc-ad12-444e-8310-1049a12cf139",
    "status": "processing"
}
```

{% endtab %}

{% tab title="200: OK Transcript is in error state" %}

```
{
    "id": "ae844ebc-ad12-444e-8310-1049a12cf139",
    "status": "error",
    "error": "Video to audio conversion error, could not transcode from video/mp4"
}
```

{% endtab %}

{% tab title="200: OK Transcription completed successfully" %}

```
{
    "id": "ae844ebc-ad12-444e-8310-1049a12cf139",
    "status": "completed",
    "audio_duration": 3600,
    "utterances": [...]
}
```

{% endtab %}
{% endtabs %}
