Tokfluence
Tokfluence
API Docs
Concepts

Errors

Error envelope

Every error response, regardless of status code, follows the same JSON shape:

json
{
  "error": {
    "code": "insufficient_credits",
    "message": "Out of API credits. Top up or wait for the next refill cycle."
  }
}

The code field is stable and machine-readable; switch on it. The message field is human-friendly and may evolve.

Status codes

ParamTypeNotes
401unauthorizedBearer token missing, malformed, or revoked.
402insufficient_creditsWallet is empty. Wait for the monthly refill or top up.
403plan_requiredAccount is signed in but not on the Developer plan.
403account_bannedAccount is suspended. Contact support.
403forbiddenAuthenticated, but not allowed to touch this resource (e.g. someone else's campaign).
404*_not_foundcreator_not_found, post_not_found, campaign_not_found.
409duplicate_requestThe request id was already processed. Retries are idempotent.
422missing_parameterA required body or query parameter was omitted.
422invalid_campaignCampaign create payload failed validation.
429rate_limitedThrottled. Honor the Retry-After header.
502upstream_errorTikTok analysis pipeline is unreachable. Credits are refunded automatically.
500internal_errorSomething on our end. Sentry has it; ping us if it persists.

Retrying safely

All endpoints accept a request_id derived from the HTTP X-Request-Id header (or generated if absent). Repeating the same request id yields 409 duplicate_request and does not double-charge or double-act. This makes naive retries safe.

Recommendation
For batch POST /v1/posts/analyze calls, generate one stable UUID per logical batch and pass it as X-Request-Id. Network blips become free retries instead of accidental double-charges.