
# Update an organization

`PATCH /v1/organizations/{org_id}` · permission `organizations:write`

Updates an organization with a JSON merge patch (RFC 7396, `Content-Type: application/merge-patch+json`). Fields that are not sent do not change; a patch that changes nothing does not change the version. `name` and `slug` cannot be cleared.

## Request

| Field | Type | Required | Description |
|---|---|---|---|
| `org_id` | path | yes | Organization ID (`org_…`). |
| `If-Match` | header | yes | Required. The `ETag` of the last read (`"<version>"`). |
| `name` | string | no | Display name, 1-256 characters, no control characters. |
| `slug` | string | no | New slug (same format). Can change once every 30 days; the old slug stays reserved for 90 days. |
| `external_id` | string \| null | no | Your own identifier, up to 255 characters; unique in the environment. `null` clears it. |
| `metadata` | object \| null | no | Merged into the current object (RFC 7396): a member set to `null` is removed; `null` for the whole field resets it to `{}`. |
| `brand_color` | string \| null | no | Brand color `#RRGGBB`; stored in upper case. `null` clears it. |
| `max_memberships` | integer \| null | no | Membership cap, at least 1; `null` means unlimited. |
| `default_zoneinfo` | string \| null | no | Default IANA time zone (for example `Europe/Istanbul`), used for sign-up, invitation, JIT SSO and SCIM in the organization context when the browser or IdP supplies none. `null` clears it (the environment default applies). |

Request body:

```json
{
  "name": "Acme Corporation",
  "metadata": {
    "tier": null,
    "region": "eu"
  }
}
```

## Response

`200 OK` with the updated organization and its new `ETag`.

```json
{
  "id": "org_01j9xk3m7q8r2s4t6v8w0y2z4a",
  "name": "Acme Corporation",
  "slug": "acme",
  "external_id": "crm-4821",
  "status": "active",
  "metadata": {
    "region": "eu"
  },
  "brand_color": "#1F6FEB",
  "max_memberships": null,
  "default_zoneinfo": null,
  "created_via": "admin_api",
  "disabled_at": null,
  "deletion_requested_at": null,
  "deletion_due_at": null,
  "created_at": "2026-10-12T09:30:00.123456Z",
  "updated_at": "2026-10-12T10:05:00.654321Z",
  "version": 2
}
```

## Errors

| HTTP | code | When |
|---|---|---|
| 400 | `unknown_field` | The body has a field that is not in the schema or is read-only (`id`, `status`…). |
| 401 | `unauthenticated` | The credential is missing, invalid or revoked. |
| 403 | `insufficient_permissions` | The credential lacks the required permission. |
| 404 | `not_found` | No organization with this ID exists in this environment. |
| 409 | `slug_taken` | The slug is used by another organization. |
| 409 | `slug_reserved` | The slug is a reserved word or another organization's former slug (reserved for 90 days). |
| 409 | `slug_change_rate_limited` | The slug was changed less than 30 days ago. |
| 409 | `external_id_taken` | The `external_id` is used by another organization. |
| 409 | `organization_pending_deletion` | The organization is waiting for self-service deletion; cancel the deletion first. |
| 412 | `precondition_failed` | `If-Match` does not match the current version; read the organization again. |
| 422 | `validation_failed` | A field is invalid (`name`, `slug`, `external_id`, `metadata`, `brand_color`, `max_memberships`, `default_zoneinfo`). |
| 428 | `precondition_required` | `If-Match` is missing. |
| 429 | `rate_limited` | The rate limit was exceeded; retry after the `Retry-After` period. |
| 503 | `service_unavailable` | A dependency is temporarily unavailable; retry after the `Retry-After` period. |

## Example

```bash
curl -X PATCH "https://api.eu.keenauth.com/v1/organizations/org_01j9xk3m7q8r2s4t6v8w0y2z4a" \
  -H "Authorization: Bearer $KEENAUTH_SECRET_KEY" \
  -H "Content-Type: application/merge-patch+json" \
  -H 'If-Match: "1"' \
  -d '{"name":"Acme Corporation"}'
```
