---
title: "Create an API key for agents and scripts."
method: POST
path: "/api/account/keys/create"
---

# Create an API key for agents and scripts.

`POST /api/account/keys/create`

## Request

- Base URL: `https://okfindex.com`
- URL: `https://okfindex.com/api/account/keys/create`
- Auth: API key in cookie `__Host-mm-auth`

Needs a sign-in in the last 5 minutes; an organization key also needs a second factor in the session and the owner/admin role with this product enabled. At most 10 live keys per account and product. The key (`secret`) is returned ONCE.
Returns: { key, secret }

## Request body

- object
  - `name` string, required: Up to 60 characters.
  - `organizationId` string, nullable, required: `null` for an account key.

## Response `200`

{ key, secret }

- object
  - `key` object, required: `id`, `name`, `organizationId`, `last4`, `createdAt`.
  - `secret` string, required: `mmk_…`, shown once.

## Other responses

- `400`: invalid_key_name / invalid_organization
- `401`: invalid_session / reauth_required
- `403`: invalid_origin / invalid_csrf / organization_forbidden / organization_mfa_required
- `409`: key_limit_reached
- `503`: auth_unavailable

---

[API](https://skmtc.dev/okfindex/apis/okf-index.md) · [All operations](https://skmtc.dev/okfindex/apis/okf-index/llms.txt) · [OpenAPI document](https://skmtc.dev/okfindex/apis/okf-index/revisions/4b13ca3c739f?raw)
