Using the API

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\"? handle takes a username or a profile link. This endpoint accepts: handle, max_age, fields.",
    "request_id": "req_3f9c2a7d1e8b4c6a9f0e2d4b6a8c0e1f",
    "status": 400,
    "retryable": false,
    "param": "username",
    "remediation": "Fix the parameter named in param as the message says. For a link of the wrong kind, call an endpoint listed in details.endpoints, when there is one.",
    "doc_url": "https://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_input400NoA parameter is missing or malformed, or the link is not one this endpoint takes.Fix the parameter named in param as the message says. For a link of the wrong kind, call an endpoint listed in details.endpoints, when there is one.
  • 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.
  • resolved_url string: For a link of the wrong kind that only points elsewhere (a share link, an embedded player): the link it leads to, which the endpoints in endpoints take.
  • fields string[]: For an unknown fields path: every path fields accepts on this endpoint.
  • reason string: For a promo code that can't be redeemed (POST /v1/billing/promo_codes/redeem): unknown, expired, used_up, already_redeemed or not_eligible. New values may be added.
invalid_cursor400NoThe cursor is malformed or expired, belongs to another endpoint, or came with other parameters than the request that returned 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, or its key is unknown or revoked. On the dashboard's routes: the session cookie is missing or expired.Send a valid API key in the x-api-key header. No key yet? A person gets one at details.signup_url; an AI agent follows details.agent_auth_url.
  • signup_url string: Where a human gets an API key (self-serve signup).
  • agent_auth_url string: What an AI agent follows to get a key for its person: they approve it in a browser, with no email to wait for.
  • agent_signup_url string: Deprecated and no longer sent: agents follow agent_auth_url.
  • reason string: Set when the key is known to be unusable: test_key_retired (a test key: test mode was retired, use a live key; every new account starts with free credits). Absent otherwise; new values may be added.
forbidden403NoThe API key is valid but may not make this request, and details.reason says why: the account is suspended, the key lacks the route's scope, waits for its owner to confirm it by email, has expired, or was used from an IP outside its allowlist, or a rotated key's previous secret was used for a call that needs the admin scope. A running job stops with it too 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, so branch on the code.Act on details.reason. suspended: contact support. scope: use a key with details.required_scope. previous_secret: use the new secret. key_pending: have the owner open the emailed link. key_expired or key_revoked: create a new key. ip_not_allowed: 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, previous_secret (a rotated key's previous secret, which works only for calls that need no admin scope until its overlap ends: use the new secret), csrf (a dashboard request from another site), dashboard_key (the account's built-in dashboard key: only its spend limit can be changed), account_deleted (the account is being deleted, or was), owner_only (only the account's owner may do this), role (the person's role on the account is below details.required_role) not_a_member (x-account-id names an account the person isn't on), setup_required (the dashboard account is not set up yet) or reauthentication_required (a dashboard change that needs a recent sign-in). New values may be added.
  • required_scope string: For reason scope: the scope the route needs (endpoints, jobs, account:read or admin).
  • required_role string: For reason role: the least role the route needs in the account (owner, admin or member).
insufficient_credits402NoThe account does not have enough credits for this request.Have a person buy credits at details.purchase_url (or make them a checkout link with details.checkout), 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 this 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 passed its runaway-protection ceiling: a high per-account limit that stops a broken client loop (plans have no rate limit). Requests without an API key (signup, the MCP server's tool listing and find_endpoint) are limited per IP address instead. It also stops an account whose failed requests in the last hour cost far more than its successful ones paid for: failures are free within a limit (the message says so), and successes raise it.Wait the seconds in the retry-after header, then retry. If your steady traffic needs more, ask support to raise the ceiling; without an API key, send one.
  • retry_after integer: Seconds to wait before retrying; equals the retry-after header.
request_too_large413NoThe request body is larger than the API accepts.Send a smaller body, or split a large job into several.—
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 endpoint in 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_reused422NoThis Idempotency-Key was already used for a different request (another route or body). Or it was used for this same request, which ran and returned a secret we no longer keep (details.reason answer_expired): running it again would create another.Use a new Idempotency-Key for a different request, and reuse a key only to retry the identical request. With reason answer_expired, check what the first request created (GET /v1/api_keys, GET /v1/webhook_endpoints) before sending it again under a new key.
  • reason string: answer_expired when the request ran and its answer is gone; absent otherwise.
idempotency_key_in_progress409Yes, laterA request with this Idempotency-Key is still running.Retry after the 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_found404NoThe account has no job with this ID: the ID is wrong, or the job is 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, an endpoint this platform does not have yet, or a path outside the API. Nothing was fetched or charged.Call details.suggestion when it is set (the path you most likely meant), or pick one from 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. On GET /v1/requests/{id}/response: the response was not kept (details.reason says why).Check the link or ID. Do not retry.
  • reason string: Why a request's response was not kept (GET /v1/requests/{id}/response): off, expired or not_stored. New values may be added.
private_or_unavailable403NoThe item exists but is not public: it is private, age- or region-restricted, or needs a login to view. It shares 403 with forbidden (which is about the key), so branch on the code.Only public items can be fetched. Do not retry.—
no_transcript404NoThe video or audio exists but has no transcript: no caption track and no speech to transcribe.Do not retry. If the platform offers other languages, try one with lang.—
no_live404NoThe account exists but has no live broadcast to show: nothing on air or scheduled, and no past broadcast the platform still shows.Do not retry now. Ask again later, when the account may be live.—
no_media404NoThe post exists but has no file to download: a text or link post, or one whose media the platform does not serve logged out.Do not retry. Fetch the post itself for its text and links.—
upstream_blocked503Yes, laterThe platform refused every attempt, our own retries included.Retry later with backoff. Failed requests are free.—
upstream_error502Yes, laterThe platform failed, or answered with something we could not read.Retry with backoff. Failed requests are free.—
overloaded503Yes, laterSocialTap was at capacity, or paused by its operators, and did not start the request. Nothing was fetched or charged.Retry after the seconds in the retry-after header. Failed requests are free.
  • retry_after integer: Seconds to wait before retrying; equals the retry-after header.
internal500Yes, laterAn unexpected error on SocialTap's side.Retry with backoff. If it keeps happening, contact support with the request_id.—

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