# My Douyin tool keeps saying the cookie is invalid. How do I stop depending on cookies?

> Why Douyin tools keep asking you to update the cookie, why they fail after a few dozen accounts, and how to read public Douyin data with only an API key.

Canonical page: https://okdata.online/answers/douyin-cookie-expired/

**Short answer: **Douyin ties web requests to a logged-in cookie plus tokens like msToken and ttwid, which expire and get rate-limited per account, so tools fail with 'update your cookie' after a while. okdata reads public Douyin data with an API key and no cookie of yours: an account's videos cost $0.002 per page of about 20, and 50 accounts' latest videos $0.10.

"The response is not valid JSON, please try updating your cookie." Anyone who has collected Douyin data with an open-source tool has seen some version of this. You paste a fresh cookie from the browser and it works again, until the next day, or until you have pulled about 35 creators and the account gets throttled for an hour. Sometimes the whole identity is invalidated at once and nothing works until you log in again. For public data you can drop the cookie altogether and call an API with a key.

The cookie is only part of it. Douyin's web API also expects tokens such as `msToken`, `ttwid` and `s_v_web_id` that rotate on their own schedule, and it rate-limits each logged-in account. A tool built on your cookie inherits all of that.

## Read public data without a cookie

If your goal is metadata about public accounts and videos, not your own likes or favorites, an API key is enough. okdata handles Douyin access on its side and returns JSON:

- [Account profile](/apis/douyin/users/get/): followers, likes, video count, by profile link or sec_uid.
- [Account videos](/apis/douyin/users/videos/list/): an account's videos, newest first, with likes, comments, shares and saves.
- [Video detail](/apis/douyin/videos/get/): one video by link or ID.

| Job | Calls | Cost |
|---|---|---|
| 50 creators: profile + latest videos | 100 | $0.20 |
| 50 creators, 5 pages of videos each | 250 | $0.50 |
| 1,000 single videos by link | 1,000 | $2.00 |

There is no per-account throttle to work around: the limit is your key's request rate, reported in `X-RateLimit-*` headers.

## Example

```bash
curl -G "https://api.okdata.online/v1/douyin/users/videos/list" \
  -H "Authorization: Bearer $OKDATA_API_KEY" \
  --data-urlencode 'id=MS4wLjABAAAA...' \
  --data-urlencode 'fields=id,text,published_at,metrics.likes,url'
```

## What this does not replace

- **Video files.** The API returns video metadata and links to the videos on Douyin, not downloadable MP4s. For archiving files, a downloader with your cookie is still the tool.
- **Your own account's data:** liked videos, favorites, private videos. Those exist only behind your login.
- **Play counts** for other people's videos, which Douyin does not publish.

## Keeping a cookie-based tool alive

If you stay with TikTokDownloader or Douyin_TikTok_Download_API, use a secondary account, pause between creators, and refresh the cookie from the same browser profile. Expect to redo it regularly. For tracking many creators on a schedule, see [competitor monitoring](/solutions/competitor-monitoring/).

## Endpoints used

- [Douyin account videos](https://okdata.online/apis/douyin/users/videos/list/) `douyin.users.videos.list`: $0.002 per call · about 20 videos per page
- [Douyin account profile](https://okdata.online/apis/douyin/users/get/) `douyin.users.get`: $0.002 per call
- [Douyin video detail](https://okdata.online/apis/douyin/videos/get/) `douyin.videos.get`: $0.002 per call

Updated 2026-11-12
