# Delete an API key

Source: https://provod.ai/en/docs/keys-delete

**`DELETE /v1/keys/{hash}`**

Permanently revoke an inference key. To pause a key temporarily, use PATCH with disabled: true.

## Authentication

`Authorization: Bearer <MANAGEMENT_API_KEY>`: a management key bound to the workspace. The key owner must retain the live permission `apiKeys.revoke`.

The credential determines the workspace. `X-Org-Id` is unsupported.

## Path parameters


| Field  | Type              | Description                                                                              |
| ------ | ----------------- | ---------------------------------------------------------------------------------------- |
| `hash` | string · required | SHA-256 digest from data.hash on creation or listing. Not the secret or internal key ID. |


## Response · 200


| Field     | Type    | Description                       |
| --------- | ------- | --------------------------------- |
| `deleted` | boolean | True after successful revocation. |


### Response example

Identifiers and amounts in these examples are illustrative.


**Response JSON**


```json
{
  "deleted": true
}
```



## Request example

Load the key into a server environment variable. TypeScript uses Node.js fetch; Python uses only the standard library.

Replace the example hash with your key’s data.hash.




TypeScript



Python



cURL




```typescript
const response = await fetch("https://api.provod.ai/v1/keys/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${process.env.MANAGEMENT_API_KEY}`,
  },
});
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
console.log(await response.json());
```



```python
import json
import os
from urllib.request import Request, urlopen

request = Request(
    "https://api.provod.ai/v1/keys/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    method="DELETE",
    headers={"Authorization": f"Bearer {os.environ['MANAGEMENT_API_KEY']}"},
)
with urlopen(request) as response:
    print(json.load(response))
```



```bash
curl --fail-with-body --silent --show-error -X DELETE \
  "https://api.provod.ai/v1/keys/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
  -H "Authorization: Bearer ${MANAGEMENT_API_KEY}"
```



## Errors


| HTTP  | Error        | Cause                                                                                       |
| ----- | ------------ | ------------------------------------------------------------------------------------------- |
| `401` | Unauthorized | Missing, invalid, disabled, revoked or expired key. The `X-Org-Id` header is also rejected. |
| `403` | Forbidden    | Wrong key kind or insufficient workspace access.                                            |
| `404` | Not Found    | Key not found, revoked or outside the workspace.                                            |


Authentication error example:

```json
{
  "error": {
    "code": "invalid_api_key",
    "message": "Invalid API key",
    "metadata": {}
  }
}
```

Operation error example:

```json
{
  "message": "API key not found",
  "error": "Not Found",
  "statusCode": 404
}
```

## Next steps

* [Management keys](/en/docs/management-keys)
* [Generation charges](/en/docs/generation-metadata)
