---
title: "Create Token"
method: POST
path: "/api/v1/tokens"
tags: ["API Tokens"]
---

# Create Token

`POST /api/v1/tokens`

## Request

- Base URL: `https://public-api.linearb.io`
- URL: `https://public-api.linearb.io/api/v1/tokens`
- Auth: API key in header `x-api-key`
- TypeScript: <https://skmtc.dev/linearb/apis/linearb-api/docs/api/v1/tokens/post.ts> (a function with typed inputs; its response is checked against the schema)

Create an API token owned by the calling account. The token value is returned once, in this response only.

## Request body

- TokenCreateRequest
  - `name` string, required: Display name of the token.
  - `expires_at` string, date, nullable: The day the token stops working (UTC, YYYY-MM-DD only). Must be after today and at most 2 years ahead. Omit for no expiry.

## Response `200`

Successful Response

## Other responses

- `201`: Successful Response
- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden - only admins can manage tokens
- `404`: Not Found
- `405`: Method Not Allowed
- `409`: Conflict
- `422`: Validation Error
- `500`: Internal Server Error
- `504`: Gateway Timeout

---

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