# Generate Authorize Token

### Request Method

POST

### Request URL

```url
{{BASE_URL}}/api/Login/VerifyLogin
```

{% hint style="info" %}
Replace the `{{BASE_URL}}` with the one mentioned [here](https://zatcaportalapidocs.evinciblesolutions.com/e-invoicing-ksa-api) based on whether you are using sandbox or production.
{% endhint %}

### Request Body

<table><thead><tr><th>Parameter</th><th>Data Type</th><th>Validations and Example</th><th>Description</th></tr></thead><tbody><tr><td>Username</td><td>string</td><td><pre><code>3xxxxxxxxxxxxx3
</code></pre></td><td>Mandatory. VAT of the company</td></tr><tr><td>Password</td><td>string</td><td><pre><code>acde2754BD
</code></pre></td><td>Mandatory. portal password</td></tr></tbody></table>

### Sample Request

```json
{
    "Username": "3xxxxxxxxxxxxx3",
    "Password": "acde2754BD"
}
```

### Response Status Codes

| HTTP Status Code | Description                                         |
| ---------------- | --------------------------------------------------- |
| 200              | For a successful token generation.                  |
| 400              | For any kind of validation issues.                  |
| 401              | If the user is not authenticated for the operation. |
| 403              | If the user is not authorized for the operation.    |

### Response Schema

<table><thead><tr><th width="225.66666666666669">Parameter</th><th>Data Type</th><th>Description</th></tr></thead><tbody><tr><td>tokenString</td><td>String</td><td>Mandatory. used to authorise other APIs (as a bearer token)</td></tr><tr><td>validTo</td><td>String</td><td>Mandatory. token validity date and time</td></tr></tbody></table>

### Sample Response

Success - HTTP Status Code - 200

```json
{
    "tokenString": "eyJhbGciOiJI...",
    "validTo": "2025-01-09T07:29:27Z"
}
```

Error - HTTP Status Code - 400

```json5
{
    "response": "User Not Found"
}
```

### API Validations

1. The VAT for which the device is being registered needs to be already present in Evs Engine before making this API request.

### API Constraints

1. This API needs to be authenticated with a valid user name or vat number and password. If it is not present or is invalid, the API will return HTTP Status Code 400.
