# 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)

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.privateadserver.com/api-refrence/authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
