> For the complete documentation index, see [llms.txt](https://docs.peakcommerce.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.peakcommerce.com/developers/admin-api/admin-api-keys.md).

# API Keys

Create, list, rotate, and revoke tenant API keys. All of these endpoints require a key with the `admin` scope. This is also the only way to mint **narrow-scoped** keys — the Settings → API Keys screen creates coarse single-scope keys, while this API accepts any combination from the full scope vocabulary. See [Authentication](/developers/api-reference/authentication.md) for how the scopes expand.

Accepted `scopes` values:

* `read` — coarse: read everything the coarse v1 surface exposes.
* `commerce` — coarse: `read` plus the cart/checkout commerce surface.
* `admin` — coarse: everything, including every narrow scope below.
* `journeys:read` — read journeys.
* `journeys:write` — create and edit journeys (implies `journeys:read`).
* `journeys:publish` — publish, deactivate, or delete live journeys (implies `journeys:read`).
* `journeys:delete` — delete draft or archived journeys (implies `journeys:read`).
* `pages:read` — read pages.
* `pages:write` — create and edit pages (implies `pages:read`).
* `pages:publish` — publish or unpublish pages (implies `pages:read`).
* `pages:delete` — delete pages (implies `pages:read`).
* `components:read` — read components.
* `components:write` — create and edit components (implies `components:read`).
* `components:delete` — delete components (implies `components:read`).
* `productsets:read` — read product sets.
* `productsets:write` — create and edit product sets that are not active (implies `productsets:read`).
* `productsets:publish` — activate or deactivate a product set, and edit an active one (implies `productsets:read`).
* `productsets:delete` — delete product sets (implies `productsets:read`).
* `rules:read` — read business rules.
* `rules:write` — create, edit, attach and detach business rules; rules have no draft, so changes take effect immediately (implies `rules:read`).
* `rules:delete` — delete business rules (implies `rules:read`).
* `catalog:read` — read catalog products (the one narrow read that coarse `read`/`commerce` keys expand to).
* `catalog:write-native` — create and edit products authored in PeakCommerce (implies `catalog:read`).
* `context:read` — read personas, integrations (never their credentials) and host routes.

## Endpoints

### `GET /api/v1/api-keys`

{% openapi src="<https://api.peakcommerce.app/api/v1/openapi.json>" path="/api-keys" method="get" %}
<https://api.peakcommerce.app/api/v1/openapi.json>
{% endopenapi %}

*Notes, examples, or caveats for `GET /api-keys` go here.*

### `POST /api/v1/api-keys`

{% openapi src="<https://api.peakcommerce.app/api/v1/openapi.json>" path="/api-keys" method="post" %}
<https://api.peakcommerce.app/api/v1/openapi.json>
{% endopenapi %}

`scopes` is an array drawn from the values listed in the overview above (defaults to `["read"]`). One key may hold several narrow scopes — e.g. `["journeys:read", "journeys:write", "pages:read"]`. Remember `publish` is never implied by `write`: grant it explicitly only to keys that should change what is live. Narrow-scoped keys appear on the Settings → API Keys screen but are edited through this API so their grants aren't collapsed by the screen's single-scope picker.

### `DELETE /api/v1/api-keys/{id}`

{% openapi src="<https://api.peakcommerce.app/api/v1/openapi.json>" path="/api-keys/{id}" method="delete" %}
<https://api.peakcommerce.app/api/v1/openapi.json>
{% endopenapi %}

*Notes, examples, or caveats for `DELETE /api-keys/{id}` go here.*

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

{% openapi src="<https://api.peakcommerce.app/api/v1/openapi.json>" path="/api-keys/{id}" method="patch" %}
<https://api.peakcommerce.app/api/v1/openapi.json>
{% endopenapi %}

*Notes, examples, or caveats for `PATCH /api-keys/{id}` go here.*

### `POST /api/v1/api-keys/{id}/rotate`

{% openapi src="<https://api.peakcommerce.app/api/v1/openapi.json>" path="/api-keys/{id}/rotate" method="post" %}
<https://api.peakcommerce.app/api/v1/openapi.json>
{% endopenapi %}

Rotation preserves the key's full scope set — including narrow scopes — so it is always safe for narrow-scoped keys.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.peakcommerce.com/developers/admin-api/admin-api-keys.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
