# Auth API

### Access Tokens

**UI -** This page shows how to get the access token using the authentication credentials. Masters India supports access-token-based authentication. once a user hits the login button, our API generates an access\_token and a refresh token for a user after validating his credentials.

**API -** This token needs to be passed in the subsequent requests to avoid permission or access issues. To generate the Authorization token by clicking on the Send button. Once the Token Is generated. We need the token in the Authorization header with the prefix **JWT** so the token will be passed as **JWT \<token>**

The Access token key can be used in subsequent requests but expires after 24 hours which must be requested again by re-initiating a login or calling the token-refresh API. The Access token once generated is valid for 24 hours and the refresh token is valid for many days.

{% tabs %}
{% tab title="Auth API" %}

## Auth API

<table><thead><tr><th width="178">Name</th><th>Description</th></tr></thead><tbody><tr><td><strong>API Name</strong></td><td>Authentication </td></tr><tr><td><strong>URL</strong></td><td><a href="https://api-platform.mastersindia.co/api/v1/token-auth/">https://api-platform.mastersindia.co/api/v2/token-auth/ </a></td></tr><tr><td><strong>Method Type</strong></td><td> <strong>POST</strong></td></tr><tr><td><strong>Headers</strong></td><td>Leave Blank</td></tr><tr><td><strong>Body</strong></td><td><p>raw</p><pre class="language-postman_json"><code class="lang-postman_json">{
    "username": "demo@mastersindia.co",
    "password": "XXDemesting@123"
}
</code></pre></td></tr><tr><td><strong>Action</strong></td><td>Hit the Send button</td></tr><tr><td><strong>Response</strong></td><td><pre class="language-json"><code class="lang-json">{
    "token": "eyJ0eXfiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjk5NjEzODQzLCJqdGkiOiJmYTBkNDRhZmQyNmQ0NjAzOTM3MjY1ZThlMTAxNTI1YyIsInVzZXJfaWQiOjE0OCwidXNlcm5hbWUiOiJwcmF0ZWVrcmFpK2RlbW9AbWFzdGVyc2luZGlhLmNvIiwiZW1haWwiOiJwcmF0ZWVrcmFpK2RlbW9AbWFzdGVyc2luZGlhLmNvIiwicmVmcmVzaF9qdGkiOiJiMjYzZjkxNWI1ZDA0NjQ4OGVmOTgzN2E3YmM0ZmFiNSJ9.cAL8mxY12ncSjq3nhhvwHtWKihRaT8YYBY1RrQ5t7_M",
    "refresh_token": "eyo0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTcwMjIwNTg0MywianRpIjoiYjI2M2Y5MTViNWQwNDY0ODhlZjk4MzdhN2JjNGZhYjUiLCJ1c2VyX2lkIjoxNDgsInVzZXJuYW1lIjoicHJhdGVla3JhaStkZW1vQG1hc3RlcnNpbmRpYS5jbyIsImVtYWlsIjoicHJhdGVla3JhaStkZW1vQG1hc3RlcnNpbmRpYS5jbyJ9._3GKwWNN5eAd3xvrRq6YmTRiYE1u8aLwXuRkp9joD6Q"
}
</code></pre></td></tr></tbody></table>

JWT token will get Generated - Copy & paste it In the header section of **Upload API**
{% endtab %}
{% endtabs %}

### Response Messages <a href="#request-body" id="request-body"></a>

<table><thead><tr><th width="223">Code</th><th width="120.66666666666666"></th><th>MSG</th></tr></thead><tbody><tr><td>200</td><td>Sueess</td><td>Data Extracted Successfully</td></tr><tr><td>206 </td><td>error</td><td>(Invalid Credentials)</td></tr><tr><td>400 </td><td>error</td><td>(Invalid Params)</td></tr></tbody></table>
