Skip to content

mf336/tiktok-mpp-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎵 TikTok MPP API

A pay-per-request TikTok scraper API powered by the Machine Payments Protocol (MPP) and Apify.

AI agents and clients pay in Tempo/PathUSD stablecoins on each request — no subscriptions, no API keys.


Endpoints

Endpoint Price Description
GET /health Free Service info & endpoint list
GET /api/tiktok/user $0.05 Scrape user profile + recent videos
GET /api/tiktok/hashtag $0.10 Scrape posts under a hashtag
GET /api/tiktok/video $0.02 Single video metadata
GET /api/tiktok/search $0.05 Search TikTok by keyword

Query params

# User scrape
GET /api/tiktok/user?handle=@charlidamelio&limit=10

# Hashtag scrape
GET /api/tiktok/hashtag?tag=fyp&limit=20

# Single video
GET /api/tiktok/video?url=https://www.tiktok.com/@user/video/123456789

# Search
GET /api/tiktok/search?q=funny+cats&limit=10

How MPP works

  1. Client makes a normal HTTP request
  2. Server responds with 402 Payment Required + payment instructions
  3. Client pays with Tempo/PathUSD (stablecoin)
  4. Client retries with Authorization header containing payment proof
  5. Server verifies payment → returns TikTok data + receipt

Setup

1. Install deps

bun install

2. Configure environment

cp .env.example .env

Edit .env:

APIFY_TOKEN=apify_api_your_token_here
RECIPIENT_ADDRESS=0xYourWalletAddress
PORT=3000
  • APIFY_TOKEN — get at apify.com
  • RECIPIENT_ADDRESS — your EVM wallet address for receiving payments

3. Run

# Development (hot reload)
bun run dev

# Production
bun run start

Tech stack

Layer Tool
Runtime Bun
Framework Hono
Payments mppx — MPP TypeScript SDK
Stablecoin Tempo PathUSD (testnet → Base mainnet)
Scraper Apify TikTok Scraper

Going to mainnet

In src/index.ts, update:

testnet: false,

And update RECIPIENT_ADDRESS in .env to your mainnet wallet.


License

MIT

About

TikTok scraper API powered by Machine Payments Protocol (MPP)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors