---
title: "CreateApiKey creates a new API Key"
method: POST
path: "/users/v1/api/create"
tags: ["UsersMsgService"]
---

# CreateApiKey creates a new API Key

`POST /users/v1/api/create`

## Request

- Base URL: `https://backend.pay.kiichain.io`
- URL: `https://backend.pay.kiichain.io/users/v1/api/create`
- Auth: one of:
  - API key in header `Authorization`
  - OAuth 2
    - Password
    - Token URL: `https://backend.pay.kiichain.io/users/v1/auth/login` scopes: `accounts.kyc.read`, `accounts.kyc.read:all`
- TypeScript: <https://skmtc.dev/kiiglobal/apis/kiichain-pay-backend/docs/users/v1/api/create/post.ts> (a function with typed inputs; its response is checked against the schema)

priv_key is returned only once, in this response. It isn't stored and
can't be retrieved again, only rotated via RotateApiKey

## Request body

- V1CreateApiKeyRequest
  - `expiresAt` string, date-time
  - `name` string, required
  - `scopes` string[], required

## Response `200`

A successful response.

- V1CreateApiKeyResponse
  - `apiKey` string, required
  - `privKey` string, required

## Other responses

- `default`: An unexpected error response. `details[0]` is always an AppError, see #/components/schemas/AppError

---

[API](https://skmtc.dev/kiiglobal/apis/kiichain-pay-backend.md) - [All operations](https://skmtc.dev/kiiglobal/apis/kiichain-pay-backend/llms.txt) - [OpenAPI document](https://skmtc.dev/kiiglobal/apis/kiichain-pay-backend/revisions/8951249f5b63?raw)
