Skip to main content
An API key acts with everything its creator can do, unless it was created with selected permissions. OAuth lets a user connect an app with a narrower set of permissions, called scopes. The user signs in to Wordsmith and approves the scopes, and the app receives tokens that expire and renew on their own. AI apps such as ChatGPT and Claude use this flow to reach the MCP server, and so can an app that calls the REST API. Wordsmith accepts only approved apps. An app is recognised by the redirect URI its authorisation codes are sent to, so a new app has to be added to Wordsmith’s allowlist before it can register. Contact support@wordsmith.ai to have yours added. Wordsmith can also restrict the list for your organisation on request. An app on the user’s own computer, which receives the code at http://localhost, 127.0.0.1 or [::1], needs no entry. The user’s role must allow the connection. A token that reaches the MCP server needs the Connect AI apps over MCP permission. A token for the REST API only needs Use the Wordsmith API. Admins and full users hold both by default; viewers hold neither.

The flow

Wordsmith follows OAuth 2.1, with dynamic client registration (RFC 7591), PKCE with S256 only, and resource indicators (RFC 8707).
1

Discover the endpoints

GET https://api.wordsmith.ai/.well-known/oauth-authorization-server lists every endpoint below. For the REST API, GET /.well-known/oauth-protected-resource/api/v1 names the resource to request and its scopes_supported.
2

Register the app

POST /oauth/register with your client_name, redirect_uris, and the scope you need. Each redirect URI must be on the allowlist. A registration that is never used expires after 30 days.
3

Send the user to sign in

Redirect the user to /oauth/authorize with response_type=code, your client_id, redirect_uri, scope, a state, a PKCE code_challenge with code_challenge_method=S256, and resource=https://api.wordsmith.ai/api/v1. The user signs in and approves the scopes on Wordsmith’s consent screen.
4

Exchange the code

POST /oauth/token with grant_type=authorization_code, the code, your code_verifier, and your client credentials. You receive an access token and a refresh token.
5

Call the API

Send the access token as Authorization: Bearer <token>, exactly like an API key. A call outside the token’s scopes returns 403 insufficient_scope, naming the scope it needs.
6

Refresh

POST /oauth/token with grant_type=refresh_token. Each refresh returns a new refresh token, and the old one stops working. Keep only the newest.

Tokens

An organisation’s admin can also require apps to reconnect a set number of days after consent. When that limit passes, the next refresh returns invalid_grant and the user signs in again. Revoke a token with POST /oauth/revoke. Revoking a refresh token also ends the access tokens issued from it.

Scopes

A :write scope includes its :read scope, except files:write. No scope adds to the user’s own rights: a token can do only what its user can do in Wordsmith. An app that requests no scope, and registered none, gets every scope above except directory:admin, audit:read, the webhooks scopes, templates:read, openid and email. It also gets mcp:access, unless it named the REST API as its resource. Ask only for what the app needs: the consent screen shows the user each one, and Connect an AI app lists the text it shows. scopes_supported in /.well-known/oauth-protected-resource/api/v1 lists those defaults plus webhooks:read and webhooks:write, so an app that registers itself and asks for every listed scope can run instant triggers. When the user’s role does not allow webhook endpoints, consent grants the other scopes without them, the consent screen lists them as not granted, and the token response’s scope shows what was granted. A request for the webhook scopes alone is refused. The MCP server’s metadata does not list them.

Disconnecting

A user can disconnect an app in Wordsmith under Settings → App access. Its access and refresh tokens stop working at once, and the next refresh fails with invalid_grant. The app then sends the user through the flow again.

Callbacks

An OAuth app can pass callback_url to any call that starts work. It has no API key to sign the callback with, so the start response returns a callback_secret made for that operation, and the callback is signed with it. Wordsmith sends the callback only while the app is still connected and has the operation’s read scope. See Callbacks for OAuth apps.

What OAuth callers cannot do

  • Artifacts. The artifacts routes accept API keys only.