Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.social-api.ai/llms.txt

Use this file to discover all available pages before exploring further.

All errors return JSON with a consistent shape:
{
  "error": {
    "code": "namespace.specific_code",
    "message": "human-readable message",
    "meta": { "field": "..." }
  },
  "request_id": "a1b2c3d4"
}
Use error.code for programmatic handling; use error.message for logging and display. Some errors include an error.meta object with structured context (for example meta.field for a validation failure, meta.plan and meta.max for billing limits). Codes are stable and namespaced with dot-separated segments, so you can match on a prefix (for example platform.* for any upstream platform failure, or byok.* for any bring-your-own-key issue). The request_id field is present on every error response. The same value appears in the X-Request-ID response header. Include it when reporting an issue to support. See Debugging with request IDs for details on how to supply your own correlation ID.

Code namespaces

The first segment of the code tells you where the failure originated.
NamespaceMeaning
auth.*Authentication and authorization at the SocialAPI layer
account.*Connected account issues (linking, state, supported features)
platform.<name>.*The upstream platform (Instagram, TikTok, etc.) returned an error
validation.*Request body, query parameter, or path parameter is invalid
resource.*Generic resource lookup, conflict, or capability error
billing.*Plan limit reached or feature gated by tier
brand.*, media.*, post.*, conversation.*, invite.*Resource-specific errors on those object types
byok.*Bring-your-own-key credentials (Twitter app, etc.)
publishing.delivery.*A platform delivery worker failed mid-publish
whatsapp.*WhatsApp Cloud API specific failures (window, frequency, template state)
system.internalUnexpected server error; safe to retry idempotent requests

Authentication

HTTPCodeWhen it occurs
401auth.missing_headerAuthorization header is absent
401auth.empty_tokenAuthorization: Bearer with no token value
401auth.invalid_keyAPI key does not match any active key
401auth.invalid_tokenBearer JWT or OAuth access token is invalid or expired
401auth.invalid_secretProvided client secret does not match
401auth.not_authenticatedCaller is unauthenticated for an endpoint that requires it
401auth.not_provisionedDashboard user has no users row yet; call POST /v1/users/provision first
401auth.user_not_foundToken resolves to a user that no longer exists
403auth.dashboard_onlyEndpoint accepts only dashboard JWTs (raw API keys are rejected)
403auth.requires_dashboard_authSame as above for endpoints behind brand-level UI
400auth.state_mismatchOAuth callback state does not match the issued value
400auth.oauth.invalid_clientOAuth 2.1 client lookup failed during MCP token exchange
400auth.oauth.invalid_redirectredirect_uri is not in the client’s whitelist
400auth.oauth.request_expiredAuthorization request expired before exchange
400auth.oauth.user_missingOAuth grant references a user that does not exist

Accounts

HTTPCodeWhen it occurs
404account.not_foundThe account ID does not belong to your workspace
409account.already_linkedThis social account is already connected to a workspace
403account.reconnection_requiredOAuth token is no longer usable; rerun the OAuth flow
400account.unsupported_platformPlatform value is not recognized
404account.no_active_pageAccount has no active Page (Facebook, LinkedIn) selected
409account.page_inactiveThe requested Page is currently disabled
501account.pages_not_supportedPages do not apply to this platform

Validation

HTTPCodeWhen it occurs
400validation.field_requiredA required field is missing from the request
400validation.field_invalidA field has the wrong type, format, or value
400validation.body_invalidRequest body could not be parsed as JSON
400validation.redirect_uri_duplicateRedirect URI is already registered for this client
The code always starts with validation.. The specific sub-code after the dot identifies the field or rule that failed; error.meta.field in the response points to the offending field name when applicable.

Resources

HTTPCodeWhen it occurs
404resource.not_foundGeneric resource lookup miss; check the error.meta.resource and error.meta.id fields
409resource.conflictResource is in a state that conflicts with the requested action
410resource.goneResource existed but was permanently removed
501resource.not_supportedOperation does not apply to this platform
404brand.not_found, media.not_found, conversation.not_found, post.not_foundSpecific lookups failed
409media.in_useCannot delete media that is still referenced by a post
410invite.expiredBrand invite token is past its expiry
400invite.invalidBrand invite token is malformed or already consumed
409post.state_invalidAction does not apply to a post in this state (e.g. retry on a published post)
400post.no_retryable_deliveriesNo failed deliveries on this post to retry

Billing and plan limits

HTTPCodeWhen it occurs
403billing.brands_limit, brand.limit_reachedBrand count would exceed your plan’s allowance
429billing.post_limitMonthly post allowance is exhausted
413billing.storage_quotaMedia upload would exceed your storage limit
403billing.platform_not_availablePlatform requires a higher plan tier
429billing.export_limitDaily export allowance is exhausted
429billing.export_concurrentToo many exports running at once for this plan
429billing.export_cooldownCooldown active between exports
Limit responses include error.meta.plan and error.meta.max so clients can prompt the user to upgrade.

Platform errors

