---
title: "Update API key"
method: PUT
path: "/v4/account/api-keys/{id}"
---

# Update API key

`PUT /v4/account/api-keys/{id}`

Update an API key's name, permissions, allowed_subaccounts, allowed_ips, expires_at, or is_active. The response includes an `updated_fields` array showing which fields changed. You cannot update the API key currently being used to authenticate the request — doing so returns 409. Note: sending an empty `permissions` array is silently ignored — permissions cannot be cleared via this endpoint. Permission: `account:apikeys:update`.

## Path parameters

- `id` string, uuid, required

## Request body

- object — At least one field must be provided.
  - `name` string
  - `permissions` string[] — Array of permission strings. Empty arrays are silently ignored — permissions cannot be cleared via this endpoint.
  - `allowed_subaccounts` string[] — Subaccount UUIDs this key can act on. Empty array means all subaccounts.
  - `allowed_ips` string[] — IP addresses or CIDR ranges allowed to use this key. Empty array means no IP restriction.
  - `expires_at` integer, nullable — Unix timestamp for key expiry. Must be in the future.
  - `is_active` boolean — Enable or disable the key without deleting it.

## Response `200`

Updated API key

- object
  - `success` boolean
  - `message` string
  - `data` object
    - `id` string, uuid
    - `name` string
    - `permissions` string[]
    - `allowed_subaccounts` string[]
    - `allowed_ips` string[]
    - `expires_at` integer, nullable
    - `is_active` boolean
    - `last_used_at` integer, nullable — Unix timestamp of when the key was last used. Null if never used.
    - `token_preview` string, nullable
    - `created_at` integer — Unix timestamp of when the key was created.
    - `updated_fields` string[]

## Other responses

- `401` — Unauthorized
- `403` — Permission not allowed for your account, or permission escalation attempt
- `404` — API key not found
- `409` — Cannot update the API key currently in use
- `422` — Validation error — invalid permissions, invalid subaccounts, invalid IPs, or no fields provided
- `500` — Internal server error

---

[API](https://skmtc.net/proxyscrape/apis/proxyscrape-account-api.md) · [All operations](https://skmtc.net/proxyscrape/apis/proxyscrape-account-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/proxyscrape/proxyscrape-account-api/versions/4e10267785e1/schema)
