---
title: "Create a new api token"
method: PUT
path: "/tokens"
tags: ["api"]
---

# Create a new api token

`PUT /tokens`

Create a new api token to use on behalf of the user creating it.

## Request body

- ModelsAPIToken
  - `created` string — A timestamp when this api key was created. You cannot change this value.
  - `expires_at` string — The date when this key expires.
  - `id` integer — The unique, numeric id of this api key.
  - `owner_id` integer — The user ID of the token owner. When creating a token for a bot user, set this to the bot's ID. If omitted, defaults to the authenticated user.
  - `permissions` ModelsAPIPermissions
  - `title` string — A human-readable name for this token
  - `token` string — The actual api key. Only visible after creation.

## Response `201`

The created token.

- ModelsAPIToken
  - `created` string — A timestamp when this api key was created. You cannot change this value.
  - `expires_at` string — The date when this key expires.
  - `id` integer — The unique, numeric id of this api key.
  - `owner_id` integer — The user ID of the token owner. When creating a token for a bot user, set this to the bot's ID. If omitted, defaults to the authenticated user.
  - `permissions` ModelsAPIPermissions
  - `title` string — A human-readable name for this token
  - `token` string — The actual api key. Only visible after creation.

## Other responses

- `400` — Invalid token object provided.
- `500` — Internal error

## Changes

- **2026-07-18** `b03f30dcad8e` — 1 breaking, 1 info
  - removed the success response with the status `200`
  - added the success response with the status `201`

[Change history](https://skmtc.dev/go-vikunja/apis/vikunja-api/changes/tokens/put.md)

---

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