---
title: "Create My Api Key"
method: POST
path: "/api/v1/api-keys"
tags: ["api-keys"]
---

# Create My Api Key

`POST /api/v1/api-keys`

Issue the caller a key. Plaintext is in this response and nowhere else.

``user_id`` and ``created_by`` are both the caller, which is the whole
difference from the admin route — every limit underneath (one live key,
the maximum lifetime, tenant membership) is the same code.

## Headers

- `authorization` string, nullable
- `X-API-Key` string, nullable

## Request body

- ApiKeySelfCreate — Self-serve create. No ``user_id``: the caller is always the subject. Accepting one here would be an admin endpoint wearing a caller-facing prefix.
  - `name` string, required
  - `expires_at` string, date-time, nullable

## Response `201`

Successful Response

- ApiKeyCreateResponse — Returned only from POST — the single time the plaintext key is exposed.
  - `id` integer, required
  - `name` string, required
  - `user_id` integer, required
  - `user_name` string, nullable
  - `user_email` string, nullable
  - `key_prefix` string, required
  - `expires_at` string, date-time, required
  - `last_used_at` string, date-time, nullable
  - `revoked_at` string, date-time, nullable
  - `status` 'active' | 'revoked' | 'expired', required
  - `created_by` integer, nullable
  - `created_at` string, date-time, required
  - `api_key` string, required

## Other responses

- `422` — Validation Error

## Changes

- **2026-08-28** `ce7abafbb050` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/ninjavan/apis/salesforce-sales-cloud-replacement/changes/api/v1/api-keys/post.md)

---

[API](https://skmtc.dev/ninjavan/apis/salesforce-sales-cloud-replacement.md) · [All operations](https://skmtc.dev/ninjavan/apis/salesforce-sales-cloud-replacement/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/ninjavan/salesforce-sales-cloud-replacement/revisions/ce7abafbb050/schema)
