# Douyin Media download links API (douyin.media_links)

- Canonical page: [https://everyinfra.com/en/douyin-api/media_links](https://everyinfra.com/en/douyin-api/media_links?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "douyin", "action": "media_links", "params": {...}}
- Price: $0.000556 per call ($0.56 per 1,000 requests); failed calls and empty results are not charged
- Billing unit: each element in `urls` counts as one call; the number of elements you send sets the charge
- Returns: list
- Mode: sync only; everything it returns (every target of a batch, or every SKU of a product) is read in one call, and "mode": "async" returns 422 before any charge

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=douyin&action=media_links

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| urls | not declared | yes | not declared | The videos to get download links for, as an array of up to 20 entries; each entry can appear only once. Each entry is a numeric video ID or a `https://www.douyin.com/video/<video_id>` link; short links and share texts are not accepted. Billed per video; videos not found are not charged. Rows carry `input`, the entry you passed. |
| fresh | not declared | no | not declared | For `media_links`: `true` skips cached links and fetches them again; default `false`. The links are signed and expire, and `expires_at` shows when. |
| limit | integer (1–) | no | not declared | The most rows to return in this call, an integer of 1 or more. The default applies when you leave it out, and a call can return fewer rows. |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | The record's unique ID on the platform. Unique only within one platform; IDs can repeat across platforms. |
| url | Link to the record on the platform. |
| media_type | Media type: video, or image for image posts. |
| video_url | Video playback URL (signed, expires; download promptly if you need to keep it). Null for image posts or when the source omits it. |
| video_url_expires_at | platform-native meaning |
| video_width | Video frame width in pixels. |
| video_height | Video frame height in pixels. |
| video_size_bytes | Size of the video file in bytes (`media_links`). |
| has_watermark | platform-native meaning |
| best_stream | The highest-bitrate video stream (`media_links`): {url, bitrate (bps), width, height, size_bytes, expires_at}. |
| stream_count | How many video streams of different quality the video has (`media_links`). |
| cover_image_url | Cover image URL: the cover of a video or image post on search, user_posts, posts_batch, related_posts, mix_posts, music_posts and media_links rows; the music cover on music_search and music_detail; the topic image on billboard_topic_hot; the collection cover on user_mixes; the room cover on live_room. Signed links expire. |
| covers | Cover images (`media_links`): [{url, width, height, expires_at}]; the first is the same as `cover_image_url`. |
| image_urls | Array of image links in the platform's display order; absent when there are no images. |
| audio_url | Audio link: the video's audio track on transcript (mp3), the track's play link on music_search and music_detail, the video's background music on media_links; may expire. |
| request_headers | Headers to send when you download the links (`media_links`), for example {"Referer": "https://www.douyin.com/"}. Without them the download may be refused. |
| expires_at | When the earliest-expiring link in the row stops working (`media_links`, ISO 8601, UTC). After that, fetch the links again with `fresh=true`. |
| fetched_at | When the links were fetched (`media_links`, ISO 8601, UTC); without `fresh` they may come from a cache. |
| platform | Source platform identifier, the same as platform in the request (for example xiaohongshu, tiktok). |
| input | The entry from `urls` that this row answers, returned exactly as you passed it (`posts_batch`, `profiles_batch`, `media_links`). Use it to match rows to your entries. |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "douyin",
  "action": "media_links",
  "params": {
    "urls": [
      "https://www.douyin.com/video/<VIDEO_ID_A>"
    ]
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "douyin",
        "action": "media_links",
        "params": {
            "urls": [
                "https://www.douyin.com/video/<VIDEO_ID_A>",
            ],
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

No real sample for these example parameters yet: structure only, every value is a placeholder (…).

```text
{
  "id": "req_…",
  "platform": "douyin",
  "action": "media_links",
  "results": [
    {
      "id": …,
      "url": …,
      "media_type": …,
      "video_url": …,
      "video_url_expires_at": …,
      "video_width": …,
      "video_height": …,
      "video_size_bytes": …,
      "has_watermark": …,
      "best_stream": …,
      "stream_count": …,
      "cover_image_url": …,
      "covers": …,
      "image_urls": …,
      "audio_url": …,
      "request_headers": …,
      "expires_at": …,
      "fetched_at": …,
      "platform": …,
      "input": …
    }
  ],
  "count": …,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=douyin
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
