
# Enable or disable an application in an organization

`PUT /v1/organizations/{org_id}/applications/{application_id}` · permission `organizations:write`

Sets the application's status in the organization. Writing the current status again is a no-op and keeps the version. `If-Match` is optional; when given it must match the current `ETag`. Disabling keeps the assignments; they apply again when the application is re-enabled. Writes are recorded in the management audit log as `organization_application.enabled` or `organization_application.disabled`.

## Request

| Field | Type | Required | Description |
|---|---|---|---|
| `org_id` | path | yes | Organization ID (`org_…`). |
| `application_id` | path | yes | Application ID (`app_…`). |
| `If-Match` | header | no | Optional. The current `ETag` (`"0"` for a row that was never written); on mismatch `412`. |
| `status` | string | yes | `enabled` or `disabled`. |

## Response

`200 OK` with the access row and its new `ETag`.

```json
{
  "organization_id": "org_01j9xk3m7q8r2s4t6v8w0y2z4a",
  "application_id": "app_01j9xm4n8r9s3t5v7w9x1y3z5b",
  "status": "enabled",
  "enabled_at": "2026-10-12T09:30:00.123456Z",
  "updated_at": "2026-10-12T09:30:00.123456Z",
  "version": 1
}
```

## Errors

| HTTP | code | When |
|---|---|---|
| 404 | `not_found` | The organization or application does not exist in this environment. |
| 409 | `organization_pending_deletion` | Enabling in an organization that is pending deletion. |
| 412 | `precondition_failed` | `If-Match` does not match the current version; with `"0"`, another request wrote the row first. |
| 422 | `validation_failed` | `status` is missing or not `enabled`/`disabled`. |
| 401 | `unauthenticated` | The credential is missing, invalid or revoked. |
| 403 | `insufficient_permissions` | The credential lacks the required permission. |
| 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 -i -X PUT "https://api.eu.keenauth.com/v1/organizations/org_01j9xk3m7q8r2s4t6v8w0y2z4a/applications/app_01j9xm4n8r9s3t5v7w9x1y3z5b" \
  -H "Authorization: Bearer $KEENAUTH_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H 'If-Match: "0"' \
  -d '{"status":"enabled"}'
```
