Skip to main content
Every request to https://api.social-api.ai/v1 and to the MCP server at https://api.social-api.ai/mcp carries a token in the Authorization header: Authorization: Bearer <token>. SocialAPI accepts two kinds of token: an API key, which you create and keep on your server, and an OAuth 2.1 access token, which an app receives after a SocialAPI user approves it. Most integrations use an API key. Managing keys costs no credits.

Token types

A full-access API key and an OAuth access token can call every public endpoint of your SocialAPI account. A scoped API key can call only what its scopes and brands allow. The two token types work on the REST API and on the MCP server alike.

Endpoints

Creating, listing, changing, rotating, and revoking keys needs full access: a full-access key, an OAuth access token, or the dashboard. A scoped key, including a key restricted only to brands, that calls these endpoints gets 403 auth.insufficient_scope. GET /v1/keys/scopes is the exception: any valid key can call it.

Create a key

Create a key in the SocialAPI dashboard, or with the API:
Response (HTTP 201):
raw_key is shown once, in this response. Store it in a secret manager or an environment variable such as SOCAPI_KEY. GET /v1/keys shows only a preview afterwards, and no endpoint returns the secret again: a lost secret needs a rotation.

List keys

Response (HTTP 200):

Rotate a key

Rotation issues a new secret and keeps the key’s id, name, scopes, and brand_ids:
Response (HTTP 200): the same fields as when you create a key, with the new raw_key. The old secret stops working at once, so update every service that uses it. last_used_at is cleared. Rotating a revoked key, or an ID that is not one of your keys, returns 404 resource.not_found. To replace a secret with no downtime, create a second key with the same scopes and brands, deploy it to your services, then revoke the first key. Rotation cuts over at once and has no overlap. To change a key’s name, scopes, or brands without a new secret, use PATCH /v1/keys/{id}, described in Scoped API keys.

Revoke a key

Response (HTTP 200):
Revoking cannot be undone. The key stops working at once, and every request with it returns 401 auth.invalid_key. Revoking a key that is already revoked returns 404 resource.not_found.

Authentication errors

  • No Authorization header returns 401 auth.missing_header.
  • Authorization: Bearer followed by nothing returns 401 auth.empty_token.
  • A sapi_key_ token that is unknown or revoked returns 401 auth.invalid_key.
  • Any other token that is invalid or expired returns 401 auth.invalid_token.
  • An OAuth access token whose user no longer exists returns 401 auth.user_not_found.
  • A scoped key outside its scopes or brands, or calling key management, returns 403 auth.insufficient_scope.
  • A failed payment on your SocialAPI account returns 402 billing.past_due on every endpoint except every method of /v1/users/me and every /v1/billing/* endpoint. See Plans.
Match on error.code, never on error.message. Every code is in Errors. The MCP server at /mcp answers the same failures with HTTP 401 (or 402 for a past-due account) and a body of the form {"error": "invalid or inactive API key"}, without the error envelope. The past-due 402 body also carries code: billing.past_due.

Keep keys safe

  • Use keys only on a server. A key in a browser, a mobile app, or a public repository can be copied and used by anyone.
  • Load keys from the environment. Read SOCAPI_KEY from an environment variable or a secret manager, never from source code.
  • Create one key per service. Revoke one service’s key without stopping the others.
  • Give each key only what it needs. Restrict keys to the scopes and brands the service uses, so a leaked key cannot reach other clients or actions.
  • Guard full-access keys most. A full-access key can create more keys, including other full-access keys.
  • Rotate a key you think leaked. POST /v1/keys/{id}/rotate ends the old secret at once and keeps the key’s restrictions.
  • Revoke keys you no longer use. Check last_used_at to find them.

Use from an AI agent

See MCP tools for every tool.
Last modified on October 19, 2026