# 3pm-backend route `createToken`

Paths are relative to the backend's origin (https://fleet.edgecr4ft.net, or your own 3pm-backend), not to this site. Index: https://3pm.edgecr4ft.net/docs/backend/api.md

---

tokens:
  claude: 406
  o200k: 256
# POST /api/buckets/{clusterId}/tokens (createToken)

Mint an enrollment token. The secret and its paste line are returned once.

- auth: an account — Authorization: Bearer 3pmu_<token>, or the dashboard's session cookie
- body: CreateToken (JSON)
- answer: TokenCreated (JSON)

## Types

```ts
interface CreateToken {
  /** Seconds; one hour by default. */
  ttl_s?: number;
  /** One by default. */
  uses?: number;
}

interface TokenCreated {
  /** The secret: returned once, never stored. */
  token: string;
  token_id: string;
  expires_at: EpochMs;
  uses: number;
  pre_approved: boolean;
  /** `3pm link <cluster> <token> ws://<advertise>` — what a human pastes on a host. */
  paste_line: string;
  /** The same link through the installer, for a host without 3pm (see `BucketToken.install_line`). */
  install_line: string;
}

/** Milliseconds since the Unix epoch. */
type EpochMs = number;
```
