> For the complete documentation index, see [llms.txt](https://docs.mnasati.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mnasati.com/authentication.md).

# Authentication

How to authenticate to our API.

![](https://3883871296-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_oPX5mBfQUW-kaqyTW%2F-Ma7jO5ZSyo0TxfppcOm%2F-Ma8jcR6x8-8iNCGPXfC%2FAuthentication.jpg?alt=media\&token=88533e56-4a1c-4ed1-b447-27eaeabf2b9f)

## Getting Super Powers

To start using the API you need 3 main things:

* Email address for the vendor
* The password vendor
* JWT (JSON Web Token) Key

Using the email & password to generate the ***JWT*** ***Key***, by calling the [Authorization](https://docs.mnasati.com/api-methods/authorization) method. It will return a lot of JSON formatted data, for now we just need the ***JWT Key**,* which looks something like this:

```bash
{
   "status":true,
   "message":"Vendor autorization successfully.",
   "access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZW5kb3JfaWQiOiI0MyIsInVzZXJfaWQiOiI0MCIsInVzZXJfdHlwZSI6InZlbmRvciIsImVtYWlsIjoiemF6YUB1aWd0Yy5jb20iLCJpYXQiOjE2MjExNTc4NjcsImV4cCI6MTYyNjM0MTg2N30.H48knQdwQugrYDOCQW_flHmUZzRVNceiFM9OK8yWKq4",
   "expires_in":1626341867,
   "user_info":{......
```

You guessed it, the key that we need is in line #4 called "access\_token". This key will be used in most of our API calls.

{% hint style="info" %}
&#x20;Also please note the "expires\_in" parameters are returned in the JSON response, this indicates when does the JWT Key expires and needs to be regenerated. In the response above the token expires in 2 months.
{% endhint %}

Once you got it all, look at this:

{% code title="Bash Curl Request" %}

```bash
curl --request POST \
  --url https://sandbox.mnasati.com/v1/customer \
  --header 'Authorization-Jwt: ' \
  --header 'Content-Type: ' \
  --data '{"name":"john","country_id":1,"email":"johnd@gmail.com","phone":"966441424","password":"1234@#$%%","confirm_password":"1234@#$%%"}'
```

{% endcode %}

This method call above is to test the creation of a customer on your own store, just to validate that the authorization process is completed successfully.&#x20;
