# Upload a file

Uploads a file.

```http
POST https://api.pozy.ai/v1/files
```

- Area: Email, calendar & files / Files
- Auth: Authorization: Bearer pz_live_...

## Request body

Content type: `application/json`

- `accountId`, string, required
- `name`, string, required: Up to 255 characters
- `contentType`, string, required
- `parentId`, string
- `url`, string (URL), required
- `convertTo`, string: One of `application/vnd.google-apps.document`, `application/vnd.google-apps.spreadsheet`, `application/vnd.google-apps.presentation`

## Example request

```bash
curl -X POST "https://api.pozy.ai/v1/files" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "accountId": "696e0b682d0a31188e7a2ba9",
  "name": "Acme",
  "contentType": "image/jpeg",
  "url": "https://pozy.ai/media/example-1.jpg"
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/files", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    accountId: "696e0b682d0a31188e7a2ba9",
    name: "Acme",
    contentType: "image/jpeg",
    url: "https://pozy.ai/media/example-1.jpg"
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.post(
    "https://api.pozy.ai/v1/files",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "accountId": "696e0b682d0a31188e7a2ba9",
        "name": "Acme",
        "contentType": "image/jpeg",
        "url": "https://pozy.ai/media/example-1.jpg",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 201

- `data`, object
  - `id`, string, required
  - `accountId`, string, required
  - `provider`, string, required: One of `google`, `microsoft`
  - `name`, string, required
  - `kind`, string, required: One of `file`, `folder`
  - `mimeType`, string, required: Can be null
  - `size`, integer, required: Can be null
  - `parentId`, string, required: Can be null
  - `webUrl`, string, required: Can be null
  - `downloadable`, boolean, required
  - `exportMimeType`, string: Can be null
  - `createdAt`, string (date-time), required: Can be null
  - `modifiedAt`, string (date-time), required: Can be null
  - `trashed`, boolean, required

```json
{
  "data": {
    "id": "6bfebd43ddc270f6d2c56fc5",
    "accountId": "696e0b682d0a31188e7a2ba9",
    "provider": "google",
    "name": "Acme",
    "kind": "file",
    "mimeType": "image/jpeg",
    "size": 482133,
    "parentId": "6009d4193e17fdf7d162c048",
    "webUrl": "https://pozy.ai/media/example-1.jpg",
    "downloadable": true,
    "exportMimeType": "image/jpeg",
    "createdAt": "2026-10-02T09:00:00.000Z",
    "modifiedAt": "2026-10-02T09:00:00.000Z",
    "trashed": true
  }
}
```
