---
title: "User login"
method: POST
path: "/api/v1/auth/login"
tags: ["Authentication"]
---

# User login

`POST /api/v1/auth/login`

## Request

- Base URL: `http://miner`
- URL: `http://miner/api/v1/auth/login`
- Auth: none declared
- TypeScript: <https://skmtc.dev/256foundation/apis/braiins-os-public-rest-api/docs/api/v1/auth/login/post.ts> (a function with typed inputs; its response is checked against the schema)

Authenticates a user using their username and password. If the credentials are valid, a token is returned, which should be included in the `Authorization` header of subsequent requests.

## Request body

- LoginRequest: Request for login action.
  - `password` string, required
  - `username` string, required

## Response `200`

Successful login. Returns an authentication token.

- LoginResponse: Response for login action.
  - `timeout_s` integer, required: Authentication token validity/timeout in seconds. Token validity refreshed to this value with each request.
  - `token` string, required: Token to be used for authentication

---

[API](https://skmtc.dev/256foundation/apis/braiins-os-public-rest-api.md) - [All operations](https://skmtc.dev/256foundation/apis/braiins-os-public-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/256foundation/apis/braiins-os-public-rest-api/revisions/d341c8e1d506?raw)
