How do I continue from a Douyin creator profile without mixing sec_uid, uid and handles?
How do I continue from a Douyin creator profile without mixing sec_uid, uid and handles?
To list a Douyin creator’s posts, extract the sec_uid segment after /user/ from the creator’s profile URL and pass sec_uid as the sec_user_id parameter. To obtain the numeric account ID, read data.user.uid from the profile response. Use the displayed Douyin handle only for manual review. If you only have a numeric UID, start with douyin.web.fetch_user_profile_by_uid and verify any returned sec_uid before requesting posts.
For example, for a home-organization creator, confirm the account first, then use the creator’s post directory to select relevant tutorials. Keep nickname, unique_id, and uid in separate fields so later observations refer to the same account.
Choose the identifier for the task
The profile output field is sec_uid, while the request input name is sec_user_id. Keep sec_uid and sec_user_id distinct instead of renaming every identifier to id, and do not calculate uid from sec_uid.
Look up a uid from sec_uid, or start from a uid
With a verified sec_uid, call douyin.web.handler_user_profile_v4, confirm that data.user.sec_uid matches the requested account, and then read data.user.uid. With only a confirmed numeric uid, call douyin.web.fetch_user_profile_by_uid with uid as a string. Because the output schema of douyin.web.fetch_user_profile_by_uid is unconfirmed, verify and keep sec_uid if the response explicitly returns a matching value; otherwise, confirm the creator from a profile link or other primary material before requesting posts.
When is a profile request needed?
With a verified sec_uid and a task that only needs the post list, go directly to the creator directory. To check the account’s uid, handle, and profile fields, request data:douyin.web.handler_user_profile_v4 with sec_user_id.
The profile object lives at data.user. Compare the returned data.user.sec_uid with the requested sec_user_id before recording uid, unique_id, short_id, and nickname. Record a missing handle as unavailable. A shared display name is not evidence of the same account.
To hand the task to an assistant with BeatAPI tools configured:
Use this verified profile as the starting point for creator research. Reuse sec_uid when listing posts; retrieve profile details only when needed and confirm the returned account matches. Keep the source URL and identifiers, then select home-organization tutorials to investigate.
Profile retrieval and post retrieval are billed as separate requests; see current pricing. The local helper douyin_identity.py below prepares a request and verifies a saved response; douyin_identity.py makes no network calls.
Prepare the right request, then cross-check its saved response
douyin_identity.py only prepares and verifies local files. The prepare command reads a complete HTTPS profile URL. prepare does not resolve short links or search nicknames, and rejects video URLs, lookalike domains and numeric-uid paths. Query parameters and fragments are not sent to the API. A copied /user/ segment that prepare accepts does not prove the account exists.
Save the script as douyin_identity.py:
Run python3 douyin_identity.py prepare 'REAL_HTTPS_PROFILE_URL' profile-request. The new profile-request folder contains request.json and input-audit.json with executed set to false. Review the identity before approving the profile request. Submit only request.json as the API body, then save the actual response as profile-call/response.json together with the HTTP status. A failed response does not go into verify and does not trigger automatic identifier guesses.
With a saved successful response, run python3 douyin_identity.py verify profile-request/request.json profile-call/response.json identity-review. The new identity-review folder contains identity.json, the exact raw-profile.json and a separately approvable creator-posts-request.json. verify checks the action, the request_id and an exact data.user.sec_uid match against the original request before recording uid and the other fields. A numeric uid must stay an original nonzero ASCII string; a missing uid stays null and is not filled from short_id.
What do identity.json and creator-posts-request.json establish?
identity.json records sec_uid, uid, unique_id, short_id, nickname, and source_sha256 from one matching profile response. Because a numeric uid can exceed JavaScript’s safe integer range, keep uid as the original string. If you only have a uid, an action that requires sec_user_id cannot convert uid back to sec_uid. Do not calculate an identifier, and do not treat nickname search results as a confirmed match.
creator-posts-request.json is an unexecuted first-page post request that uses the matched sec_uid; creator-posts-request.json collects neither posts nor comments. If you already have a verified sec_uid, skip the profile lookup workflow and use the creator-post guide directly. An empty custom handle stays empty: do not infer an account problem or substitute another ID. source_sha256 verifies local file bytes; source_sha256 does not prove a permanent account identity or the accuracy of the collection time.
Creator-post export and pagination · Video IDs and short links · Delivery-author checks
Verify certification, live status and commerce capability separately
When you evaluate a live-stream collaboration, confirm the profile and save the returned custom_verify and live_status values with the collection time. Use the custom_verify description to help identify the account, and confirm the actual certification type separately. live_status describes the moment of observation only. Product-showcase presence and commerce permission require separate evidence: douyin.web.handler_user_profile_v4 has no verified fixed fields for product-showcase presence or commerce permission.

