Complete Gorgias App Authorization
POST/api/integrations/gorgias/oauth/complete
Exchanges the authorization code for tokens, checks them with Gorgias and saves the connection with auth_type: oauth (updating the existing Gorgias connection if there is one). Access tokens last 24 hours and are refreshed automatically before they expire.
integrations:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Body:
code(required, string) — from the Gorgias redirectstate(required, string) — from the Gorgias redirectdomain(optional, string) — the account Gorgias redirected for; must match the one authorised
When order support is on (an install from the Gorgias App Store turns it on), the Gorgias objects are set up straight away: provisioned is true when every item was created, and provision_error says what could not be set up (null otherwise). The connection is saved either way; retry with Set Up Gorgias Objects.
422 when the state is unknown, expired, already used or from another user, or Gorgias refuses the code.
Connection fields: id, domain (the Gorgias subdomain), account_name, auth_type (api_key | oauth), email, has_api_key, connected_at, last_success_at, last_error, endpoint_base_url (the base of the URLs Gorgias calls; null until the connection has a webhook token), webhook_secret_hint (last 4 characters only; the API key, OAuth tokens and full secret are never returned), order_support (cancellation rules plus the address_edit, reship, returns and refunds policies), repairs (push_updates, sender_user_id, webhook_url), provisioning (last_run_at and the setup checklist), stats_30d (lookups, cancelled, held_for_review, not_allowed, holds) oauth_available and health (status: ok | degraded | needs_reconnect; reason; last_checked_at; missing_scopes: the app permissions the connection still needs, empty for API-key connections).
Checklist items whose status is manual carry copy-ready values in manual, with the shared secret masked to its last 4 characters. Get Gorgias AI Agent Setup Values returns them with the full secret.
Requires gorgias.manage.
Request
Responses
- 200
- 401
- 403
- 422
- 429
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Unprocessable Entity
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.