# Revoke access

Revoke an [API key](/docs/authentication.md), a pending invitation or an account member, and it stops working at once.

## Before you start

Do this first: [Create an API key](/docs/authentication/api-keys.md).

## Revoke a key

**Studio**

1. In your project, open **Settings** > **API keys**.
2. Open the **⋯** menu on the key's row.
3. Click **Revoke**.
4. Click **Revoke API key**. You should now see "API key revoked", and a call with the key answers `401`.

**API**

1. Set `PROJECT` to your project's ID ([Find your IDs](/docs/authentication/api-keys.md#find-your-ids)): `export PROJECT=<id>`.
2. List the project's API keys:

```bash
curl "https://api.veryfront.com/api-keys?project_reference=$PROJECT" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY"
```

3. Set `KEY_ID` to the `id` of the key to revoke, found by its `name`: `export KEY_ID=<id>`.
4. Delete the key:

```bash
curl -X DELETE https://api.veryfront.com/api-keys/$KEY_ID \
  -H "Authorization: Bearer $VERYFRONT_API_KEY"
```

5. Call the API with the deleted key, the `vf_…` value you saved. You should now see the answer `401`:

```bash
export DELETED_KEY=<the key you saved>
curl -o /dev/null -w "%{http_code}\n" https://api.veryfront.com/projects/$PROJECT \
  -H "Authorization: Bearer $DELETED_KEY"
```

## Revoke an invitation

**Studio**

1. Open **Settings** > **Members** on the account.
2. Open the **⋯** menu on the invitation.
3. Click **Revoke invitation**.
4. Click **Revoke invitation** in the dialog. You should now see "Invitation revoked" and **No pending invitations**.

**API**

1. Set `ACCOUNT_ID` to your account's id, the part after `/accounts/` in its Studio settings address: `export ACCOUNT_ID=<id>`.
2. List the account's invitations:

```bash
curl https://api.veryfront.com/accounts/$ACCOUNT_ID/invitations \
  -H "Authorization: Bearer $VERYFRONT_API_KEY"
```

3. Set `INVITATION_ID` to the `id` of the invitation, found by its `email`: `export INVITATION_ID=<id>`.
4. Delete the invitation:

```bash
curl -X DELETE https://api.veryfront.com/accounts/$ACCOUNT_ID/invitations/$INVITATION_ID \
  -H "Authorization: Bearer $VERYFRONT_API_KEY"
```

5. List the invitations again. You should now see the invitation gone from `data`:

```bash
curl https://api.veryfront.com/accounts/$ACCOUNT_ID/invitations \
  -H "Authorization: Bearer $VERYFRONT_API_KEY"
```

## Remove an account member

**Studio**

1. Open **Settings** > **Members** on the account.
2. Open the **⋯** menu on the person's row.
3. Click **Remove user**. It is greyed out on an owner's row.
4. Click **Remove account member**. You should now see "Account member removed". They lose access to the account's projects too, and the projects they own move to another account owner.

## With MCP

1. Call `veryfront__list_api_keys` with `{ "project_reference": "my-project" }`, and take the `id` of "Support bot".
2. Call `veryfront__delete_api_key` with `{ "api_key_id": "<the id>", "confirm": true }`.
3. Call `veryfront__list_api_keys` with `{ "project_reference": "my-project" }` again. It worked when "Support bot" is gone.
4. Call `veryfront__list_account_invitations` with `{ "account_id": "<the account id>" }`, and take the `id` of Maya's invitation.
5. Call `veryfront__delete_account_invitation` with `{ "account_id": "<the account id>", "invitation_id": "<the id>", "confirm": true }`.
6. Call `veryfront__list_account_invitations` with the same `account_id`. It worked when Maya's invitation is no longer `pending`.
7. Call `veryfront__list_account_members` with the same `account_id`, and take Maya's `user_id`, found by her `email`.
8. Call `veryfront__delete_account_member` with `{ "account_id": "<the account id>", "user_id": "<Maya's user_id>", "confirm": true }`.
9. Call `veryfront__list_account_members` again. It worked when Maya is no longer listed. She has lost the account's projects too.

## Next steps

* [Set roles](/docs/account/roles.md)
* [Invite people](/docs/account/team.md)
