Learn by Example
Social Media API Tutorials & Code Examples
Step-by-step TikTok API tutorials, Instagram API Python examples, and YouTube data extraction guides. From simple API requests to advanced async data collection in Python, JavaScript, Go, Java, and PHP.
Simple API Request
Learn how to make your first API request to fetch user information
Important Notes:
- Remember to replace YOUR_API_KEY with your actual API key from the dashboard.
- Install required packages: pip install requests
1import requests23url = "https://api.tikhub.io/api/v1/instagram/web_app/fetch_user_info_by_username"4headers = {5 "accept": "application/json",6 "Authorization": "Bearer YOUR_API_KEY" # Replace with your actual API key7}8params = {9 "username": "instagram"10}1112response = requests.get(url, headers=headers, params=params)1314print(response.status_code)15print(response.json())
HTTP Status Codes
Common API response codes and what they mean.
Bad Request
The request format is incorrect or parameters are invalid. Sometimes occurs due to server internal errors.
Unauthorized
Invalid API token. API token is missing. Unable to validate API token. API token status is invalid or not activated. API token has expired. User not found.
Payment Required
Insufficient balance. This endpoint requires payment and accepts free credits, or this endpoint requires payment and does not accept free credits.
Forbidden
Lacking required permissions for this route. Account is disabled. Email is not verified. API token lacks required permissions.
Not Found
Endpoint data not found in the database.
Too Many Requests
Request too fast, exceeding the rate limit.
Internal Server Error
Server internal error, unable to complete the request.
TikHub API: Frequently Asked Questions
Everything you need to know about using TikHub social media API, from pricing and payments to rate limits and data legitimacy.
My request shows timeout? Why?
Timeouts can occur due to large data requests or temporary server load. Try reducing the request scope, adding pagination, or retrying after a few seconds. If persistent, contact support.
Is there a way to use TikHub API for free?
Yes! New accounts get ~50 free requests to test every endpoint. No credit card required. After that, you can use pay-as-you-go pricing starting at $0.001 per request.
What payment methods does TikHub support?
We accept Alipay, PayPal, Crypto (USDT), and B2B wire transfers for enterprise customers.
Why can't I make a payment?
Common issues include browser extensions blocking payment widgets, VPN interference, or regional restrictions. Try disabling extensions, switching browsers, or contact support for alternative payment options.
Why isn't my balance showing after payment?
Balance updates are usually instant. If delayed, check your email for payment confirmation and wait a few minutes. If the issue persists, contact support with your transaction ID.
Why am I getting a 403 error on API requests?
A 403 error means your API token lacks the required permissions, your account is disabled, or your email is not verified. Check your dashboard settings and verify your email.
Why can't I sign up using a company/custom email?
We support most email providers. If you're having trouble, try using a Gmail or Outlook account, or contact support for manual account creation.
Where can I download my receipts?
Receipts are available in your User Dashboard under the billing section. You can download PDF receipts for all transactions.
Are there any advanced customization options?
Enterprise customers can request custom API endpoints, private deployments, and dedicated support. Contact our team for details.
How does the referral program work?
Share your referral link and earn commission on every new user who signs up and makes a purchase. Track earnings in your dashboard.
How many API keys can I create?
Each user can create up to 100 API keys, perfect for managing multiple applications or projects.
Is the data legitimate?
Yes, all data provided through TikHub is publicly available and accessible to anyone at any time. We do not own the data — all rights and interpretations belong to the respective platforms.
Want More TikTok API & Instagram API Examples?
Check out our comprehensive Python SDK and demo repository with social media API examples for multiple platforms.
TikHub API Demo Repository