# File Purposes

Source: https://staging-docs.aiand.com/api/file-purposes/

Every uploaded file has a `purpose` — a label that tells ai& how the file may be used and which model capabilities are required to reference it.

## Supported purposes

| Purpose | MIME types | Single-shot limit | Use with |
|---------|------------|-------------------|----------|
| `vision` | `image/png`, `image/jpeg`, `image/webp`, `image/gif` | 100 MB | Vision-capable models — see [Vision](/capabilities/vision/) |
| `video` | `video/mp4`, `video/webm`, `video/quicktime` | Use [Uploads API](/api/uploads/) (8 GB) | Video-capable models — see [Video Understanding](/capabilities/video/) |

## Inference from MIME

The `purpose` field is **optional** on upload. If you omit it, ai& infers the purpose from the file's MIME type. This lets the official `anthropic` SDK — which doesn't carry a purpose field — work drop-in.

```bash
curl https://api.aiand.com/v1/files \
  -H "Authorization: Bearer sk-..." \
  -F "file=@cat.png"
# inferred purpose: "vision"
```

## Capability gating at request time

When you reference a `file_id` in a chat message, the file's purpose must match a capability the target model declares:

- `purpose: "vision"` → model must have the `vision` capability.
- `purpose: "video"` → model must have the `video` capability.

Mismatched requests return `400 invalid_request_error` without ever calling the model.

<Aside type="note">
  Additional purposes (e.g. `audio`, `assistants`, `batch`) may be added in future versions — the upload endpoint will return a 400 with a clear error if you pass an unsupported one.
</Aside>
