# GetRecited API authentication

GetRecited API authentication uses a workspace API key that an administrator creates in the dashboard. Send the key as a Bearer token, or exchange it for a 15-minute OAuth 2.0 access token; either reads only the scopes the key was given.

## Discover

Read [the OpenAPI contract](https://getrecited.com/openapi.json) and [protected-resource metadata](https://getrecited.com/.well-known/oauth-protected-resource). The supported methods are a workspace API key and OAuth 2.0 `client_credentials`. Read [authorization-server metadata](https://getrecited.com/.well-known/oauth-authorization-server). WorkOS agent_auth registration, identity_assertion, service_auth and id-jag exchange are not implemented. There is no identity_endpoint, claim_endpoint or events_endpoint to advertise.

## Pick a method

Send `Authorization: Bearer` followed by your `ctx_` key. `X-Api-Key` is also supported by REST. MCP requires a manually configured workspace key in the Bearer header; it does not accept REST OAuth tokens or advertise MCP OAuth discovery. Keep keys in a server-side secret store or local environment; never paste them into an agent conversation, source control or browser storage.

## Register

Sign in to your existing GetRecited account and select the workspace you administer. Early-access availability and API entitlement depend on your account; this is not automatic agent registration. The public index and documentation require no account.

## Claim

Workspace administrators control API keys. An agent cannot claim an organization, domain or identity merely by providing a URL. User authorization is required before an integration accesses workspace data.

## Exchange

Open Settings → Developer and create a named API key. Copy it once, store it securely and grant only the required scopes: `read:brands`, `read:visibility`, `read:scans`, `read:sources` or `read:reports`. For OAuth `client_credentials`, POST form-encoded `grant_type=client_credentials`, `client_id` (the first 12 characters of your key), `client_secret` (the full key), and optional space-separated `scope` to `https://getrecited.com/oauth/token`. HTTP Basic client authentication is also supported. The response includes `access_token`, `token_type=Bearer`, `expires_in=900` and `scope`. Requested scopes must be a subset of your key permissions; no refresh token is issued. Keep this confidential-client exchange on your own server.

```sh
# The client id is the first 12 characters of the key.
curl --fail-with-body https://getrecited.com/oauth/token \
  -d grant_type=client_credentials \
  -d client_id="$(echo "$GETRECITED_API_KEY" | cut -c1-12)" \
  -d client_secret="$GETRECITED_API_KEY" \
  --data-urlencode "scope=read:brands read:visibility"
```

```json
{
  "access_token": "<access token>",
  "token_type": "Bearer",
  "expires_in": 900,
  "scope": "read:brands read:visibility"
}
```

## Use the access_token

For REST, send either the workspace key or the OAuth `access_token` as a Bearer credential. Tokens expire after 15 minutes, remain bound to their issuing key and cannot elevate its scopes. For example:

```sh
curl --fail-with-body https://getrecited.com/api/v1/brands \
  -H "Authorization: Bearer $GETRECITED_API_KEY"
```

The read API returns JSON; `/mcp` exposes the same reads through Streamable HTTP. Brand-scoped MCP credentials cannot be used as workspace REST keys.

## Errors

The read API answers an error as JSON with `code`, `message` and `request_id`:

| Status | `code` | Meaning |
| --- | --- | --- |
| 401 | `unauthenticated` | The key or token is missing, invalid, revoked, expired or of the wrong kind. `WWW-Authenticate` carries a Bearer `resource_metadata` address |
| 403 | `forbidden` | The key lacks the scope the request needs |
| 403 | `plan_limited` | The organization's plan does not include API access |
| 404 | `not_found` | The path is unknown, or the brand is not in the key's workspace |
| 422 | `invalid_argument` | The brand id in the path is not a UUID |
| 422 | `validation_error` | A query value is out of range; `field_errors` names it |
| 429 | `rate_limited` | A limit for the current minute is used up. Wait the seconds in `Retry-After` |
| 502 | `invalid_upstream_response` | The service did not answer with JSON. Try again later |
| 503 | `dependency_unavailable` | The service cannot be reached. Try again later |

The token endpoint answers an error in the OAuth form, `{"error": "…", "error_description": "…"}`:

| Status | `error` | Meaning |
| --- | --- | --- |
| 400 | `invalid_request` | The form is malformed, repeats a parameter, or names the client both in the form and in a Basic header |
| 400 | `unsupported_grant_type` | `grant_type` is not `client_credentials` |
| 400 | `unauthorized_client` | The organization's plan does not include API access |
| 400 | `invalid_scope` | A requested scope is not one the key holds |
| 400 | `invalid_target` | `resource` names something other than this API |
| 401 | `invalid_client` | The client id or the secret is wrong, or the key is revoked or expired |
| 413 | `invalid_request` | The body is larger than 8,192 bytes |
| 415 | `invalid_request` | The body is not form-encoded |
| 429 | `temporarily_unavailable` | The key's limit for the current minute is used up. Wait the seconds in `Retry-After` |
| 503 | `temporarily_unavailable` | The token service cannot be reached |

[GetRecited API documentation](https://getrecited.com/developers.md#errors) says what to do for each API error. Do not log the credential when reporting a failure.

## Revocation

Revoke the key in Settings → Developer, then remove it from your integration. Rotation requires creating a replacement key and revoking the old one. Revoked or expired keys, and all OAuth tokens issued from them, fail verification on subsequent requests. Reducing key scopes also reduces the effective token scopes. Read [GetRecited API documentation](https://getrecited.com/developers.md) for SDKs and local testing.
