Using the API

Errors

Every error code, its HTTP status, whether a later retry can succeed, and what to do about it.

Errors return a non-2xx status and a JSON body with one error object. Everything a program or an agent needs to react is in the body, so a client that only sees the JSON can still decide what to do:

400 response
{
  "error": {
    "code": "invalid_input",
    "message": "unknown parameter \"username\"; did you mean \"handle\"? This endpoint accepts: handle, max_age, fields.",
    "request_id": "req_3f9c2a7d1e8b4c6a9f0e2d4b6a8c0e1f",
    "status": 400,
    "retryable": false,
    "param": "username",
    "remediation": "Fix the parameter named in param (the message says how); for a link of the wrong kind, call the endpoint the message names.",
    "doc_url": "https://staging-fly.socialtap.dev/docs/errors/#invalid_input",
    "details": {
      "accepted_params": [
        "handle",
        "max_age",
        "fields"
      ],
      "suggestion": "handle"
    },
    "charged": false
  }
}

Every field is always present:

FieldTypeDescription
error.codestringMachine-readable error code (see the error codes list); stable.
error.messagestringWhat went wrong and how to fix it, for humans and agents; wording may change.
error.request_idstringUnique request ID; include it when contacting support.
error.statusintegerThe HTTP status of the response, repeated for clients that only see the body.
error.retryablebooleanTrue when repeating the same request later may succeed (after details.retry_after when present).
error.paramstring or nullThe query parameter or header the error is about; null when it is not about one input.
error.remediationstringWhat to do about this code, one sentence.
error.doc_urlstringURL of this code's documentation.
error.detailsobjectThe code's dynamic values (the error codes list documents each code's keys); {} when none.
error.chargedbooleanWhether the request was charged: always false, failed requests are free.
  • error.param names the query parameter or header the error is about, so you can fix the call without parsing the message.
  • error.details holds the code's dynamic values: the parameter you most likely meant, the endpoint a link belongs to, the credits a request needed. The table below lists each code's keys. Keys are only ever added.
  • error.charged is always false: failed requests are free (see Credits), so a retry costs nothing.

Error codes

Retry says whether sending the same request again later can get a different answer. What to do is the recommended reaction. Codes marked Reserved are documented ahead of the feature that returns them; nothing returns them yet.

CodeHTTPRetryMeaningWhat to dodetails
invalid_input400NoThe request parameters are missing or malformed, or the URL is not a supported link for this endpoint.Fix the parameter named in param (the message says how); for a link of the wrong kind, call the endpoint the message names.
  • suggestion string: For an unknown parameter: the accepted parameter it most likely means; absent when nothing is close.
  • accepted_params string[]: For an unknown parameter: every query parameter this endpoint accepts.
  • url_kind string: For a link of the wrong kind: what the link points to (profile, video, post, …).
  • url_platform string: For a link of the wrong kind: the platform the link belongs to.
  • accepted_url_kinds string[]: For a link of the wrong kind: the kinds of link this endpoint takes.
  • endpoints string[]: For a link of the wrong kind: IDs of the endpoints that take it; empty when none does yet.
  • fields string[]: For an unknown fields path: every path fields accepts on this endpoint.
invalid_cursor400NoThe cursor is malformed, expired, belongs to another endpoint, or the other parameters differ from the request that issued it.Repeat the original request without cursor to start the list again.
  • reason string: Why: malformed, expired, wrong_endpoint, params_changed or pin_lost (the upstream exit a cursor-bound list was pinned to is gone; new values may be added).
