---
title: "Expire pending API keys"
method: POST
path: "/workspaces/{id}/api-key/expire"
tags: ["Workspaces"]
---

# Expire pending API keys

`POST /workspaces/{id}/api-key/expire`

Immediately expires all pending API keys (those with expires_at set) for a workspace. Useful after verifying that the new key works correctly. Cannot be used on protected workspaces. Rate limited to 1 request per minute.

## Path parameters

- `id` string, uuid, required

## Request body

- object
  - `key_type` 'live' | 'test' — Optionally restrict expiry to one key type ('live' or 'test'). If omitted, all pending keys are expired (current behavior).

## Response `200`

Pending keys expired successfully

- ApiKeyExpireResponse — API key expiration result
  - `success` boolean, required — Whether the operation succeeded
  - `expired_keys` object[] — List of expired keys with details
    - `id` string, uuid
    - `api_key` string — The expired API key value
    - `original_expires_at` string, date-time — When the key was originally set to expire
    - `expired_at` string, date-time — When the key was actually expired
  - `workspace_id` string, uuid, required
  - `message` string — Optional message when no pending keys exist

## Other responses

- `400` — Cannot expire keys for protected workspace
- `401` — Unauthorized - Invalid or missing API key
- `403` — Forbidden - Insufficient permissions
- `404` — Not Found - Resource does not exist
- `429` — Too Many Requests - Rate limit exceeded

---

[API](https://skmtc.dev/firma/apis/firma-partner-api.md) · [All operations](https://skmtc.dev/firma/apis/firma-partner-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/firma/firma-partner-api/revisions/5c03d6a9d080/schema)
