# api_key_organization_forbidden

<!-- Generated by scripts/generate.ts. Do not edit. -->

<!-- Source: core commit `f70874a3916ad5b24a8619246cbae6cc8bc24d27`. -->

<div data-pagefind-ignore>

Since API version `1.0`.

| Field     | Value        |
| --------- | ------------ |
| Type      | `permission` |
| Status    | 403          |
| Surfaces  | `api`        |
| Retryable | No           |

</div>

## What it means

The request was made with an API key limited to one organization, and the route either names another organization or does not name one at all. An organization key may call routes with `{org}` in the path and the list routes that filter by an `organization` query parameter, with its own organization in that place. Routes that reach a resource by its ID alone (a connection, directory, user, passkey, M2M client, webhook endpoint or import switch) are refused for organization keys, because the ID does not prove which organization the resource belongs to.

## Likely causes

- The path or the `organization` query parameter names a different organization than the key's.
- The route is an ID-only route such as `GET /v1/connections/{conn}` or `PATCH /v1/users/{user}`.
- A list route was called without `organization=<the key's organization>`.
- The route reads `organization` from the query but does not filter by it, so the parameter does not count.

## How to fix it

### For developers

- For lists, add `organization=<org_id>` with the key's own organization, for example `GET /v1/connections?organization=org_...`.
- For ID-only routes, use an environment-wide secret key on your server; keep organization keys for work that names its organization.
- See [organization-scoped API keys](/authorization/organization-api-keys/) for the full list of allowed routes.

### For IT administrators

- Ask the app's team to use a key that covers this organization.

## Example

HTTP status 403 when an organization key reads a connection by ID:

```json
{
  "error": {
    "type": "permission",
    "code": "api_key_organization_forbidden",
    "message": "The key is limited to one organization and this request is outside it",
    "doc_url": "https://docs.ohauthcat.com/errors/api_key_organization_forbidden",
    "request_id": "req_01J9Z3K5V7W8X9Y0Z1A2B3C4D5"
  }
}
```

## Developer message

The key is limited to one organization and this request is outside it

## IT administrator message

This key can't access that organization

## Translated IT administrator messages

The hosted portal shows these machine translations, which native speakers have not reviewed yet. Placeholders and identity provider console labels stay in English.

- `de`: <span lang="de" data-pagefind-ignore>Dieser Schlüssel hat keinen Zugriff auf diese Organisation</span>
- `es`: <span lang="es" data-pagefind-ignore>Esta clave no puede acceder a esa organización</span>
- `fr`: <span lang="fr" data-pagefind-ignore>Cette clé ne peut pas accéder à cette organisation</span>
- `ja`: <span lang="ja" data-pagefind-ignore>このキーではその組織にアクセスできません</span>
- `pt-BR`: <span lang="pt-BR" data-pagefind-ignore>Esta chave não pode acessar essa organização</span>

Security invariants: 57.
