PHPackages                             flowtok/tiktok-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. flowtok/tiktok-api

ActiveLibrary[API Development](/categories/api)

flowtok/tiktok-api
==================

Unofficial TikTok API for PHP

2.0.3(4y ago)07MITPHP

Since Sep 25Pushed 4y agoCompare

[ Source](https://github.com/flowtok/TikTok-API-PHP)[ Packagist](https://packagist.org/packages/flowtok/tiktok-api)[ Docs](https://github.com/ssovit/TikTok-API-PHP)[ RSS](/packages/flowtok-tiktok-api/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (30)Used By (0)

Unofficial TikTok API library for PHP
=====================================

[](#unofficial-tiktok-api-library-for-php)

[![GitHub issues](https://camo.githubusercontent.com/146fbf49690fcef4acdbf1f01f3fa2ff87727835a85555a83fc1efe42bed1727/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f73736f7669742f54696b546f6b2d4150492d5048503f7374796c653d666f722d7468652d6261646765)](https://github.com/ssovit/TikTok-API-PHP/issues) [![Packagist Downloads](https://camo.githubusercontent.com/a87c132de863f8304cd90748f85e7c08464d8e8def4e016d16f47089327f8122/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f73736f7669742f74696b746f6b2d6170693f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/a87c132de863f8304cd90748f85e7c08464d8e8def4e016d16f47089327f8122/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f73736f7669742f74696b746f6b2d6170693f7374796c653d666f722d7468652d6261646765) [![GitHub Workflow Status](https://camo.githubusercontent.com/5f462f976acc812245e6702358ed7db226998ecf0c815aa01aea28c831fd7c29/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f73736f7669742f54696b546f6b2d4150492d5048502f4372656174652532305461673f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/5f462f976acc812245e6702358ed7db226998ecf0c815aa01aea28c831fd7c29/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f73736f7669742f54696b546f6b2d4150492d5048502f4372656174652532305461673f7374796c653d666f722d7468652d6261646765) [![GitHub license](https://camo.githubusercontent.com/f1e162d966203bc8b3c0a4a9ff8e51ee07c69ef5c0c9909197e1a25dcea40f70/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f73736f7669742f54696b546f6b2d4150492d5048503f7374796c653d666f722d7468652d6261646765)](https://github.com/ssovit/TikTok-API-PHP/blob/master/LICENSE) [![Discord](https://camo.githubusercontent.com/54436dc3ca2184fa5d3c1fe7ba5113aa2c7b9805cb585115ec632a0c34e386ee/68747470733a2f2f696d672e736869656c64732e696f2f646973636f72642f3832303835363035353933363138383435363f636f6c6f723d253233373238396461266c6162656c3d444953434f5244267374796c653d666f722d7468652d6261646765)](https://discord.gg/rSQd2QAXA8)

Unofficial TikTok API for PHP

Installation via Composer
=========================

[](#installation-via-composer)

`composer require ssovit/tiktok-api`

[![Discord](https://camo.githubusercontent.com/266993291a6da0ecf3f111d29b4633b393f24ba6f1211675a67b080a86beef7a/68747470733a2f2f646973636f72646170702e636f6d2f6173736574732f65343932333539346536393461323135343261343839343731656366666135302e737667)](https://discord.gg/rSQd2QAXA8)

Try my Telegram Bot
===================

[](#try-my-telegram-bot)

[Try my Telegram Bot](http://t.me/ssovitTikTokBot) to get non-watermarked video for any TikTok video

Want to support?
================

[](#want-to-support)

BTC: 1KA78sxnqEYPdni4txdieGJzVkH8AEn9dy ETH: 0x85110345abc62327d3c4cf657b7aabf8628d373c [![Buy Me A Coffee](https://camo.githubusercontent.com/b042e6e654016e6ea7a0702b29d0767dd9edf4d755ee8f6979c5139673118b22/68747470733a2f2f63646e2e6275796d6561636f666665652e636f6d2f627574746f6e732f76322f64656661756c742d626c75652e706e67)](https://www.buymeacoffee.com/ssovit)

Looking for Watermark-less video API?
=====================================

[](#looking-for-watermark-less-video-api)

It's available on monthly subscription. See below for plans and contact details.

Usage
=====

[](#usage)

Follow examples in `/example` directory

```
$api=new \Sovit\TikTok\Api(array(/* config array*/));

$trendingFeed=$api->getTrendingFeed($maxCursor=0);

$userData=$api->getUser("tiktok");

$userFeed=$api->getUserFeed("tiktok",$maxCursor=0);

$challenge=$api->getChallenge("foryourpage");

$challengeFeed=$api->getChallengeFeed("foryourpage",$maxCursor=0);

$musc=$api->getMusic("6798898508385585925");

$musicFeed=$api->getMusicFeed("6798898508385585925",$maxCursor=0);

$videoData=$api->getVideoByID("6829540826570296577");

$videoData=$api->getVideoByUrl("https://www.tiktok.com/@zachking/video/6829303572832750853");

$noWatermark=$api->getNoWatermark("https://www.tiktok.com/@zachking/video/6829303572832750853");
```

Available Options
=================

[](#available-options)

```
$api=new \Sovit\TikTok\Api(array(
	"user-agent"		=> 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36', // Valid desktop browser HTTP User Agent
	"proxy-host"		=> false,
	"proxy-port"		=> false,
	"proxy-username"	=> false,
	"proxy-password"	=> false,
	"cache-timeout"		=> 3600 // 1 hours cache timeout
	"cookie_file"		=> sys_get_temp_dir() . 'tiktok.txt', // cookie file path
	"nwm_endpoint"		=> "https://my-api.example.com" // private api endpoint
	"api_key"		=> "API_KEY" // see below on how to get API key
	), $cache_engine=false);
```

Cache Engine
============

[](#cache-engine)

You can build your own engine that will store and fetch cache from your local storage to prevent frequent requests to TikTok server. This can help being banned from TikTok server for too frequent requests.

Cache engine should have callable `get` and `set` methods that the API class uses

```
// Example using WordPress transient as cache engine
Class MyCacheEngine{
	function get($cache_key){
		return get_transient($cache_key);
	}
	function set($cache_key,$data,$timeout=3600){
		return set_transient($cache_key,$data,$timeout);
	}
}
```

**Usage**

```
$cache_engine=new MyCacheEngine();
$api=new \Sovit\TikTok\Api(array(/* config array*/),$cache_engine);
```

Stream and Download videos
==========================

[](#stream-and-download-videos)

Follow examples on `/example` folder for video stream and download example Note: TikTok videos will not play directly when used in HTML video player as they require `www.tiktok.com` as http referrer.

Proxy Support
=============

[](#proxy-support)

To use proxy, provide `proxy-host`, `proxy-port`, `proxy-username`, `proxy-password`It's highly recommended that you use proxy to prevent your IP from getting banned.

It's highly recommended to use `Rotating` Proxy service if you are making lots of requests in short interval of time. [Webshare.io Proxy Service](https://www.webshare.io/?referral_code=kv04mj5v4ubw) is good. *It's my referral link and I would get a bit from it*

Available methods
=================

[](#available-methods)

- `getTrendingFeed` - Get trending feed `getTrendingFeed($maxCursor)`
- `getUser` - Get profile data for TikTok User `getUser($username)`
- `getUserFeed` - Get user feed by ID `getUserFeed($user_id,$maxCursor)`
- `getUserFeedByName` - Get user feed by Name `getUserFeedByName($username,$maxCursor)`
- `getChallenge` - Get challenge/hashtag info `getChallenge($challenge)`
- `getChallengeFeed` - Get challenge feed by ID `getChallengeFeed($challenge_id, $maxCursor)`
- `getChallengeFeedByName` - Get challenge feed by name `getChallengeFeedByName($challenge,$maxCursor)`
- `getMusic` - Get music info `getMusic($music_id)`
- `getMusicFeed` - Get music feed `getMusicFeed($music_id,$maxCursor)`
- `getVideoByID` - Get video by ID `getVideoByID($video_id)`
- `getVideoByUrl` - Get video by URL `getVideoByUrl($video_url)`
- `getNoWatermark` - Get no watermark for video by URL `getNoWatermark($video_url)` *(only works for videos before 28th July 2020). Private API server availbale on subscription that works for all TikTok posts*

`$maxCursor` defaults to `0`, and is offset for results page. `maxCursor` for next page is exposed on current page call feed data.

To-Do
=====

[](#to-do)

- **Save the Universe**
- SOCKS proxy support
- Multiple proxy support (taking turns in round-robin. Act as rotating proxy)

Non-watermarked video url for newer videos
==========================================

[](#non-watermarked-video-url-for-newer-videos)

TikTok videos don't have video id as meta data on watermarked video posted after ~24-28 July 2020. Check below for subscription plans for non watermarked video API.

Pirvate API server subscription pricing
---------------------------------------

[](#pirvate-api-server-subscription-pricing)

PackageCost(per month)Quota(requests per day)Quota (requests per month)**Basic**20 USD2,000~60,000**Pro** *(popular)*50 USD5,000~150,000**Mega**100 USD12,000~360,000**Ultra**custom pricing??Looking for api source code?
----------------------------

[](#looking-for-api-source-code)

Source code for TikTok Mobile App API available.

**Available variations**

- PHP *(standalone version with no external dependency)*
- NodeJs *(standalone version with no external dependency)*

Contact
=======

[](#contact)

- Telegram
- WhatsApp
- Discord
- Email

Empty results?
==============

[](#empty-results)

Use proxy. You are making too many API requests in short interval of time. Rotating proxy is recommended.

Want to improve this library? Want to contribute?
=================================================

[](#want-to-improve-this-library-want-to-contribute)

Don't hesitate to create pull requests.

Disclaimer
==========

[](#disclaimer)

TikTok is always updating their API endpoints but I will try to keep this library whenever possible. I take no responsibility if you or your IP gets banned using this API. It's recommended that you use proxy.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 88.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~9 days

Recently: every ~17 days

Total

29

Last Release

1784d ago

Major Versions

1.3.3 → 2.0.02021-05-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/715af3c0f65297f512c0041f89b75c56aeaae43541e2ac26694cc1923925647d?d=identicon)[Danil005](/maintainers/Danil005)

---

Top Contributors

[![ssovit](https://avatars.githubusercontent.com/u/3162122?v=4)](https://github.com/ssovit "ssovit (55 commits)")[![Danil005](https://avatars.githubusercontent.com/u/26440814?v=4)](https://github.com/Danil005 "Danil005 (4 commits)")[![sesanzb](https://avatars.githubusercontent.com/u/39120029?v=4)](https://github.com/sesanzb "sesanzb (3 commits)")

---

Tags

TikTok tiktok apitiktok-scraper

### Embed Badge

![Health badge](/badges/flowtok-tiktok-api/health.svg)

```
[![Health](https://phpackages.com/badges/flowtok-tiktok-api/health.svg)](https://phpackages.com/packages/flowtok-tiktok-api)
```

###  Alternatives

[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[ssovit/tiktok-api

Unofficial TikTok API for PHP

15035.9k](/packages/ssovit-tiktok-api)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[google/common-protos

Google API Common Protos for PHP

173103.7M49](/packages/google-common-protos)[hubspot/api-client

Hubspot API client

23414.2M16](/packages/hubspot-api-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
