---
title: "Revoke an API key"
method: PATCH
path: "/api/key/revoke/{api_key_id}"
tags: ["ApiKey"]
---

# Revoke an API key

`PATCH /api/key/revoke/{api_key_id}`

Deactivate an API key so it can no longer authenticate requests.

## Path parameters

- `api_key_id` integer, required — ID of the API key to revoke.

## Query parameters

- `cookie_name` string, nullable

## Response `200`

Successful Response

- ApiKey — api key model
  - `id` integer — Primary key for api keys
  - `name` string, nullable — Name for the key to be created. Max 100 characters.
  - `description` string, nullable — Description of the key.
  - `key_id` string, required — Public part of the key
  - `environment` string — Environment where the key is used.
  - `hashed_secret` string, required — hashed api key
  - `active` boolean — Whether the API key is currently active.
  - `version` string — Version of the API key for rotation purposes.
  - `creator_user_id` integer, required — ID of the user who created the key.
  - `created_at` string, date-time — Timestamp when the key was created.
  - `last_used_at` string, date-time — Timestamp when the API key was last used.
  - `expires_at` string, date-time — Timestamp when the API key expires.

## Other responses

- `401` — Missing or invalid authentication.
- `404` — No API key exists with the given id.
- `422` — Validation Error

---

[API](https://skmtc.net/neulandai/apis/neuland-ai-hub-api.md) · [All operations](https://skmtc.net/neulandai/apis/neuland-ai-hub-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/neulandai/neuland-ai-hub-api/revisions/b53e89b98c2b/schema)
