---
title: "Login a user account"
method: POST
path: "/api/accounts/login/"
tags: ["accounts"]
---

# Login a user account

`POST /api/accounts/login/`

## Request

- Base URL: `https://docs.blindinsight.io` (the document declares no server; this is the origin it was published from)
- URL: `https://docs.blindinsight.io/api/accounts/login/`
- Auth: one of:
  - API key in cookie `sessionid`
  - HTTP basic
  - HTTP bearer
  - none
- TypeScript: <https://skmtc.dev/blindinsight/apis/blind-insight-rest-api/docs/api/accounts/login/post.ts> (a function with typed inputs; its response is checked against the schema)

Log in a user using their email and password. On success, returns a JSON web
token which should be included in the `Authorization` header for all subsequent
API requests in client implementations.

The response will be a detail message indicating if the login was successful.

**On the command line:**

```bash
blind accounts login --data login.json
```

## Request body

- DefaultLogin: Default serializer used for user login. Please keep in mind that the authentication is done by separate function defined by :ref:`login-authenticator-setting` setting. By default :ref:`login-authenticator-setting` function will use :ref:`user-login-fields-setting` setting to extract the login field from the validated serializer data either by using the 'login' key (which is used here) or the specific login field name(s) (e.g. 'username', 'email'). If you want different behavior, you need to override :ref:`login-authenticator-setting` in your settings.
  - `login` string, required
  - `password` string, required

## Response `200`

- LoginSuccessful
  - `detail` string

## Other responses

- `400`

---

[API](https://skmtc.dev/blindinsight/apis/blind-insight-rest-api.md) - [All operations](https://skmtc.dev/blindinsight/apis/blind-insight-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/blindinsight/apis/blind-insight-rest-api/revisions/0ac902401cea?raw)
