---
title: "Get a user token"
method: POST
path: "/auth/user_token"
tags: ["Authentication"]
---

# Get a user token

`POST /auth/user_token`

Use this endpoint to create a user token for a specific user.
This token can be safely passed to your user-facing front-end.

## Request body

- UserTokenRequest
  - `user_id` string, required
  - `origin` string, nullable — Origin of the request, used for CSRF protection. If set, the token will only be valid for requests originating from this origin.
  - `expires_in` string, nullable — Token lifetime, e.g., '30m', '2h', '1d'. Defaults to 24 hours if not provided.

## Response `200`

Successful Response

- UserTokenResponse
  - `token` string, required
  - `expires_at` string, date-time, required

## Other responses

- `422` — Validation Error

---

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