
# Delete an API

`DELETE /v1/apis/{api_id}?confirm=true` · permission `apis:write`

Soft-deletes an API. `confirm=true` and `If-Match` are required. Application grants for this API and applications' default API setting that points to it are removed in the same operation, the identifier cannot be reused for 90 days, and refresh sessions issued for this audience are revoked. The system API cannot be deleted.

## Request

| Parameter | In | Description |
|---|---|---|
| `api_id` | path | The API id. |
| `confirm` | query | Must be `true`. |
| `If-Match` | header | The `ETag` from the last read (required). |

## Response

`204 No Content`, no body.

## Errors

| HTTP | code | When |
|---|---|---|
| 404 | `not_found` | No such API in this environment. |
| 409 | `conflict` | The API is the system API. |
| 412 | `precondition_failed` | `If-Match` does not match the current version. |
| 422 | `validation_failed` | `confirm` is missing or is not `true` (`/confirm`). |
| 428 | `precondition_required` | `If-Match` is missing. |

## Example

```bash
curl -X DELETE "https://api.eu.keenauth.com/v1/apis/api_01h455vb4pex5vsknk084sn02q?confirm=true" \
  -H "Authorization: Bearer $KEENAUTH_SECRET_KEY" \
  -H 'If-Match: "1"'
```
