---
title: "Issue an API key"
method: POST
path: "/v1/api-keys"
tags: ["Workspace"]
---

# Issue an API key

`POST /v1/api-keys`

## Request

- Base URL: `https://www.chatrail.dev`
- URL: `https://www.chatrail.dev/v1/api-keys`
- Auth: API key in cookie `chatrail_session`

Returns the key **exactly once**. It is stored only as a hash and cannot be recovered. A key may never hold more than the person issuing it.

## Request body

- object
  - `name` string, required
  - `scopes` string[], required
  - `environment` 'live' | 'test'

## Response `201`

The key, once.

## Other responses

- `403`: Your role cannot grant those scopes.

---

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