> ## Documentation Index
> Fetch the complete documentation index at: https://docs.inworld.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Detect content

> Checks whether the speech in an audio file, or in a video file's audio track, was generated by Inworld TTS. Send the file as `multipart/form-data` with a `config` part first and a `file` part second. The server reads the upload as a stream and answers once the whole file has arrived. Inworld does not store or log the file or its name.

Send an audio or video file to check whether its speech was generated by Inworld TTS. The API is free to call with any API key. It covers the TTS-2 and TTS-2 Flash models. Other AI-generated speech can also score high, so read a high score as "AI-generated, likely by Inworld".

<Note>
Inworld does not store or log the uploaded file or its name.
</Note>

## Send the upload

Send `multipart/form-data` with exactly two parts, in this order:

1. `config`: a JSON object such as `{"audio": {"fileName": "clip.mp3"}}`.
2. `file`: the file to check.

The server reads the upload as a stream, so a `file` part sent before `config` is rejected with `400`. Any other part is rejected too.

## Read the score

`probability` is a detection score from 0 to 1. A higher score means the audio is more likely to have been generated by Inworld TTS. The field is absent when the server cannot score the file, usually because it holds less than 1 second of audio. Check whether `probability` is present rather than inferring it from the clip's length.

A score is evidence, not proof. Accuracy drops in these cases:

- **Short clips.**
- **Phone-quality or heavily compressed audio.** Narrowband audio, such as 8 kHz phone calls.
- **Noise and editing.** Background noise, music, or mixing with other recordings lowers the score.

## Limits

| Limit | Value |
| --- | --- |
| File size | 25 MiB |
| Audio length | 5 minutes |
| Time to finish the upload | 2 minutes |
| Pause in the upload | 10 seconds |
| Uploads in progress per account | 4 |

An upload that pauses for 10 seconds or does not finish within 2 minutes is ended with `408`. Retry it on a faster connection, or with a smaller file.

The server detects the format from the file's bytes, not its extension. It accepts WAV, MP3, OGG, FLAC, M4A, WebM and video containers (MP4, MOV, MXF), whose audio track it checks. Raw headerless PCM is not accepted.

## API reference

**Endpoint:** `POST https://api.inworld.ai/detection/v1/detect`

### Authorization

- `Authorization` (string; required) — Your [authentication](../../../api-reference/introduction) credentials. For Basic authentication, please populate `Basic $INWORLD_API_KEY`.

### Request body

Content type: `multipart/form-data`

- `config` (object; required) — What the content is. Send it as the first part, as JSON. Exactly one modality must be set; `audio` is the only one today.
  - `audio` (object; required) — The content is an audio file, or a video file whose audio track is checked.
    - `fileName` (string) — Optional. The file's name, such as `clip.mp3`. Used only as a hint about the container format. When omitted, the name of the `file` part is used. Inworld does not store or log it.
- `file` (string; required) — The file to check, sent after `config`. The server reads the format from the file's bytes, so the file needs a recognizable header: WAV, MP3, OGG, FLAC, M4A, WebM, or a video container (MP4, MOV, MXF), whose audio track is checked. Raw headerless PCM is not accepted. At most 25 MiB and 5 minutes of audio.

#### Request example

```json
{
  "config": {
    "audio": {
      "fileName": "clip.mp3"
    }
  },
  "file": "string"
}
```

### Response

Status: `200`. Content type: `application/json`.

- `provider` (string) — The provider that `probability` refers to. Always `inworld`.
- `probability` (number) — Detection score in [0, 1]: how likely the audio was generated by `provider`. A higher score means more likely. Absent when the server cannot score the file, usually because it holds less than 1 second of audio.

### Response examples

#### 200: scored

```json
{
  "provider": "inworld",
  "probability": 0.97
}
```

#### 200: noScore

```json
{
  "provider": "inworld"
}
```

#### 400: default_response

```json
{
  "code": 3,
  "message": "content could not be decoded as audio; send a WAV, MP3, OGG, FLAC, M4A, WebM or supported video file",
  "details": []
}
```

#### 401: default_response

```json
{
  "code": 0,
  "message": "string",
  "details": []
}
```

#### 408: default_response

```json
{
  "code": 0,
  "message": "string",
  "details": []
}
```

#### 415: default_response

```json
{
  "code": 0,
  "message": "string",
  "details": []
}
```

#### 429: default_response

```json
{
  "code": 0,
  "message": "string",
  "details": []
}
```

#### 503: default_response

```json
{
  "code": 0,
  "message": "string",
  "details": []
}
```

#### 504: default_response

```json
{
  "code": 0,
  "message": "string",
  "details": []
}
```

### Code examples

#### cURL

```bash
curl --location 'https://api.inworld.ai/detection/v1/detect' \
--header "Authorization: Basic $INWORLD_API_KEY" \
--form 'config={"audio":{"fileName":"clip.mp3"}};type=application/json' \
--form 'file=@"clip.mp3"'
```

#### Python

```python
import json
import requests

url = "https://api.inworld.ai/detection/v1/detect"
headers = {"Authorization": "Basic <api-key>"}

# The config part must come before the file part.
with open("clip.mp3", "rb") as audio:
    files = [
        ("config", (None, json.dumps({"audio": {"fileName": "clip.mp3"}}), "application/json")),
        ("file", ("clip.mp3", audio, "audio/mpeg")),
    ]
    response = requests.post(url, headers=headers, files=files)

print(response.json())
```

#### JavaScript

```javascript
import { openAsBlob } from 'node:fs';

const url = 'https://api.inworld.ai/detection/v1/detect';

// The config part must come before the file part.
const form = new FormData();
form.append('config', JSON.stringify({ audio: { fileName: 'clip.mp3' } }));
form.append('file', await openAsBlob('clip.mp3'), 'clip.mp3');

const response = await fetch(url, {
  method: 'POST',
  headers: { 'Authorization': 'Basic <api-key>' },
  body: form,
});

const data = await response.json();
console.log(data);
```
