---
title: Authentication/Authorization
slug: authenticationauthorization
docTags: 
createdAt: 2024-01-29T20:01:21.878Z
---

How to use the POST /login endpoint to authenticate and obtain an access token:

Endpoint URL: https\://yourapi.co&#x6D;**/api/login**

Request Method: POST



![](https://lh7-us.googleusercontent.com/zh_zBhLL-wwB6HEYaypLjfQUPvniaZdxVnTclTFW-KeqqJHTiVgfsuUxgKqXt5UhQrIJgOssSoYYYwWJXNks2YtsXkrUM3_OV5Fs6Diox2z8PN1ZQqhPyY5hShXMB2akIrxBO0QkJz7h_ZJCWp5Fp4w)

Request Body:

- email: The email address of the user trying to log in.
- password: The password of the user trying to log in.
- timezone: (optional) The timezone of the user trying to log in, (not required at all).

Response:

If the login is successful, the API returns a JSON response containing the following fields:



![](https://lh7-us.googleusercontent.com/ESd7eFB6ckCRxyoybWc9qS9eEmuRkmuvcjJs0szHj2HrUUZChl-ZX5BLMHUSWbFiC2VioFpiiteQSrUqgolJZxYamEq8MJ-e22HzJT3dI8_5bWTPDPmVP_sZIHi2URlLfD62GI319OSEPjA_aJtkmiU)

- status: The HTTP status code of the response.
- message: A message indicating whether the login was successful or not.
- data: An object containing user data like id, name, email, image, last\_login and login\_timezone.
- access\_token: A JWT access token that can be used to authenticate subsequent requests.
- refresh\_token: (optional) A JWT refresh token that can be used to obtain a new access token when the current one expires (expires every 30 days).



![](https://lh7-us.googleusercontent.com/_IGWLEMcT5u-QyDoJ516H1qD7HQKY941azplQviap-TwyBWKlFqCHjVfWBJyvm6AivWvjXeRibz4o8M1V79cQl-rCFOD8T0tfLu0SOMsSVP98cOG9epCHaXbVy0JB6KxW7OAnj2gT_bYWYYAg2wQXCM)

If the login fails, the API returns a JSON response containing the following fields:

- status: The HTTP status code of the response.
- message: A message indicating why the login failed.

Note: The access token returned by the API should be included in the Authorization header of subsequent requests, like so:



![](https://lh7-us.googleusercontent.com/9AkjknbJM5_k-nW6gHuDy3_uwDHW3qYJJBI6TSaxIe_NsOif2VwhpWOW7VaQJZ-ovBF7BFPHMDr-cR98tn9YMM5uvyyZNukc3Qwxa-KATbKL_Ej2NohcTc91j7poYsrpojV0m8wboKFjQDOu1cGNFeA)

Using this token on all requests should allow the authorized user to update data within the project.
