
# Revoke an invitation

`POST /fapi/v1/organizations/{org_id}/invitations/{invitation_id}:revoke` · called from the environment's sign-in host

Revokes a pending invitation. The answer is the revoked invitation; its address has been erased (`email` is `null`). An invitation that is no longer pending (accepted, expired or already revoked) returns `422 invitation_invalid`.

Requires the authenticated user's `__Host-idp_session` cookie with an exact `Origin`, or a first-party app's front API access token (`Authorization: DPoP <token>` with a DPoP proof; see [Front API access token](/docs/api/fapi/front-api-token)). The user must be an active member of the organization with the `idp_members:invite` permission. A user who is not a member gets `404 not_found`; a member without the permission gets `403 insufficient_permissions`. Only a member who holds the admin role can revoke an invitation that carries a privileged role (`403 role_not_assignable`).

With `@keenauth/js`: `await keenauth.organizations.revokeInvitation(orgId, invitationId)`.

## Request

Headers:

| Header | Required | Description |
| --- | --- | --- |
| `Idp-Client` | yes | SDK identifier. |
| `Origin` | yes, with the cookie | `https://<sign-in host>`. |

`org_id`: the organization identifier (`org_…`). `invitation_id`: the invitation identifier (`inv_…`), the `id` of [the invitation](/docs/api/fapi/organizations/invitations/create).

No body.

## Response

`200 OK` with the invitation and `ETag: "<version>"`.

## Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `unauthenticated` | No valid session cookie or token. |
| 403 | `insufficient_permissions` | The user lacks `idp_members:invite` in the organization. |
| 403 | `role_not_assignable` | The invitation carries a privileged role and the user does not hold the admin role. |
| 403 | `origin_not_allowed` | The `Origin` does not match. |
| 404 | `not_found` | No such organization or invitation for this user; an unknown, malformed or foreign identifier answers the same. |
| 409 | `organization_disabled` | The organization is disabled or pending deletion (`organization_pending_deletion`). |
| 422 | `invitation_invalid` | The invitation is not pending. |
| 503 | `service_unavailable` | Temporarily unavailable; retry after `Retry-After`. |

## Example

```bash
curl -X POST "https://example.keenauth.app/fapi/v1/organizations/org_01jbz6x8kq3m2n4p5r6s7t8v9a/invitations/inv_01jbz6x8kq3m2n4p5r6s7t8v9d:revoke" \
  -H "Idp-Client: my-app/1.0.0 (node/22.0.0)" \
  -H "Origin: https://example.keenauth.app" \
  -b cookies.txt
```

```json
{
  "id": "inv_01jbz6x8kq3m2n4p5r6s7t8v9d",
  "email": null,
  "role_ids": ["rol_01jbz6x8kq3m2n4p5r6s7t8v9w"],
  "delivery": "email",
  "delivery_status": "sent",
  "status": "revoked",
  "send_count": 1,
  "last_sent_at": "2026-11-03T10:00:00Z",
  "expires_at": "2026-11-10T10:00:00Z",
  "accepted_user_id": null,
  "accepted_at": null,
  "revoked_at": "2026-11-03T11:00:00Z",
  "created_at": "2026-11-03T10:00:00Z",
  "updated_at": "2026-11-03T11:00:00Z",
  "version": 2
}
```

## Personal data

This endpoint carries personal data: organization memberships and invitations. [Personal data in the KeenAuth APIs](/docs/policies/personal-data) describes what is stored, how long it is kept and how it is deleted. Do not send special categories of personal data (health, biometric data, religion, political opinions, sexual orientation) in any field.
