---
title: "Create a new authentication token"
method: POST
path: "/api/auth"
tags: ["authentication"]
---

# Create a new authentication token

`POST /api/auth`

Creates a new authentication token that is returned via the 'renterd_auth' cookie which is set by the server and the json response body. The token can be used as a cookie or as the 'apikey' query parameter for authentication.

## Query parameters

- `validity` integer, required — A duration in milliseconds

## Response `200`

Successfully created a new token

- object
  - `token` string — A hex-encoded string representing the token

## Other responses

- `400` — Bad request

---

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