unauthorized401NoThe x-api-key header is missing, unknown or revoked (or, on the dashboard's routes, the session cookie is missing or expired).Send a valid API key in the x-api-key header; without one, get a key at details.signup_url (AI agents: POST details.agent_signup_url).
  • signup_url string: Where a human gets an API key (self-serve signup).
  • agent_signup_url string: POST an email address here to get a test key at once and a live key once the human confirms.
forbidden403NoThe API key is valid but may not make this request: its account is suspended, its scopes do not include the route, it is waiting for its owner's email confirmation, it is past its expiry, or the request came from an IP its allowlist does not include. A running job stops the same way when its account is suspended or the key that created it is revoked or expires. It is about the key, never the item (a private item is private_or_unavailable, also 403): branch on the code.Do what details.reason says: if suspended, contact support; otherwise use a key whose scopes cover the route (details.required_scope), have the owner confirm the emailed link, create a new key, or call from an allowed IP.
  • reason string: Why: suspended (an operator suspended the account), scope (the key lacks details.required_scope), key_pending (an agent signup's live key before its owner confirms), key_expired, key_revoked (a job's creating key was revoked while it ran), ip_not_allowed, test_mode (a test key asked for something live, such as a live key) or csrf (a dashboard request from another site). New values may be added.
  • required_scope string: For reason scope: the scope the route needs (endpoints, jobs, account:read or admin).
insufficient_credits402NoThe account does not have enough credits for this request.Buy credits (a human pays: details.purchase_url, or details.checkout makes a checkout link), then repeat the request; do not retry automatically.
  • credits_required integer: Credits this request needed at the point it stopped (to start, or to finish a longer item).
  • credits_available integer: Credits the account could spend at that moment (in-flight requests hold part of the balance).
  • max_credits integer: For a job's item: the job's max_credits, when that cap (not the balance) stopped the item.
  • purchase_url string: Where a human buys credits (the dashboard); absent when a job's max_credits, not the balance, stopped it.
  • checkout object: The API call that makes a checkout link for a human to pay: {method, path (an absolute URL), packs (the pack IDs its body's pack takes)}.
spend_limit_reached402NoThe API key reached its spend limit for the current period; the account may still have credits.Wait until details.resets_at or raise the key's spend limit (PATCH /v1/api_keys/{id}); do not retry automatically.
  • api_key_id string: The key whose limit was reached.
  • spend_limit integer: The limit: most credits the key may spend per interval.
  • interval string: day or month (UTC calendar).
  • used integer: Credits the key spent this interval, plus what its requests in flight hold.
  • credits_required integer: Credits this request needed.
  • resets_at string: When the interval ends and the limit is free again, RFC 3339 UTC.
rate_limited429Yes, laterThe account exceeded its runaway-protection ceiling: plans do not limit request rate, but a high per-account safety ceiling stops broken client loops. Support raises it on request. Without an API key (signup, the MCP server's tool listing and find_endpoint), requests are limited per IP address instead.Wait for the number of seconds in the retry-after header, then retry; ask support to raise the ceiling if your sustained traffic needs more (calls without an API key: use one).
  • retry_after integer: Seconds to wait before retrying; equals the retry-after header.
method_not_allowed405NoThe endpoint exists but does not accept this HTTP method.Use the method in the allow header (GET for every data endpoint).—
endpoint_retired410NoThe endpoint passed its sunset date and no longer answers.Call the replacement endpoint (details.replacement); the changelog describes the migration.
  • sunset_at string: When the endpoint stopped answering, RFC 3339 UTC.
  • replacement string: ID of the endpoint to use instead; absent when there is none.
idempotency_key_reused422NoThe Idempotency-Key was already used with a different request (another route, or another body).Send a new Idempotency-Key for a different request; reuse a key only to retry the identical request.—
idempotency_key_in_progress409Yes, laterA request with this Idempotency-Key is still running.Retry after the number of seconds in the retry-after header to get that request's result.
  • retry_after integer: Seconds to wait before retrying; equals the retry-after header.
job_not_found404NoNo job with this ID exists for the account: unknown, or past its retention.Check the job ID; finished jobs are kept for a limited time.—
unknown_endpoint404NoNo endpoint or route has this path: a typo, a platform that does not have this endpoint yet, or a path that is not part of the API. Nothing was fetched or charged.Call the path in details.suggestion when it is set (it is the one the path most likely means), or pick one of details.endpoints; do not retry the same path.
  • suggestion string: The endpoint path this one most likely means; absent when nothing is close.
  • endpoints string[]: Every public data endpoint's path.
not_found404NoThe item does not exist or was deleted.Check the URL or ID; do not retry.—
private_or_unavailable403NoThe item exists but is private, age- or region-gated, or requires a login to view. It shares 403 with forbidden (which is about the key): branch on the code.Only public items can be fetched; do not retry.—
no_transcript404NoThe media exists but has no transcript: no caption track and no speech to transcribe.Do not retry; try another language with lang if the platform offers one.—
upstream_blocked503Yes, laterThe platform refused every attempt.Retry later with backoff; failed requests are free.—
upstream_error502Yes, laterThe platform failed or returned something unexpected.Retry with backoff; failed requests are free.—
overloaded503Yes, laterSocialTap was momentarily at capacity and did not start the request: nothing was fetched or charged.Retry after the number of seconds in the retry-after header; failed requests are free.
  • retry_after integer: Seconds to wait before retrying; equals the retry-after header.
internal500Yes, laterUnexpected SocialTap error.Retry with backoff; contact support with the request_id if it persists.—

Retrying

  • Retry: yes. Retry with exponential backoff and a cap on attempts. For rate_limited, wait at least the number of seconds in the retry-after header (also in error.details) first, then retry. It is not a plan limit but the per-account safety ceiling against runaway clients (see Rate limits).
  • Retry: no. The code describes your request or the item, and the same request gets the same answer on every attempt: fix the input, top up your balance, or treat the item as unavailable, as the table says.
  • retry-after is only ever sent with codes you may retry. Credit errors such as insufficient_credits never carry it: buy credits, then repeat the request.

Last updated