> For the complete documentation index, see [llms.txt](https://docs.bitmind.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bitmind.ai/api-reference/api/v1-detect.md).

# Unified Detect

A single endpoint that inspects your input, determines whether it's an **image**, **video**, or **text**, and runs the right detector — so you don't have to call a type-specific endpoint. This is the recommended front door for new integrations.

## Endpoint

`POST https://api.bitmind.ai/v1/detect`

## Authentication

Send a Bearer token in the `Authorization` header.

See [Authentication](/api-reference/authentication.md).

## How routing works

The media type is resolved automatically:

* **Binary uploads** (file, base64, or a downloaded URL) are identified by their content — JPEG/PNG/etc. → image, MP4/WebM/etc. → video.
* **Plain text** is detected implicitly — no flag required. A `text/plain` body, a JSON `text` field, or a JSON `media` string that isn't a URL/base64 medium is scored as text.
* Bytes that match no supported media format are rejected with `415`.

You may optionally set `type` to force routing (`image`, `video`, or `text`). A `type` that contradicts the actual bytes returns `400`.

## Request

### Auto-detected URL

```bash
curl -X POST https://api.bitmind.ai/v1/detect \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"media": "https://example.com/photo.jpg"}'
```

### Multipart file upload

```bash
curl -X POST https://api.bitmind.ai/v1/detect \
  -H "Authorization: Bearer $API_KEY" \
  -F "file=@clip.mp4"
```

### Plain text (implicit)

```bash
curl -X POST https://api.bitmind.ai/v1/detect \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: text/plain" \
  --data "In conclusion, the synergistic leveraging of cross-functional..."
```

### JSON fields

| Field         | Type    | Required | Description                                                          |
| ------------- | ------- | -------- | -------------------------------------------------------------------- |
| `media`       | string  | No\*     | URL or base64 data URI of an image/video                             |
| `text`        | string  | No\*     | Text passage to analyze (alternative to `media`)                     |
| `type`        | string  | No       | Force routing: `image`, `video`, or `text` (otherwise auto-detected) |
| `debug`       | boolean | No       | Include debug data in the response                                   |
| `postContext` | object  | No       | Source context, forwarded to text detection                          |

\* Provide exactly one of `media`, `text`, or a multipart `file`.

For **video**, the trim parameters `startTime`, `endTime`, and `fps` are honored, just like [Detect Video](/api-reference/api/detect-video.md).

## Response

The response is an envelope: `mediaType` tells you what was detected, and `result` is the **same payload** the type-specific endpoint returns.

```json
{
  "mediaType": "image",
  "result": {
    "isAI": false,
    "confidence": 0.23,
    "similarity": 0.05,
    "objectKey": "1234567890.jpg"
  }
}
```

| Field       | Type   | Description                                |
| ----------- | ------ | ------------------------------------------ |
| `mediaType` | string | Detected type: `image`, `video`, or `text` |
| `result`    | object | The native detection result for that type  |

See [Detect Image](/api-reference/api/detect-image.md), [Detect Video](/api-reference/api/detect-video.md), and [Detect Text](/api-reference/api/detect-text.md) for the per-type `result` shapes.
