---
title: "Mint a Codex access token"
method: POST
path: "/api/codex/tokens"
tags: ["Codex Tokens"]
---

# Mint a Codex access token

`POST /api/codex/tokens`

## Request body

- CodexTokenMintRequest
  - `expires_at` string
  - `name` string, required
  - `workspace_id` string, required

## Response `201`

Created

- CodexTokenMintResponse
  - `created_at` string, required
  - `expires_at` string, required
  - `id` string, required
  - `name` string, required
  - `token` string, required
  - `workspace_id` string, required

## Other responses

- `400` — invalid JSON
- `401` — unauthorized
- `403` — not a member of this workspace
- `422` — workspace_id and name are required / expires_at invalid
- `500` — internal error

## Changes

- **2026-05-22** `7ddccc8c8dd1` — 1 warning, 1 info
  - removed the request property `ttl_days`
  - added the new optional request property `expires_at`
- **2026-05-22** `467ad8850696` — 1 info
  - endpoint added
- **2026-05-22** `1ba39f384b63` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/agentserver/apis/agentserver-api/changes/api/codex/tokens/post.md)

---

[API](https://skmtc.dev/agentserver/apis/agentserver-api.md) · [All operations](https://skmtc.dev/agentserver/apis/agentserver-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/agentserver/agentserver-api/revisions/e8c329825b4e/schema)
