Answers
How do I get a Douyin user's sec_uid from a profile link?
Short answer
Send the profile link or a v.douyin.com share link to the okdata Douyin account profile endpoint; the id it returns is the sec_uid, along with followers, likes and video count, for $0.002. Any video or search result from that user also carries the sec_uid as author.id, so you often have it already.
Douyin knows each account by several identifiers. The Douyin number (抖音号) on the profile is the one people see and can change. The numeric uid is internal. The sec_uid, a long string starting with MS4wLjABAAAA, is what Douyin's web and app APIs use to fetch a profile or its videos, and it is what most tools ask for. Scrapers fail with "failed to extract sec_user_id" when a link format changes or a short link does not redirect the way they expect. The quickest way to get it is a profile lookup from any link to the account.
Three ways to get it
- From a profile link. Call Douyin account profile with
url=https://www.douyin.com/user/MS4w...(the sec_uid is already in the path) or with a v.douyin.com share link copied from the app's profile share button. The responseidis the sec_uid. - From one of their videos. Video detail returns
author.id, which is the author's sec_uid. Useful when all you have is a video link. - From search. Every video search result includes
author.idas well.
What you do with it
Account videos requires the sec_uid as id. So does calling the profile again later without a link.
| Step | Calls | Cost |
|---|---|---|
| Profile link to sec_uid and stats | 1 | $0.002 |
| Then the latest 20 videos | 1 | $0.002 |
| 100 accounts, both steps | 200 | {{cost:douyin.users.get100+douyin.users.videos.list100}} |
Example
curl -G "https://api.okdata.online/v1/douyin/users/get" \
-H "Authorization: Bearer $OKDATA_API_KEY" \
--data-urlencode 'url=https://v.douyin.com/iAbCdEf/' \
--data-urlencode 'fields=id,name,username,followers,posts'
id is the sec_uid, username the Douyin number shown in the app.
Limits
- There is no lookup by Douyin number or nickname in this catalog. If that is all you have, open the profile in the app and use its share link, or find one of their videos.
- Converting a sec_uid to the numeric uid is not offered as a separate call; with
view=fullthe profile response includesext.uidwhen Douyin provides it. - Banned or deleted accounts return
not_found, which is free.
Alternatives
For one account, open it in a browser: the sec_uid is in the address bar after /user/. Open-source tools like TikTokDownloader extract it from links locally and are fine when they keep up with link formats. For tracking many accounts, see creator discovery.
Updated