---
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

---

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