---
title: "Update an API key"
method: PATCH
path: "/v1/api-keys/{id}"
tags: ["API Keys"]
---

# Update an API key

`PATCH /v1/api-keys/{id}`

Updates an API key identified by `id`. Only the provided fields are changed.

## Path parameters

- `id` integer, required

## Request body

- ApiKeyUpdateRequest — Fields to update on an API key. All fields are optional; only the provided fields are changed.
  - `active` boolean — Indicates whether the API key is active.
  - `restricted` boolean — Indicates whether the API key is restricted to the listed permitted IPs.
  - `scopes_enabled` boolean — Indicates whether per-resource scope permissions are enforced for the API key.
  - `permitted_ips` string[] — IP addresses allowed to use the API key when restriction is enabled.
  - `label` string — Human-readable label for the API key.
  - `numbers` ApiKeyScopePermission — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `trunks` ApiKeyScopePermission — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `calls` ApiKeyCallsScopePermission — Permission level for the `calls` scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET requests, `POST /v1/cdrs` - `write`: all methods (includes read)
  - `messages` ApiKeyScopePermission — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `recordings` ApiKeyScopePermission — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `campaigns` ApiKeyScopePermission — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `two_fa` ApiKeyScopePermission — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `validator` ApiKeyScopePermission — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `webhooks` ApiKeyScopePermission — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `embeddable` ApiKeyScopePermission — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `billing` ApiKeyScopePermission — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `account` ApiKeyScopePermission — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `subaccounts` ApiKeyScopePermission — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)

## Response `200`

Returns the updated API key.

- ApiKey — API key details including IP restrictions and scope permissions.
  - `id` integer, required — API key ID.
  - `label` string, required — API key label.
  - `value` string, required — API key value.
  - `active` boolean, required — Indicates whether the API key is active.
  - `restricted` boolean, required — Indicates whether IP restrictions are enabled. When enabled, the API key works only from IP addresses in `permitted_ips`.
  - `permitted_ips` string[], required — List of permitted IP addresses. If `restricted` is false, an empty list means no IP restrictions. If `restricted` is true, an empty list prevents all requests.
  - `scopes_enabled` boolean, required — When `true`, the key is restricted to the permissions defined in the scope fields below. When `false`, the key has full access.
  - `last_used_at` string, date-time, nullable, required — Timestamp of the most recent authenticated request made with this key.
  - `numbers` ApiKeyScopePermission, required — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `trunks` ApiKeyScopePermission, required — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `calls` ApiKeyCallsScopePermission, required — Permission level for the `calls` scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET requests, `POST /v1/cdrs` - `write`: all methods (includes read)
  - `messages` ApiKeyScopePermission, required — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `recordings` ApiKeyScopePermission, required — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `campaigns` ApiKeyScopePermission, required — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `two_fa` ApiKeyScopePermission, required — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `validator` ApiKeyScopePermission, required — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `webhooks` ApiKeyScopePermission, required — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `embeddable` ApiKeyScopePermission, required — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `billing` ApiKeyScopePermission, required — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `account` ApiKeyScopePermission, required — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `subaccounts` ApiKeyScopePermission, required — Permission level for an API key scope group.
    - `allow` 'none' | 'read' | 'write' — Permission level: - `none`: no access - `read`: GET only - `write`: all methods (includes read)
  - `created_at` string, date-time, required — Creation date and time in ISO 8601 format.

## Other responses

- `400` — Request failed. Missing or invalid parameter <param_name>
- `401` — Unauthorized
- `403` — Request failed. The feature is disabled for your account.
- `404` — Request failed. An object with the specified ID is not found.
- `422` — Validation error

---

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