# Get Your API Authorization Token

The **Get Authorisation Token API** is a critical step for authenticating all subsequent API requests. This token ensures secure communication by verifying the legitimacy of the requesting source.  

## <span style="color:#7b2cbf">Purpose</span>  
The API generates an **authentication token** that must be included in the headers of all subsequent API requests. This token acts as proof of authorization and helps maintain secure interactions with Enkash servers.  


<Container>
  ## <span style="color:#7b2cbf">Endpoint</span>  

| **Environment** | **Endpoint URL**                                |  
|------------------|------------------------------------------------|  
| **Test**         | `https://olympus-pg-uat.enkash.in/api/v0/merchant/token` |  

</Container>


<Container>
  ## <span style="color:#7b2cbf">Request Headers</span>   

| **Header**       | **Value**                     | **Description**                                      |  
|-------------------|-------------------------------|----------------------------------------------------|  
| `Content-Type`    | `application/json`           | Specifies the media type of the request body.      |    

#### **Sample Request**:  

```json  
POST https://olympus-pg-uat.enkash.in/api/v0/merchant/token  
Headers:  
{  
  "Content-Type": "application/json"
}  
```  

</Container>


<Container>
  ## <span style="color:#7b2cbf">Response</span>  

Upon a successful request, the server will return a JSON object containing the generated token and additional details:  

| **Field**        | **Type**         | **Description**                                                    |  
|-------------------|------------------|--------------------------------------------------------------------|  
| `token`          | `string`         | The generated authentication token                               |  
| `expiry`         | `integer (int64)`| Token expiration time in milliseconds                            |  
| `resultCode`     | `integer (int32)`| Status code indicating the outcome of the token generation request |  
| `resultMessage`  | `string`         | Additional information about the request's result                |  


#### **Sample Response**:  

```json  
{  
  "token": "abcdef1234567890",  
  "expiry": 1672531199000,  
  "resultCode": 200,  
  "resultMessage": "Token generated successfully."  
}  
```  
</Container>


<Container>
  ## <span style="color:#7b2cbf">Integration Notes</span>   

The token must be included in the `Authorization` header for all subsequent API requests
  ```  
  Authorization: {token}  
  ```  

<TipGood>Ensure you handle token expiration by either:</TipGood>
    <TipGood>Monitoring the expiry timestamp and refreshing the token in advance</TipGood>
 <TipGood>Implementing retry logic for requests that fail due to expired tokens</TipGood>
   
</Container>



