---
title: "Change an API key's name, scope or sites"
method: PATCH
path: "/api/v1/account/keys/{id}"
tags: ["Account"]
---

# Change an API key's name, scope or sites

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

## Request

- Base URL: `https://api.dotsy.ai`
- URL: `https://api.dotsy.ai/api/v1/account/keys/{id}`
- Auth: HTTP bearer

Changes only the fields you send. The secret can't be changed, and the change applies to the key's next request.

## Path parameters

- `id` string, required

## Headers

- `X-Dotsy-Workspace` string

## Request body

- UpdateApiKeyRequest
  - `label` string, nullable: A new name. Send `null` or an empty string to clear it.
  - `scope` 'read' | 'write' | 'admin': `read` can only GET. `write` can also change sites. `admin` can also manage API keys.
  - `siteSlugs` string[]: Replace the site list. `[]` makes the key work on all sites. Each slug must be a site in this workspace.

## Response `200`

The key was updated.

- object
  - `ok` true, required

## Other responses

- `400`: `invalid_body`, or `site_not_found`: a slug in `siteSlugs` is not a site in this workspace.
- `401`: Missing or invalid credentials.
- `403`: `admin_required`: the key's scope is not `admin`. `workspace_admin_required`: you are a workspace Member, and only an Owner or Admin can manage keys. `guest_only`: this account can't create keys. `guest_requires_account`: a guest token can't manage keys.
- `404`: `key_not_found`: no such key in this workspace.

---

[API](https://skmtc.dev/dotsy/apis/dotsy-api.md) · [All operations](https://skmtc.dev/dotsy/apis/dotsy-api/llms.txt) · [OpenAPI document](https://skmtc.dev/dotsy/apis/dotsy-api/revisions/4272ed3b85d7?raw)
