---
title: "Exchange credentials for an API key"
method: POST
path: "/api/v1/api-keys"
tags: ["API keys"]
---

# Exchange credentials for an API key

`POST /api/v1/api-keys`

## Request

- Base URL: `https://app.khotan.com`
- URL: `https://app.khotan.com/api/v1/api-keys`
- Auth: none declared

Authenticates with email + password and mints an organization-scoped API key. Strictly rate limited.

## Request body

- object
  - `email` string, email, required
  - `password` string, required
  - `organizationId` string, required
  - `name` string
  - `role` 'owner' | 'admin' | 'developer' | 'member'
  - `expiresInDays` integer

## Response `201`

The minted API key (the secret is returned only once).

- object
  - `key` string, required
  - `id` string, required
  - `name` string, nullable, required
  - `prefix` string, nullable, required
  - `organizationId` string, required
  - `role` 'owner' | 'admin' | 'developer' | 'member', required
  - `expiresAt` string, nullable, required

## Other responses

- `400`: The request was malformed or failed validation.
- `401`: Authentication is missing or invalid.
- `403`: The caller is not permitted to perform this action.
- `429`: Too many requests; retry after the indicated delay.

---

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