You need to programmatically fetch TikTok user details to power user management flows—verifying accounts during onboarding, enriching profiles, or reconciling stored records with live data. By the end of this guide you’ll be able to call a real “Get User Info” endpoint, handle its response, and wire it into a production workflow, with working curl and Python examples you can paste into your codebase today.
What this API does and how it helps User Management
The TikTok Data API on Zyla API Hub exposes two read-only endpoints you can call with a single API key:
- Get User Info: returns information about a TikTok user by
user_id. This is the core building block for user verification and sync tasks. - Get Video Info: returns video-level metadata by
url. This is useful when your user management flow has to associate users with their shared content or validate that a submitted video URL is valid and belongs to the intended account.
Typical user management use cases include:
- Validating a TikTok
user_idsupplied during signup or linking an existing profile to a customer account. - Enriching your user table with canonical IDs you can key off reliably in downstream systems.
- Reviewing a video URL a user provided and correlating it with their account before granting access to gated features.
You access both endpoints from a single marketplace account and API key, with subscription-based billing and quota. The first API here offers a 7-day trial (or 50 requests). There’s no free plan; check the API page for current access options and pricing.
Getting started on Zyla API Hub
Open the TikTok Data API listing on Zyla API Hub, click Subscribe or Start Free Trial when available, and copy your API key. All requests include a single header for auth:
- Header:
Authorization: Bearer YOUR_API_KEY
Start your trial here: Start 7-day trial on TikTok Data API. You’ll be calling production-grade endpoints in minutes.
Endpoint reference
Get User Info
Use this endpoint when you have a TikTok user_id and need to fetch that user’s information. This is the centerpiece for user verification and sync.
- Method: GET
- URL: https://zylalabs.com/api/2516/tiktok-data-api/2503/get-user-info
- Required parameter:
user_id(string): TikTok user ID. Example:107955
Official curl example:
curl -s -X GET "https://zylalabs.com/api/2516/tiktok-data-api/2503/get-user-info?user_id=107955" \
-H "Authorization: Bearer YOUR_API_KEY"
Official example response:
{
"code": -1,
"msg": "userinfo is failed! Please check unique_id or user_id.",
"processed_time": 0.1441
}
Field notes you’ll actually use:
code: integer result indicator. A negative value here signals the request did not return user data for the supplied identifier.msg: diagnostic message to aid error handling (e.g., invalid or non-existent ID).processed_time: processing time in seconds (float). Useful for observability and budgeting retries.
Production tip: Store the msg alongside your validation attempt so your support team can distinguish a malformed ID from a not-found condition when reviewing user onboarding issues.
Get Video Info
Use this endpoint when you need to validate or enrich a user’s submission that contains a TikTok video URL. This is common when users link content to prove ownership or eligibility.
- Method: GET
- URL: https://zylalabs.com/api/2516/tiktok-data-api/2504/get-video-info
- Required parameter:
url(string): A TikTok video URL in the specific format shown below.
Note: The video URL must be in the following format https://www.tiktok.com/@khaby.lame/video/7411964588809342241. Official curl example:
Use the returned fields to confirm the video exists and to extract identifiers that help you correlate the content with a user profile in your system. If you collect a user’s TikTok handle alongside this URL, you can cross-check both before allowing an action like joining a creator program or unlocking advanced features.
Working example in Python
The snippet below calls Get User Info with the documented parameters and auth scheme, then branches on the code to determine whether to attach the TikTok account to your internal user record or flag it for review.
import requests
API_KEY = "YOUR_API_KEY"
USER_ID = "107955" # supply the user_id you collected during your user flow
url = "https://zylalabs.com/api/2516/tiktok-data-api/2503/get-user-info"
params = {"user_id": USER_ID}
headers = {"Authorization": f"Bearer {API_KEY}"}
resp = requests.get(url, params=params, headers=headers, timeout=20)
resp.raise_for_status()
data = resp.json()
# Minimal branching logic for user management flows
if isinstance(data, dict) and data.get("code") == 0:
# Example: persist the verified TikTok linkage in your user table
# save_user_tiktok_link(internal_user_id, USER_ID, data)
print("User info retrieved and stored.")
else:
# Log diagnostics and alert your support or risk system
print(f"User verification failed for {USER_ID}.")
print(f"code={data.get('code')} msg={data.get('msg')} processed_time={data.get('processed_time')}")
Notes:
- Timeouts: set one appropriate to your environment; 20 seconds above is an example.
- Retries: only retry idempotent GETs on network-level timeouts or 5xx, not on application-level error codes in the JSON.
- Observability: store
processed_timewith your log context to track slow-downs over time.
Designing user management flows around these endpoints
Below are minimal but effective patterns you can adapt directly in your service layer and queues.
- Signup with TikTok ID:
- Collect
user_idin your form and store it in a pending state. - Call Get User Info immediately; if
codeindicates success, mark the linkage as verified and continue your flow. - If the response indicates a failure, return a precise inline error to the user based on
msg, and queue a support audit if necessary.
- Collect
- Link a TikTok video to a user profile:
- Collect a video
urlfrom the user in the documented format. - Call Get Video Info and confirm the video resolves. If you also have the user’s TikTok
user_id, correlate identifiers from the video metadata for extra assurance before persisting.
- Collect a video
- Periodic resync:
- Schedule a job to re-validate stored
user_idvalues, using Get User Info for a sample or full set of accounts depending on your quota. - Record changes and alert product ops if a previously valid linkage starts failing.
- Schedule a job to re-validate stored
Operational tips that save time
- Authentication: always send
Authorization: Bearer YOUR_API_KEY. Do not add extra headers or attempt key-in-query unless explicitly documented (it is not for this API). - Request shape: both endpoints are GET with query parameters only; there is no request body.
- Processed time: the
processed_timefloat is in seconds; it’s useful for performance dashboards and SLOs. - Caching: if you cache user lookups, respect the fact that user-facing identities can change. Use short TTLs for critical verification flows, longer for non-critical enrichment.
- Error handling: branch on the JSON
codeand inspectmsgfor user-facing guidance or internal logging; treat network errors and JSON-level errors differently. - Quota planning: the marketplace uses subscription + quota (not pay-per-call). The first API here supports a 7-day trial or 50 requests to help you integrate. Monitor usage in your Zyla dashboard and size batch jobs accordingly.
Quick reference: exact parameters and URLs
- Get User Info
- GET https://zylalabs.com/api/2516/tiktok-data-api/2503/get-user-info
- Params:
user_id(string, required)
- Get Video Info
- GET https://zylalabs.com/api/2516/tiktok-data-api/2504/get-video-info
- Params:
url(string, required), format likehttps://www.tiktok.com/@khaby.lame/video/7411964588809342241
Use cases mapped to endpoints
- Account linking: use Get User Info to confirm the TikTok account exists before saving it on the user profile.
- Eligibility checks for creator features: validate a submitted video URL with Get Video Info, then proceed only if the lookup succeeds.
- Support tooling: add a “Re-verify TikTok” button in your admin that calls Get User Info and surfaces
msgto your team.
Call this API from AI agents via MCP
You can also invoke these HTTP endpoints from MCP-compatible developer tools and agents (e.g., Claude Code, Cursor, Windsurf) using the Zyla MCP gateway. Point your client to the MCP endpoint and pass your API key:
- MCP URL:
https://mcp.zylalabs.com/mcp?apikey=YOUR_API_KEY
From your agent, issue the same HTTPS GET requests shown above (including the Authorization header). This lets you script one-click verifications during code reviews or runbook-driven ops without hardcoding secrets into local scripts. For more, see the docs: MCP.
Troubleshooting
- Getting
code: -1on Get User Info: confirm the provideduser_idis correct. Surface themsgto users in a friendly way (e.g., “Please double-check your TikTok user ID”). - Video URL mismatches: ensure the URL follows the documented format, including the path structure. If you capture language query params (e.g.,
?lang=en), keep them URL-encoded as in the example curl. - HTTP 401: verify your Authorization header uses the Bearer scheme and the key hasn’t expired or been rotated.
- Observability: log
processed_timefor each request to identify intermittent slow responses and fine-tune retries.
FAQ
What auth header does the TikTok Data API expect?
Send Authorization: Bearer YOUR_API_KEY on every request.
Can I send a POST body to these endpoints?
No. Both documented endpoints are GET and accept parameters via the query string only.
What does processed_time represent?
It’s the server-side processing time in seconds for your request. Use it for performance monitoring and alerting.
Is there a free plan?
No. The marketplace uses subscription + quota, not pay-per-call. The first API here offers a 7-day trial or 50 requests so you can integrate before committing. For current access options and pricing, check the API page.
How strict is the video URL format?
You must provide a URL in the format shown in the endpoint description (for example, https://www.tiktok.com/@khaby.lame/video/7411964588809342241). Keep query parameters URL-encoded if present.
Ship your integration
You now have the exact URLs, parameters, and working examples to verify TikTok users and validate their submitted content inside your user management flows. Create your account, grab an API key, and start your 7-day trial here: Start 7-day trial on TikTok Data API. One account covers thousands of production-ready APIs on Zyla API Hub with a single key and subscription model.