Skip to Content

Documentation

Quickstart

Read your first profile and a page of its posts in four steps.

When you finish this page, you have read a TikTok profile and a page of its posts. It takes an API key and three API calls, and the first one is free.

Create an API Key

Sign up at app.socialapi.sh. Your workspace starts with 100 free credits and a key named "Default". Copy it from Overview, or create one under API Keys. It is shown only once.

export SOCIALAPI_API_KEY="sapi_YOUR_KEY"

Every sample in these docs reads the key from SOCIALAPI_API_KEY. See Authentication for headers and limits.

Install an SDK

npm install @socialapihq/sdk

Prefer plain HTTP? Skip this step. Every sample has a cURL tab, and the base URL is https://api.socialapi.sh.

Check Your Credits

Reading your balance with GET /v1/credits is free and shows that the key works.

import { SocialAPI } from "@socialapihq/sdk";

const client = new SocialAPI({ apiKey: process.env.SOCIALAPI_API_KEY });

const answer = await client.account.getCredits();
Response
{
  "balance": 319668
}

Read a Profile

import { SocialAPI } from "@socialapihq/sdk";

const client = new SocialAPI({ apiKey: process.env.SOCIALAPI_API_KEY });

const { data } = await client.tiktok.profile({ handle: "nike" });
Response
{
  "data": {
    "id": "208464585232822272",
    "username": "nike",
    "displayName": "Nike",
    "bio": "Just Do It.",
    "avatarUrl": "https://p16-common-sign.tiktokcdn.com/tos-maliva-avt-0068/e0b0ac7b6ad6447a8e923fd1eb162f2c~tplv-tiktokx-cropcenter:1080:1080.jpeg?dr=14579&refresh_token=c73b1f8a&x-expires=1795730400&x-signature=WFCAToitWtbkgo5qXRwrQmcX%2FZY%3D&t=4d5b0474&ps=13740610&shp=a5d48078&shcp=81f88b70&idc=my",
    "url": "https://www.tiktok.com/@nike",
    "verified": true,
    "private": false,
    "followers": 9440793,
    "following": 94,
    "likes": 51312842,
    "posts": 1131,
    "externalUrl": "http://empli.fi/niketiktok",
    "createdAt": null,
    "ext": {
      "secUid": "MS4wLjABAAAA_3ndMt8d_tECTdpKgCxcx238tOnQZX-20wqN01aMui5zQ7hsqSdff-jC5qYC-Cl_",
      "friends": 47,
      "liked": 0,
      "category": "Sports, Fitness & Outdoors",
      "seller": false,
      "likesPublic": false,
      "roomId": null
    }
  }
}

This costs 1 credit. The X-Credits-Charged and X-Credits-Remaining headers say so. The same request within 15 minutes is answered from the cache for free.

Read Its Posts

import { SocialAPI } from "@socialapihq/sdk";

const client = new SocialAPI({ apiKey: process.env.SOCIALAPI_API_KEY });

