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

# Analyze Audio

> Quick start for detecting AI/robotic deepfake voice recordings.

The **Audio Analysis API** detects AI-generated or manipulated voice recordings.\
It applies advanced deepfake detection models to evaluate the authenticity of speech, identifying indicators of robotic synthesis, splicing, or cloned voices.

This feature is essential for **fraud prevention**, **voice verification**, and **trust & safety** use cases where detecting synthetic audio is critical.

> The process runs asynchronously — you upload an audio file, receive a `job_id`, and then poll for the final verdict and confidence score.

***

## Endpoint Overview

**Method:** `POST`\
**Path:** `/api/v4/deepfake/audio/analyze`\
**Base URL:** `https://api.dataspike.io`\
**Authentication:** Include your API key in the header\
`ds-api-token: <YOUR_API_KEY>`

**Supported formats:** `.wav`, `.mp3`, `.m4a`\
**Maximum file size:** `10 MB`\
**Content type:** `multipart/form-data` containing one `file` field

## Example Workflow (cURL)

The Audio Analysis API runs asynchronously.\
Each analysis consists of two simple steps:

### 1. Submit an audio file for analysis

Send your audio file to the API to start the deepfake detection job.

```bash theme={null}
curl -X POST "https://api.dataspike.io/api/v4/deepfake/audio/analyze" \
  -H "ds-api-token: $DATASPIKE_API_KEY" \
  -F "file=@voice.m4a"
```

**Response (example):**

```json theme={null}
{
  "id": "01827ed4-c928-7a3c-9a30-7ab7cc169d11",
  "status": "queued",
  "job_type": "audio"
}
```

The API returns a `job ID` immediately.
This means the analysis has been queued — processing runs asynchronously on the backend.
Keep this id to check progress and retrieve final results.

### 2. Retrieve job results

```bash theme={null}
JOB_ID="01827ed4-c928-7a3c-9a30-7ab7cc169d11"

curl -X GET "https://api.dataspike.io/api/v4/deepfake/job/$JOB_ID" \
  -H "ds-api-token: $DATASPIKE_API_KEY"
```

**Completed response (example):**

```json theme={null}
{
  "id": "01827ed4-c928-7a3c-9a30-7ab7cc169d11",
  "status": "completed",
  "job_type": "audio",
  "score": 0.87,
  "verdict": "deepfake_likely"
}
```

When `status` is `completed`, the response includes:

| Field     | Description                                                                           |
| --------- | ------------------------------------------------------------------------------------- |
| `score`   | Confidence value (0–1). Higher values indicate stronger deepfake likelihood.          |
| `verdict` | Human-readable classification — for example `deepfake_likely` or `deepfake_unlikely`. |

> **Tip:** Use a score threshold aligned with your use case (for example, flag recordings with `score > 0.6` for manual review).

### Typical Flow

1. Upload an audio file for analysis.
2. Store the returned `job_id`.
3. Poll the job endpoint every few seconds until `status` becomes `completed`.
4. Read `score` and `verdict` to make automated or manual decisions in your system.

***

## Practical Tips

* **Keep files ≤ 10 MB.** If your recordings are larger, compress (e.g., transcode to mono, lower bitrate) before upload.
* **One file per request.** Use the `file` form field.
* **Backoff when polling.** Poll every 1–3 seconds with exponential backoff to avoid rate limits.
* **Sandbox testing (optional):** `https://sandboxapi.dataspike.io` with the same paths and headers.
* **Handle failures:** If `status` is `failed`, inspect `message`/`error_code` and consider retrying with cleaner audio.