When the upstream platform (Meta, TikTok, Google, etc.) rejects a call, the error code has the form platform.<name>.<reason>. The HTTP status is forwarded when possible; otherwise it is 502 Bad Gateway.
HTTPCodeWhen it occurs
401platform.<name>.authPlatform rejected the stored OAuth token; the account needs to be reconnected
429platform.<name>.rate_limitUpstream platform rate limit hit. This does not consume your SocialAPI quota
502platform.<name>.api_errorGeneric upstream API failure; check the error message for detail
400platform.tiktok.media_requiredTikTok requires media for this post type
403platform.instagram.permission_denied, platform.whatsapp.permission_deniedOAuth scopes do not include the action
410platform.instagram.window_closedReply window for this comment or DM has expired
404platform.facebook.no_pages, platform.linkedin.no_pages, platform.google.no_locations, platform.youtube.no_channels, platform.youtube.no_uploads_playlistThe connected account exposes no usable target

BYOK (bring-your-own-key)

For platforms that require a customer-supplied OAuth app (currently Twitter / X).
HTTPCodeWhen it occurs
412byok.credentials_missingNo credentials configured for the user or brand; show the BYOK setup modal
401byok.credentials_invalidStored credentials were rejected by the platform
403byok.credentials_forbiddenCaller does not own the brand they are configuring
429byok.test_rate_limitedToo many credential test calls within a minute

Publishing delivery

These are emitted by the post delivery workers and surface in the inbox / events stream rather than as direct HTTP responses, but they appear in event.error_code for post.failed and post.partial events.
CodeMeaning
publishing.delivery.account_load_failedCould not load the connected account at delivery time
publishing.delivery.page_resolve_failedCould not resolve the target Page (Facebook, LinkedIn)
publishing.delivery.timeoutDelivery exceeded the per-platform timeout
publishing.duplicate_targetTwo deliveries targeting the same destination were queued

WhatsApp

WhatsApp Cloud API has a richer error surface than other platforms because of its messaging window, frequency caps, and template state machine.
HTTPCodeWhen it occurs
410whatsapp.window_closed24-hour customer service window is closed; send an approved template instead
429whatsapp.frequency_capPer-user marketing cap reached
429whatsapp.pair_rate_limitPer phone-number-pair rate limit hit
429whatsapp.throughput_exceededAccount-level throughput exhausted
410whatsapp.user_opted_outRecipient has opted out of marketing messages
410whatsapp.undeliverableMessage could not be delivered (cold number, region block, etc.)
404whatsapp.template_not_foundReferenced template does not exist for this WABA
409whatsapp.template_pausedTemplate is paused due to quality drop
404whatsapp.no_account, whatsapp.no_waba_found, whatsapp.no_business_found, whatsapp.no_phone_number_foundOnboarding chain has not produced this resource yet
500whatsapp.unknownUnmapped WhatsApp error; check the message for raw detail

System

HTTPCodeWhen it occurs
500system.internalUnexpected server error. Retry idempotent requests; if persistent, contact support

Handling common cases

Reconnect when a token dies

account.reconnection_required and platform.<name>.auth both mean the stored OAuth token is no longer usable. Send the user back through GET /v1/oauth/url.
err = response.json()["error"]
code = err["code"]
if code == "account.reconnection_required" or \
   (code.startswith("platform.") and code.endswith(".auth")):
    redirect_to_reconnect(account_id)

Storage quota

billing.storage_quota (HTTP 413) means the upload would push you past your plan’s storage limit. Check current usage with GET /v1/media/storage and delete unused media or upgrade.

Monthly post or interaction limit

billing.post_limit (HTTP 429) means your monthly allowance is exhausted. Limits reset at the start of your next billing period. The free plan uses a rolling 30-day window from your account anniversary.

Platform throttling

platform.<name>.rate_limit (HTTP 429) is the upstream platform throttling you, not SocialAPI. It does not consume your quota. Wait a few minutes and retry with backoff.

Validation failures

Any validation.* code includes an error.meta.field pointing to the offending input. Surface the field name to the user.

Example error handling

const resp = await fetch(`https://api.social-api.ai/v1/accounts/${accountId}/comments`, {
  headers: { Authorization: `Bearer ${apiKey}` }
});

if (!resp.ok) {
  const body = await resp.json();
  const { code, message, meta } = body.error;
  const requestId = body.request_id; // include in support reports

  // Reconnect dead OAuth tokens
  if (code === "account.reconnection_required" ||
      (code.startsWith("platform.") && code.endsWith(".auth"))) {
    await reconnectAccount(accountId);
    return;
  }

  // Upstream platform throttling: retry with backoff
  if (code.startsWith("platform.") && code.endsWith(".rate_limit")) {
    await sleep(60_000);
    return retry();
  }

  // Plan limits: prompt to upgrade
  if (code.startsWith("billing.")) {
    throw new Error(`Plan limit hit: ${message}`);
  }

  // BYOK setup needed
  if (code === "byok.credentials_missing") {
    showByokSetupModal(meta?.platform);
    return;
  }

  // Operation not supported on this platform
  if (code === "resource.not_supported") {
    console.warn(`Not supported: ${message}`);
    return null;
  }

  throw new Error(`API error: ${message} (${code}) [request_id: ${requestId}]`);
}