---
title: "auth token"
method: POST
path: "/v1/auth/token"
tags: ["v1", "auth"]
---

# auth token

`POST /v1/auth/token`

#### Controller: 

`github.com/ubccr/grendel/internal/api.(*Handler).AuthToken`

#### Middlewares:

- `github.com/go-fuego/fuego.defaultLogger.middleware`
- `github.com/ubccr/grendel/internal/api.(*Handler).authMiddleware`

---

Create API token

## Headers

- `Accept` string

## Request body

- AuthTokenRequest — AuthTokenRequest schema
  - `expire` string — string parsed by time.ParseDuration, examples include: infinite, 8h, 30m, 20s
  - `role` string — type of model.Role, valid options: disabled, user, admin
  - `username` string — username shown in logs, does not need to be a valid user in the DB

## Response `200`

OK

- AuthTokenReponse — AuthTokenReponse schema
  - `token` string

## Other responses

- `default` — Default Error

---

[API](https://skmtc.net/ubccr/apis/grendel-api.md) · [All operations](https://skmtc.net/ubccr/apis/grendel-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/ubccr/grendel-api/versions/cd871b115a7b/schema)
