# 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.castmagic.io/endpoints/transcripts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
