# Authorization

You can use the same username and password as the portal access to obtain an API token.  Each user is associated with a role.  The API token will let the server knows the role and permission of the user.&#x20;

Here is how you can obtain authorization token:

## This API let you obtain auth token to access the switch.

<mark style="color:blue;">`GET`</mark> `https://{base_url}/api_dnl/v1/auth`

#### Query Parameters

| Name                   | Type    | Description                             |
| ---------------------- | ------- | --------------------------------------- |
| expire\_after\_minutes | integer | duration of the expiration of the token |

#### Headers

| Name                                              | Type   | Description          |
| ------------------------------------------------- | ------ | -------------------- |
| email\_or\_name<mark style="color:red;">\*</mark> | String | username of the user |
| password<mark style="color:red;">\*</mark>        | String | password of the user |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  "email_or_name": "string",
  "expire_after_minutes": 0,
  "password": "string"
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
 {
  "success": false,
  "error_type": "operation_error",
  "error": {
    "message": "string",
    "code": 0,
    "reason": "string"
  }
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
  "success": true,
  "payload": {
    "expired": "string",
    "token": "string"
  }
}
```

{% endtab %}
{% endtabs %}


---

# 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://cookbook.denovolab.com/class-4-api/authorization.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.
