API Reference

Channels

TikTok authorization

TikTok supports QR login and Cookie import with auth_mode=session; choose the mode when creating the account.

Choose an authorization method

qrcode

TikTok QR authorization uses the standard account and QR endpoints; the first start response may not contain a QR URL.

  1. 1. POST /v1/accounts with provider=tiktok and auth_mode=qrcode.
  2. 2. POST /v1/accounts/{account_id}/auth/qr/start to start the TikTok browser session.
  3. 3. Listen for account.auth.required or poll POST /v1/accounts/{account_id}/auth/qr/check until QR material or the authorization result is available.
  4. 4. After account.auth.succeeded, confirm runtime_status and start the runtime only if it is not already running.

session

TikTok supports QR login and Cookie import with auth_mode=session; choose the mode when creating the account.

  1. 1. Create an account with provider=tiktok and auth_mode=session in a region with available capacity. For a wallet account, wait for its CREATE operation to reach SUCCEEDED before authorization.
  2. 2. POST /v1/accounts/{account_id}/auth/session with tiktok.cookies. Each cookie requires name, value, domain and path. Use 1–128 cookies and keep the full JSON within 65536 bytes; tiktok must be the only top-level field.
  3. 3. Import starts login. pending means wait: query GET /v1/accounts/{account_id}/auth or POST /v1/accounts/{account_id}/runtime/refresh until authorized and running before business requests. HTTP 200 or valid Cookie format alone does not prove success.

Verify the signature

TikTok · session

curl -X POST "https://api.unifyport.ai/v1/accounts/{account_id}/auth/session" \
  -H "X-Api-Key: <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
  "tiktok": {
    "cookies": [{ "name": "sessionid", "value": "<COOKIE_VALUE>", "domain": ".tiktok.com", "path": "/" }]
  }
}'

Notes

  • The initial qr/start response may omit the QR URL. Keep the webhook registered and use qr/check as the polling fallback.
  • QR and session modes cannot be switched in place. session mode cannot continue QR or verification-code challenges. Import does not guarantee replacement of an existing login; user_id is optional compatibility data, not identity proof.
  • Current source mapping emits message.received only for private conversations. Group, acknowledgement, notice, and comment events are not public standard events, and source support is not a real-account E2E guarantee.