Composer client with LazyJsonMapper response models and ready-to-run examples. Supports 54 TikTok Scraper API methods.
Package: jsonscraper/tiktok-api-php · Methods · Examples · Documentation
1. Get your key from the TikTok API product page and set it on your server:
export JSONSCRAPER_TIKTOK_LICENSE_KEY='your-license-key'2. Install the package:
composer require jsonscraper/tiktok-api-php:^0.13. Make a request:
<?php
require __DIR__.'/vendor/autoload.php';
$client = new TikTokRESTAPI\TikTok(getenv('JSONSCRAPER_TIKTOK_LICENSE_KEY'));
$client->setCacheTimeout(60);
$response = $client->getUserInfo('therock');
if ($response->isOk() && $response->getTiktok()?->isUser()) {
echo $response->getTiktok()->getUser()->getUniqueId();
}The API payload is in tiktok. Live calls require a valid API license and may consume quota. Response examples and status handling.
54 methods are available. Common starting points:
| What you need | Method |
|---|---|
| Read a profile | getUserInfo() |
| Read a video | getVideoByID() |
| Get a video download URL | getNoWatermarkUrl() |
| Read comments | getCommentsByID() |
| Search videos | searchVideo() |
| List profile videos | getUserFeed() |
- Read a profile.
- Read a video.
- Read comments.
- Search videos.
- List profile videos.
- Video, author, statistics and playback URL models.
Each example includes command-line parameters, key setup, timeouts, error handling and response output. Run it with --help first; this makes no API request.
Browse all 54 complete examples · Full method and parameter reference
The PHP client uses Guzzle + LazyJsonMapper. A response is an APIResponse with nested models and readable getters:
$video = $response->getTiktok()?->getAwemeDetail();
echo $video?->getAuthor()?->getNickname();
echo $video?->getStatistics()?->getPlayCount();Model hierarchy and complete usage guide · All model classes
Requests use a 30-second timeout by default. Configure caching and retries to fit your application's request budget. Keys are read from your server environment; redirects are disabled.
Configuration options, HTTP errors, caching and pagination · Full integration guide
Prefer an assistant connection? Use the shared jsonscraper MCP server. Connect an Instagram API license, a TikTok API license, or both; each product keeps its own plan and quota. MCP source and setup.
The SDK source is MIT-licensed. Hosted API access requires a separate TikTok license. Check current plans and get access.
Service support · SDK issues · Changelog · MIT license
composer testTests use a local/mock server and require no API key. A GitHub Actions template is available for optional automation.
The SDK has no installation or usage telemetry. README links use campaign parameters for website referral analytics. jsonscraper is independent and is not affiliated with TikTok.