ShawDocs
Developers

Authentication & API keys

Authenticate Shaw API and MCP requests with OAuth 2.1 PKCE tokens or scoped sk_ keys, configure plugin permissions, and handle 401-403 and 402 errors.

Shaw's REST API and Workspace MCP (https://shaw.ai/mcp) accept two credential types. Both run with the signed-in user's workspace permissions and are narrowed to the scopes granted when the credential was created.

API keyOAuth access token
Best forScripts, CI pipelines, GitHub Actions, headless MCP clientsClaude, Claude Code, ChatGPT, Codex, and interactive tools
Created bySigned-in user in API keysUser approving consent on Shaw Connect
Token formatsk_ followed by 43 characterssat_... access token (srt_... refresh token)
Lifetime1 to 365 days (90 days default)Access token 1 hour; refresh token 60 days, rotated on each use
StorageSHA-256 hash only; secret shown once on creationHashed in D1; revoking a grant takes effect immediately
Limits120 requests/min per key; up to 25 active keys per user120 requests/min per grant

Send either credential in the Authorization header:

Authorization: Bearer <credential>

Active plugin & API scopes

Grant only the scopes your workflow requires. A write scope never implies its read scope—select both when an integration reads and mutates state, and note that scopes never widen a user's organization role.

ScopeWhat it allows
org:readRead accessible organizations (GET /api/me), runtime status, and monthly credit balances (GET /api/credits)
pages:readSearch catalog metadata (GET /api/templates/search), inspect template credit cost (GET /api/templates/detail/{id}), unlock metered source (POST /api/templates/use), and read Brand Kits, remixes, hosted pages, custom domains, and Email Studio drafts
pages:writeUpdate workspace Brand Kits, create or edit AI remixes (POST /api/templates/remixes), publish hosted landing pages and custom domains, publish to Shopify Pages, and save or publish Email Studio drafts
connectors:readInspect connected providers such as Shopify and Klaviyo (GET /api/connections) without exposing stored credentials

Additional scopes (org:write, connectors:manage, files:read, files:write, memory:read, memory:write, tools:read, tools:write, and webhooks:manage) can be selected when creating personal API keys for broader automation workflows.

API keys can only be created or revoked from a signed-in browser session at shaw.ai/app/developers. Bearer credentials cannot mint or revoke keys (403 bearer_not_allowed).

OAuth 2.1 + PKCE on /app/connect

Interactive AI clients connect to https://shaw.ai/mcp using standard OAuth 2.1 with mandatory S256 PKCE and dynamic client registration (RFC 7591):

  • Authorization server discovery: https://shaw.ai/.well-known/oauth-authorization-server/api/auth
  • Protected resource metadata: https://shaw.ai/.well-known/oauth-protected-resource/mcp
  • Consent screen: https://shaw.ai/app/connect (highlights org:read, pages:read, pages:write, and connectors:read by default and lets the user untick optional scopes before approving)
  • Organization selection: Target a specific workspace by passing X-Shaw-Tenant: <organization-id> (or the MCP tenant field), or pin an API key to one organization at creation time.

Error responses

API and MCP HTTP errors return structured JSON with a machine-readable error (or code for credit errors) field:

HTTP statusError codeMeaning
401Unauthorizedinvalid_tokenMissing, malformed, expired, or revoked credential (WWW-Authenticate includes resource_metadata)
402Payment RequiredINSUFFICIENT_CREDITSRequested template exceeds remaining monthly credits; payload includes "You need more credits", requiredCredits, remainingCredits, and upgradeUrl
403Forbiddeninsufficient_scopeCredential lacks the required scope (named in WWW-Authenticate)
403Forbiddenbearer_not_allowedSession-only route such as key management, /api/templates/zip/*, /api/templates/ticket, /api/templates/remixes/*/view, or /api/builder/pages/export
403Forbiddentenant_pinnedAPI key is pinned to a different organization than X-Shaw-Tenant
403Forbiddenforbidden_workspaceAuthenticated user does not belong to the requested organization
429Too Many Requestsrate_limitedExceeded 120 requests/min per credential; wait Retry-After seconds
503Service Unavailabletemporarily_unavailableTransient upstream verification error; retry after Retry-After seconds

See Monthly credits for 402 retry guidance, or browse the Organization API Reference and Connections API Reference.

On this page