const { data, pagination } = await client.tiktok.profilePosts({ handle: "nike" });
Response
{
  "data": [
    {
      "id": "7711465226318728461",
      "url": "https://www.tiktok.com/@nike/video/7711465226318728461",
      "text": "Vroom vroom 🏎️💨 #Formula1 #LasVegasGP #NSW #Nike Feat. @Miku Martineau @lizzy greene @Nick @Caleb McLaughlin @Sabrina Ionescu @Brianna LaPaglia",
      "createdAt": "2026-11-23T20:24:10.000Z",
      "author": {
        "id": "208464585232822272",
        "username": "nike",
        "displayName": "Nike",
        "avatarUrl": "https://p16-common-sign.tiktokcdn.com/tos-maliva-avt-0068/e0b0ac7b6ad6447a8e923fd1eb162f2c~tplv-tiktokx-cropcenter:1080:1080.jpeg?dr=14579&refresh_token=c73b1f8a&x-expires=1795730400&x-signature=WFCAToitWtbkgo5qXRwrQmcX%2FZY%3D&t=4d5b0474&ps=13740610&shp=a5d48078&shcp=81f88b70&idc=my",
        "verified": true,
        "url": "https://www.tiktok.com/@nike"
      },
      "stats": {
        "views": 18200,
        "likes": 309,
        "comments": 14,
        "shares": 5,
        "saves": 17,
        "engagementRate": 0.018
      },
      "media": [
        {
          "kind": "video",
          "url": "https://v16-webapp-prime.tiktok.com/video/tos/alisg/tos-alisg-ve-37c799-sg/o0kDDPDSFCeIBoEwTRQMABOEM1SIESQfgrKdjE/?a=1988&bti=ODszNWYuMDE6&&bt=1397&ft=I~da4oJwD12Nvkkb3lIxR4bNLlBF-UjNSbopiX&mime_type=video_mp4&rc=ZzppN2U1OzY2PGVnN2c0Z0BpM3g3NnQ5cmxkZjMzZzczNEAtMC0tXjZeNmIxNmMyLi4tYSMzYmlnMmQ0Li9hLS1kMS9zcw%3D%3D&expire=1795731854&l=20261125062401F5D7C61FE8069925FC37&ply_type=2&policy=2&signature=f40036e4d779d55738cdeebc4d92928f&tk=tt_chain_token&btag=e000b0000",
          "thumbnailUrl": "https://p16-common-sign.tiktokcdn.com/tos-useast5-p-0068-tx/oMeIeALC2IGwPxAAHOAAe3IEWJQ6jbPHkAcUQE~tplv-tiktokx-origin.image?dr=14575&x-expires=1795730400&x-signature=fWhitTvuuSB%2FxWl2xEN2vB%2BBXsQ%3D&t=4d5b0474&ps=13740610&shp=81f88b70&shcp=43f4a2f9&idc=my",
          "width": 720,
          "height": 1280,
          "durationSeconds": 13
        }
      ],
      "hashtags": [
        "Formula1",
        "LasVegasGP",
        "NSW"
      ],
      "mentions": [
        "Miku",
        "lizzy",
        "Nick"
      ],
      "ext": {
        "authorSecUid": "MS4wLjABAAAA_3ndMt8d_tECTdpKgCxcx238tOnQZX-20wqN01aMui5zQ7hsqSdff-jC5qYC-Cl_",
        "sound": {
          "id": "7711465298314021645",
          "title": "original sound",
          "artist": "Nike",
          "original": true
        },
        "durationSeconds": 13,
        "reposts": null,
        "pinned": false,
        "ad": false,
        "playlistId": null,
        "region": null,
        "language": "nl",
        "screenText": [],
        "subtitles": []
      }
    },
    {
      "id": "7711414040114892045",
      "url": "https://www.tiktok.com/@nike/video/7711414040114892045",
      "text": "Mode push or box box? Nike family answering the big questions from Vegas.  #Formula1 #LasVegasGP #NSW #Nike Feat. @Miku Martineau @lizzy greene @Nick @noah beck @Caleb McLaughlin @Sabrina Ionescu @Brianna LaPaglia",
      "createdAt": "2026-11-23T17:05:31.000Z",
      "author": {
        "id": "208464585232822272",
        "username": "nike",
        "displayName": "Nike",
        "avatarUrl": "https://p16-common-sign.tiktokcdn.com/tos-maliva-avt-0068/e0b0ac7b6ad6447a8e923fd1eb162f2c~tplv-tiktokx-cropcenter:1080:1080.jpeg?dr=14579&refresh_token=c73b1f8a&x-expires=1795730400&x-signature=WFCAToitWtbkgo5qXRwrQmcX%2FZY%3D&t=4d5b0474&ps=13740610&shp=a5d48078&shcp=81f88b70&idc=my",
        "verified": true,
        "url": "https://www.tiktok.com/@nike"
      },
      "stats": {
        "views": 9265,
        "likes": 351,
        "comments": 13,
        "shares": 8,
        "saves": 20,
        "engagementRate": 0.0402
      },
      "media": [
        {
          "kind": "video",
          "url": "https://v16-webapp-prime.tiktok.com/video/tos/alisg/tos-alisg-ve-37c799-sg/oQIPUULoFBxwE9yAiE4Q90acBEILZgKUHijAR/?a=1988&bti=ODszNWYuMDE6&&bt=1427&ft=I~da4oJwD12Nvkkb3lIxR4bNLlBF-UjNSbopiX&mime_type=video_mp4&rc=aGVnaGUzNzY1ZDM0NzU1M0Bpanc4OW45cjs6ZjMzZzczNEA2LzUwYWJjXzQxMDM1NDMvYSMyNmIyMmQ0MS9hLS1kMS9zcw%3D%3D&expire=1795731907&l=20261125062401F5D7C61FE8069925FC37&ply_type=2&policy=2&signature=8053e4971cbbbdafac72141b14d41c57&tk=tt_chain_token&btag=e00090000",
          "thumbnailUrl": "https://p16-common-sign.tiktokcdn.com/tos-useast5-p-0068-tx/okaWE1EB4PAEDiwgAIcARB6AaAEjylyhnikDI~tplv-tiktokx-origin.image?dr=14575&x-expires=1795730400&x-signature=ysNydei3newlYGkacpZQIzqSmV8%3D&t=4d5b0474&ps=13740610&shp=81f88b70&shcp=43f4a2f9&idc=my",
          "width": 720,
          "height": 1280,
          "durationSeconds": 66
        }
      ],
      "hashtags": [
        "Formula1",
        "LasVegasGP",
        "NSW"
      ],
      "mentions": [
        "Miku",
        "lizzy",
        "Nick"
      ],
      "ext": {
        "authorSecUid": "MS4wLjABAAAA_3ndMt8d_tECTdpKgCxcx238tOnQZX-20wqN01aMui5zQ7hsqSdff-jC5qYC-Cl_",
        "sound": {
          "id": "7711414149750459167",
          "title": "original sound",
          "artist": "Nike",
          "original": true
        },
        "durationSeconds": 66,
        "reposts": null,
        "pinned": false,
        "ad": false,
        "playlistId": null,
        "region": null,
        "language": "en",
        "screenText": [],
        "subtitles": [
          {
            "language": "eng-US",
            "format": "webvtt",
            "source": "ASR"
          }
        ]
      }
    }
  ],
  "pagination": {
    "nextCursor": "1792764276701",
    "hasMore": true
  }
}

You get a page of posts in data, newest first. While pagination.hasMore is true, pass pagination.nextCursor as cursor to read the next page. See Pagination.

If It Fails

A first call that fails usually fails for one of these reasons.

What you seeCauseFix
401 UNAUTHENTICATEDThe key is missing, revoked or expiredSend the full key
400 INVALID_REQUESTA parameter is missing or wrong, named in paramFix it
404 NOT_FOUNDNo account has this handleCheck the handle
403 PRIVATEThe account or the list is privateNothing to read
402 INSUFFICIENT_CREDITSThe balance is too lowBuy credits on the Credits page
502 UPSTREAM_UNAVAILABLEThe platform did not answerTry again shortly

None of these costs credits. Send support the X-Request-Id. All codes are in Errors.

Next Steps