# MIME API
> A fast, fully-local MIME and file-type toolkit: look up the MIME type, charset and category for a filename or extension, list every file extension registered for a MIME type, and detect a file's real type from its leading magic bytes (over 40 signatures, including RIFF container disambiguation for WEBP, WAV and AVI), accepting hex or base64 input. Every endpoint accepts input via the query string or the request body. Pure server-side compute, no third-party upstream, so responses are instant and always available. Ideal for upload validation, security (verify a file's real type against its claimed extension), CDNs and content pipelines.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/mime-api/..."
```

## Pricing
- **Free** (Free) — 13,000 calls/Mo, 3 req/s
- **Basic** ($5/Mo) — 175,000 calls/Mo, 12 req/s
- **Pro** ($16/Mo) — 950,000 calls/Mo, 40 req/s
- **Mega** ($41/Mo) — 5,000,000 calls/Mo, 120 req/s

## Endpoints

### MIME

#### `GET /v1/detect` — Detect type from magic bytes

**Parameters:**
- `hex` (query, optional, string) — Leading bytes as hex Example: `89504e470d0a1a0a`
- `base64` (query, optional, string) — Leading bytes as base64

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/mime-api/v1/detect?hex=89504e470d0a1a0a"
```

**Response:**
```json
{
    "data": {
        "mime": "image/png",
        "name": "PNG image",
        "category": "image",
        "detected": true,
        "extension": "png",
        "signature": "89504e47"
    },
    "meta": {
        "timestamp": "2026-05-30T10:10:55.631Z",
        "request_id": "a6db6fec-6d5d-4a48-b730-beba9d09ca13"
    },
    "status": "ok",
    "message": "OK",
    "success": true
}
```

#### `GET /v1/extensions` — MIME to extensions

**Parameters:**
- `mime` (query, required, string) — MIME type Example: `image/png`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/mime-api/v1/extensions?mime=image%2Fpng"
```

**Response:**
```json
{
    "data": {
        "mime": "image/png",
        "primary": "png",
        "category": "image",
        "extensions": [
            "png"
        ]
    },
    "meta": {
        "timestamp": "2026-05-30T10:10:55.707Z",
        "request_id": "b6a3ba6f-4cd3-45e6-9d5d-99aa845d1fd9"
    },
    "status": "ok",
    "message": "OK",
    "success": true
}
```

#### `GET /v1/lookup` — Filename/extension to MIME

**Parameters:**
- `name` (query, required, string) — Filename or extension Example: `report.pdf`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/mime-api/v1/lookup?name=report.pdf"
```

**Response:**
```json
{
    "data": {
        "mime": "application/pdf",
        "input": "report.pdf",
        "charset": null,
        "category": "document",
        "extension": "pdf",
        "content_type": "application/pdf"
    },
    "meta": {
        "timestamp": "2026-05-30T10:10:55.782Z",
        "request_id": "1712e8e1-fcc0-4c3b-9cfe-f22c80ec7c06"
    },
    "status": "ok",
    "message": "OK",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/mime-api
OpenAPI spec: https://www.oanor.com/api/mime-api/openapi.json
