---
title: "Create an API key for a workspace. The plaintext key is in this response only; scopes must be a subset of the caller's."
method: POST
path: "/v1/workspaces/{ws}/api-keys"
tags: ["apiKeys"]
---

# Create an API key for a workspace. The plaintext key is in this response only; scopes must be a subset of the caller's.

`POST /v1/workspaces/{ws}/api-keys`

## Request

- Base URL: `https://api.storequant.com`
- URL: `https://api.storequant.com/v1/workspaces/{ws}/api-keys`
- Auth: HTTP bearer

Create an API key for a workspace. The plaintext key is in this response only; scopes must be a subset of the caller's. Scope `apiKeys:write`; cache `none`.

## Path parameters

- `ws` string, required

## Request body

- object
  - `name` string, required
  - `scopes` string[], required

## Response `201`

Success.

- object
  - `data` object, required
    - `id` string, uuid, required
    - `name` string, required
    - `key_prefix` string, required
    - `scopes` string[], required
    - `last_used_at` string, date-time, nullable, required
    - `expires_at` string, date-time, nullable, required
    - `revoked_at` string, date-time, nullable, required
    - `created_at` string, date-time, required
    - `key` string, required
  - `meta` object, required
    - `request_id` string, required
    - `as_of` string, date-time, required
    - `lag_hours` number
    - `cursor` string
    - `count` integer

## Other responses

- `4XX`: The one error shape.
- `5XX`: The one error shape.

---

[API](https://skmtc.dev/scrollstash/apis/storequant-api.md) · [All operations](https://skmtc.dev/scrollstash/apis/storequant-api/llms.txt) · [OpenAPI document](https://skmtc.dev/scrollstash/apis/storequant-api/revisions/4d67a114a13c?raw)
