# Files

> Upload, list, fetch and delete files to use in chat messages.

## Upload a file

`POST https://antarya.ai/v1/files`

Send the file as multipart form data in the field `file`. Antarya returns the file object, with its id, which you put in a `file` part of a message. The [guide](https://antarya.ai/docs/guides/files-and-images.md) shows the whole path.

### Headers

| Header | Value |
|---|---|
| `Authorization` | `Bearer $ANTARYA_API_KEY` |
| `Content-Type` | `multipart/form-data`, set by your client |

```bash
curl https://antarya.ai/v1/files \
  -H "Authorization: Bearer $ANTARYA_API_KEY" \
  -F file=@agreement.pdf
```

```python
from antarya import Antarya

client = Antarya()

file = client.files.create(file=open("agreement.pdf", "rb"))
print(file.id)
```

```typescript
import fs from "node:fs";
import Antarya from "antarya";

const client = new Antarya();

const file = await client.files.create({ file: fs.createReadStream("agreement.pdf") });
console.log(file.id);
```

Output:

```
{
  "id": "file_01",
  "filename": "agreement.pdf",
  "size": 48213,
  "created_at": "2026-11-27T09:30:00Z"
}
```

- `file` (file, required): The file to upload.

## The file object

- `id` (text, required): The id to use in a message part, such as file_01.
- `filename` (text, required): The name the file was uploaded with.
- `size` (number, required): The size in bytes.
- `created_at` (text, required): When the file was uploaded, as an ISO 8601 time.

## List, fetch and delete

| Request | Does |
|---|---|
| `GET /v1/files` | Lists your files, newest first. |
| `GET /v1/files/{id}` | Returns one file object. |
| `DELETE /v1/files/{id}` | Deletes the file. Messages that already used it keep their replies. |

```bash
curl https://antarya.ai/v1/files \
  -H "Authorization: Bearer $ANTARYA_API_KEY"

curl -X DELETE https://antarya.ai/v1/files/file_01 \
  -H "Authorization: Bearer $ANTARYA_API_KEY"
```

```python
files = client.files.list()
client.files.delete("file_01")
```

```typescript
const files = await client.files.list();
await client.files.delete("file_01");
```

Output:

```
{"id": "file_01", "deleted": true}
```

The file object is `{id, object, filename, media_type, size, created_at}`, and `id` starts with `file_`. Deleting a file returns `{"id": "file_01", "deleted": true}`.

A message with a file or an image is refused when the model's `files` or `images` capability is false.

## Limits

A file can be up to 10 MB and an account can store up to 100 MB during early access. A file or an upload over either limit gets a 413.

| Limit | Value |
|---|---|
| File size | 10 MB a file |
| File types | txt, md, csv, json, pdf, docx, doc, xlsx |
| Stored per account | 100 MB in total |

## Next steps

- [Files and images guide](https://antarya.ai/docs/guides/files-and-images.md): Use an uploaded file in a message.
- [Chat](https://antarya.ai/docs/api/chat.md): The message parts a file goes in.
- [Errors](https://antarya.ai/docs/api/errors.md): What a failed upload returns.
