---
title: "Login"
method: POST
path: "/auth/login"
tags: ["Authentication"]
---

# Login

`POST /auth/login`

Login to the service and retrieve a session token for authentication.

## Request body

- AuthLogin — Request body for logging in.
  - `username` string, required
  - `password` string, password, required

## Response `200`

Success

## Other responses

- `400` — 400 Bad Request.
- `401` — 401 Unauthorised.
- `500` — 500 Unexpected Internal Server Error.

## Changes

- **2024-09-04** `251a51c1c932` — 4 warning
  - the optional response header `X-API-Commit` removed for the status `200`
  - the optional response header `X-API-Commit` removed for the status `400`
  - the optional response header `X-API-Commit` removed for the status `401`
  - the optional response header `X-API-Commit` removed for the status `500`
- **2024-06-30** `860d419093ef` — 2 info
  - api tag `Authentication` added
  - api tag `auth` removed
- **2024-06-20** `9dea16a31110` — 1 info
  - removed the non-success response with the status `404`
- **2024-06-19** `2b9ace56ec4a` — 1 breaking
  - the `username` request property's maxLength was decreased to `48`
- **2024-01-12** `9d667e94e36f` — 1 breaking, 1 warning, 1 info
  - added the new required request property `username`
  - removed the request property `email`
  - the `password` request property's minLength was decreased from `8` to `5`

[Full history](https://skmtc.dev/medama-io/apis/medama-analytics-api/changes/auth/login/post.md)

---

[API](https://skmtc.dev/medama-io/apis/medama-analytics-api.md) · [All operations](https://skmtc.dev/medama-io/apis/medama-analytics-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/medama-io/medama-analytics-api/revisions/77bbbf562f15/schema)
