> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mithunai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Withdraw an invitation

> Stop an invitation link working before it is used. Takes a signed-in console session, never an API key. Repeats are safe.

Withdraws an invitation that has not been accepted. The link in the email stops working at once, and the invitation leaves the [list](https://docs.mithunai.com/api-reference/invitations/list-invitations.md). You can invite the same address again afterwards.

Withdrawing is **idempotent**: withdrawing an invitation that is already withdrawn succeeds and changes nothing.

An invitation that has already been accepted cannot be withdrawn, because that person is a member now; the request returns `409`. To end their access, [remove the member](https://docs.mithunai.com/api-reference/members/remove-member.md).

This endpoint takes a **signed-in console session**, not an API key. Send the session cookies your browser received when you signed in, plus the `X-CSRF-Token` header set to the value of the `csrf_token` cookie. A request authenticated with an `mithunai_sk_` key is refused with `403`.

You need the owner or admin role. An invitation that does not exist, an invitation in another organisation and a malformed ID all return the same `404`. See [Invitations](https://docs.mithunai.com/administration/invitations.md).

**invitation\_id** `string` *required*

The invitation's ID (UUID), as returned in `id` by [List
invitations](https://docs.mithunai.com/api-reference/invitations/list-invitations.md).

**X-CSRF-Token** `string` *required*

The value of your session's `csrf_token` cookie (named `__Host-csrf_token` when the console is
served over HTTPS without a shared cookie domain). A missing or mismatched token returns `401`.

## Response

**revoked** `boolean` *required*

Always `true`.

```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
# cookies.txt holds the cookies from your signed-in console session.
curl --request DELETE \
  "$MITHUNAI_URL/mithunai/api/v1/invitations/9d4e2a71-3c5b-4f80-a6d1-8e7b2c0f4a13" \
  --cookie cookies.txt \
  --header "X-CSRF-Token: $MITHUNAI_CSRF_TOKEN"
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import os
from http.cookiejar import MozillaCookieJar

import requests

jar = MozillaCookieJar("cookies.txt")
jar.load()

invitation_id = "9d4e2a71-3c5b-4f80-a6d1-8e7b2c0f4a13"
response = requests.delete(
    f"{os.environ['MITHUNAI_URL']}/mithunai/api/v1/invitations/{invitation_id}",
    cookies=jar,
    headers={"X-CSRF-Token": os.environ["MITHUNAI_CSRF_TOKEN"]},
    timeout=30,
)
response.raise_for_status()
```

```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
// Runs in a page on the MITHUNAI console's own origin, while signed in.
// csrfToken is the value of the csrf_token cookie.
const invitationId = '9d4e2a71-3c5b-4f80-a6d1-8e7b2c0f4a13'
await fetch(`/mithunai/api/v1/invitations/${invitationId}`, {
  method: 'DELETE',
  credentials: 'include',
  headers: { 'X-CSRF-Token': csrfToken },
})
```

```json 200 theme={"theme":{"light":"github-light","dark":"github-dark"}}
{ "revoked": true }
```

```json 404 theme={"theme":{"light":"github-light","dark":"github-dark"}}
{ "code": "not_found", "message": "The requested resource was not found." }
```

```json 409 theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "code": "conflict",
  "message": "That invitation has already been accepted. Remove the member instead."
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.