# Get upload URL

Fetches an upload URL.

```http
POST https://api.pozy.ai/v1/media/presign
```

- Area: Publishing / Media
- Auth: Authorization: Bearer pz_live_...

## Request body

Content type: `application/json`

- `filename`, string, required
- `contentType`, string, required: One of `image/jpeg`, `image/jpg`, `image/png`, `image/webp`, `image/gif`, `video/mp4`, `video/mpeg`, `video/quicktime`, `video/avi`, `video/x-msvideo`, `video/webm`, `video/x-m4v`, `application/pdf`, `audio/mpeg`, `audio/mp4`, `audio/aac`, `audio/ogg`, `audio/wav`, `audio/webm`, `audio/x-m4a`, `application/x-subrip`, `text/vtt`
- `size`, integer

## Example request

```bash
curl -X POST "https://api.pozy.ai/v1/media/presign" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "filename": "photo.jpg",
  "contentType": "image/jpeg"
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/media/presign", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    filename: "photo.jpg",
    contentType: "image/jpeg"
  }),
});
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/media/presign",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "filename": "photo.jpg",
        "contentType": "image/jpeg",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `uploadUrl`, string (URL)
- `publicUrl`, string (URL)
- `key`, string
- `expiresIn`, integer

```json
{
  "uploadUrl": "https://pozy.ai/media/example-1.jpg",
  "publicUrl": "https://pozy.ai/media/example-1.jpg",
  "key": "string",
  "expiresIn": 1
}
```
