---
title: "POST /users/{userId}/personal-access-tokens"
method: POST
path: "/users/{userId}/personal-access-tokens"
tags: ["users"]
---

# POST /users/{userId}/personal-access-tokens

`POST /users/{userId}/personal-access-tokens`

## Request

- Base URL: `https://YOUR_ORG_ID.gatana.ai/api/v1`
- URL: `https://YOUR_ORG_ID.gatana.ai/api/v1/users/{userId}/personal-access-tokens`
- Auth: one of:
  - HTTP bearer
  - OAuth 2
    - Authorization code: `/oauth/authorize`
    - Token URL: `/oauth/token`

Create a personal access token and return its API key using a browser session

## Path parameters

- `userId` string, required: ID of the user

## Request body

- CreatePersonalAccessTokenRequest
  - `name` string, required: Display name of the token
  - `profileIds` string[]

## Response `200`

Successful response

- Schema563
  - `token` PersonalAccessToken, required
    - `tenantId` string, required: ID of the tenant that owns the token
    - `userId` string, required: ID of the user the token belongs to
    - `id` string, required: Unique ID of the token
    - `name` string, required: Display name of the token
    - `apiKey` string, required: API key of the token
    - `profileIds` Schema559[], required: IDs of the profiles the token uses
    - `createdAt` string, required: Time when the token was created
    - `lastUsedAt` string, required

## Changes

- **2026-11-02** `2d7044033b1e`: 2 info
  - added `#/components/schemas/__schema562` to the `token/lastUsedAt` response property `anyOf` list for the response status `200`
  - removed `#/components/schemas/__schema558` from the `token/lastUsedAt` response property `anyOf` list for the response status `200`
- **2026-10-29** `239926952239`: 2 info
  - added `#/components/schemas/__schema558` to the `token/lastUsedAt` response property `anyOf` list for the response status `200`
  - removed `#/components/schemas/__schema556` from the `token/lastUsedAt` response property `anyOf` list for the response status `200`
- **2026-10-28** `4851c2492d4e`: 2 info
  - added `#/components/schemas/__schema556` to the `token/lastUsedAt` response property `anyOf` list for the response status `200`
  - removed `#/components/schemas/__schema540` from the `token/lastUsedAt` response property `anyOf` list for the response status `200`
- **2026-10-27** `b46fd7280302`: 2 info
  - added `#/components/schemas/__schema540` to the `token/lastUsedAt` response property `anyOf` list for the response status `200`
  - removed `#/components/schemas/__schema506` from the `token/lastUsedAt` response property `anyOf` list for the response status `200`
- …earlier changes not shown

[Operation history](https://skmtc.dev/gatana/apis/gatana/changes/users/:userId/personal-access-tokens/post.md)

---

[API](https://skmtc.dev/gatana/apis/gatana.md) - [All operations](https://skmtc.dev/gatana/apis/gatana/llms.txt) - [OpenAPI document](https://skmtc.dev/gatana/apis/gatana/revisions/2d7044033b1e?raw)
