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

# Create a new personal access token

`POST /api/accounts/v1/tokens`

## Request body

- object
  - `label` string
  - `scopes` string[] — Scope ids to grant. Must be a subset of the registry at /scopes.
  - `durationDays` integer, nullable — PAT lifetime in days, between 1 and 365. Pass `null` to create a token with no expiration (discouraged - surface a UI warning).

## Response `201`

Personal access token created

## Other responses

- `400` — Invalid request
- `403` — Requested scopes are not grantable to this account
- `500` — Internal server error

---

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