---
title: "Delete Api Key"
method: DELETE
path: "/keys/{key_prefix}"
tags: ["Keys"]
---

# Delete Api Key

`DELETE /keys/{key_prefix}`

Delete an API key with the given key prefix for the authenticated user.

Args:
    key_prefix (str): The prefix of the API key to be deleted.
    request (Request): The incoming request object.

Returns:
    dict: A dictionary containing a success message upon successful deletion.

Raises:
    HTTPException: If the API key is not found or does not belong to the user.

## Path parameters

- `key_prefix` string, required

## Response `200`

Successful Response

- object

## Other responses

- `422` — Validation Error

## Changes

- **2026-05-02** `6e37373d45fe` — 2 info
  - api tag `Keys` added
  - api tag `Api Keys` removed
- **2026-02-13** `72fe88316d15` — 2 info
  - added the optional property `detail/items/ctx` to the response with the `422` status
  - added the optional property `detail/items/input` to the response with the `422` status
- **2025-06-27** `e3e84db47198` — 2 warning, 2 info
  - removed the optional property `detail/items/ctx` from the response with the `422` status
  - removed the optional property `detail/items/input` from the response with the `422` status
  - api tag `Api Keys` added
  - api tag `Keys` removed

[Change history](https://skmtc.dev/agenta-ai/apis/agenta-api/changes/keys/:key_prefix/delete.md)

---

[API](https://skmtc.dev/agenta-ai/apis/agenta-api.md) · [All operations](https://skmtc.dev/agenta-ai/apis/agenta-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/agenta-ai/agenta-api/revisions/06e03dbce2be/schema)
