# Download a TikTok video

Downloads a TikTok video. Works with TikTok accounts.

```http
GET https://api.pozy.ai/v1/tools/tiktok/download
```

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

## Query parameters

- `url` (string, required)
- `action` (string): one of download, formats
- `formatId` (string)

## Example request

```bash
curl -X GET "https://api.pozy.ai/v1/tools/tiktok/download?url=https%3A%2F%2Fpozy.ai%2Fmedia%2Fexample-1.jpg" \
  -H "Authorization: Bearer $POZY_API_KEY"
```

```ts
const res = await fetch("https://api.pozy.ai/v1/tools/tiktok/download?url=https%3A%2F%2Fpozy.ai%2Fmedia%2Fexample-1.jpg", {
  headers: { Authorization: `Bearer ${process.env.POZY_API_KEY}` },
});
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.get(
    "https://api.pozy.ai/v1/tools/tiktok/download",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    params={
        "url": "https://pozy.ai/media/example-1.jpg",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `success`, boolean, required
- `title`, string, required
- `format`, string
- `downloadUrl`, string
- `duration`, number
- `cover`, string
- `formats`, array of object
  - `id`, string
  - `label`, string
  - `ext`, string
  - `type`, string
  - `height`, number
  - `width`, number
  - `fps`, number
  - `hasAudio`, boolean
  - `hasVideo`, boolean

```json
{
  "success": true,
  "title": "Launch day",
  "format": "string",
  "downloadUrl": "https://pozy.ai/media/example-1.jpg",
  "duration": 12.5,
  "cover": "string",
  "formats": [
    {
      "id": "6bfebd43ddc270f6d2c56fc5",
      "label": "string",
      "ext": "string",
      "type": "string",
      "height": 12.5,
      "width": 12.5,
      "fps": 12.5,
      "hasAudio": true,
      "hasVideo": true
    }
  ]
}
```
