---
title: "Issue a new spanning personal access token (plaintext returned once)."
method: POST
path: "/api/me/api-tokens"
tags: ["Me"]
---

# Issue a new spanning personal access token (plaintext returned once).

`POST /api/me/api-tokens`

## Request

- Base URL: `https://hiveship.app/api`
- URL: `https://hiveship.app/api/api/me/api-tokens`
- Auth: API key in cookie `hiveship_access`

## Request body

- object
  - `name` string, required
  - `scopes` string[], required
  - `expiresInDays` integer, nullable

## Response `201`

Created spanning token with plaintext secret

- object
  - `success` boolean, required
  - `data` object, required
    - `id` string, cuid, required
    - `name` string, required
    - `tokenHint` string, required
    - `scopes` string[], required
    - `lastUsedAt` string, date-time, nullable, required
    - `revokedAt` string, date-time, nullable, required
    - `expiresAt` string, date-time, nullable, required
    - `userId` string, cuid, required
    - `workspaceId` string, cuid, nullable, required
    - `createdAt` string, date-time, required
    - `token` string, required

## Other responses

- `400`: Validation error
- `409`: Spanning PAT cap reached or duplicate name

---

[API](https://skmtc.dev/hiveship/apis/hiveship-api.md) · [All operations](https://skmtc.dev/hiveship/apis/hiveship-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hiveship/apis/hiveship-api/revisions/73d3e26544e4?raw)
