> For the complete documentation index, see [llms.txt](https://docs.privateadserver.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.privateadserver.com/api-refrence/authentication.md).

# Authentication

### Authenticating and Obtaining a Token&#x20;

To authenticate and receive an authorization token, make a POST request to the following address

```
https://dashboard.qntv.io/api/signin/ 
```

### Request

Request should have a JSON body containing your email and password.

```json
{
    "email":"you@youremail.com",
    "password":"yourpassword"
}
```

### **Response**

* **Successful Authentication (200 OK)**: The response will include a JSON with the user's token and details.
* **Failed Authentication (401 Unauthorized)**: Indicates incorrect credentials.

```json
{
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6...",
    "user": {
        "ID": 1,
        "userID": 1,
        "createdAt": "2023-05-15T08:52:09.15693Z",
        "updatedAt": "2023-05-15T08:52:09.163817Z",
        "DeletedAt": null,
        "accountID": 1,
        "name": "You",
        "email": "you@youremail.com",
        "status": 1,
        "role": 1
    }
}
```

### Usage

Use the obtained token for subsequent authenticated requests to the ad server's API.\
The server is using the autherization header, each request shosuld contain the header with the obtained token like in the following example:

```
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6...
```

### Examples

#### CURL

```bash
curl -X POST https://dashboard.qntv.io/api/signin/ \
     -H "Content-Type: application/json" \
     -d '{"email": "you@youremail.com", "password": "yourpassword"}'

```

#### Python Example

```python
import requests
import json

url = "https://dashboard.qntv.io/api/signin/"
data = {"email": "you@youremail.com", "password": "yourpassword"}

response = requests.post(url, json=data)

if response.status_code == 200:
    token = response.json()['token']
    # Use token for further authenticated requests
else:
    print("Authentication failed with status code:", response.status_code)

```
