Search by

jsonscraper / tiktok-api-php

sergeykomlev

TikTok Scraper API for PHP — typed response models, video, profiles, comments and search

Package info

github.com/jsonscraper/tiktok-api-php

pkg:composer/jsonscraper/tiktok-api-php

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.1 2026-10-25 07:08 UTC

This package is auto-updated.

Last update: 2026-10-25 08:36:28 UTC


README

Latest release PHP requirements Last commit MIT license Packagist version Packagist PHP support

Run in Postman

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

Quick start: API key, setup, first request, JSON response

Quick start

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.1

3. 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.

Main methods

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()

All methods and parameters →

Ready-to-run examples

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

Response models

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

Configuration

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

Use with ChatGPT and Codex

Prefer an assistant connection? Use the separate TikTok MCP server. It accepts the same product API license and uses the normal API quota. MCP source and setup.

Access, pricing and support

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

Development

composer test

Tests 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.