---
title: "Create a personal access token"
method: POST
path: "/api/v1/me/api-tokens"
tags: ["api-tokens"]
---

# Create a personal access token

`POST /api/v1/me/api-tokens`

## Request

- Base URL: `https://api.izap.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.izap.ai/api/v1/me/api-tokens`
- Auth: HTTP bearer

Issues a new personal access token for the authenticated user. The token value appears exactly once, in this response — store it before discarding the response, because it cannot be retrieved again.

## Request body

- CreateTokenRequest: Mint a new token. ``expires_in_days`` omitted/null means it never expires.
  - `name` string, required: Human-readable label for the token.
  - `expires_in_days` integer, nullable: Days until the token expires. Null for a non-expiring token.
  - `scopes` string[], nullable: Optional permission scopes (``Permission`` enum values). Omitted or empty means full access within the credential's normal permissions.

## Response `201`

Successful Response

- TokenCreatedResponse: Returned once at creation — the only time the plaintext ``token`` is exposed.
  - `id` string, uuid, required
  - `name` string, required
  - `token_prefix` string, required: Non-secret leading chars, e.g. 'izap_pat_AbC'.
  - `last_four` string, nullable: Last four chars of the token, for recognition.
  - `scopes` string[], nullable: Permission scopes. Null means full access within the credential's normal permissions.
  - `expires_at` string, date-time, nullable, required
  - `revoked` boolean, required
  - `last_used_at` string, date-time, nullable, required
  - `created` string, date-time, required
  - `token` string, required: The plaintext token. Store it now; it cannot be retrieved again.

## Other responses

- `401`: Missing or invalid credentials.
- `403`: The credential is valid but not authorized for this action.
- `422`: Validation Error
- `default`: Unexpected error.

---

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