---
title: Authentication
slug: merchant-api/authentication
createdAt: 2021-07-27T08:11:41.000Z
---

# Definition

Authentication is made through the generation of a time-limited `token` (24h), using the user's login and password.

The JWT token generated by this endpoint is to be used in other endpoints as a **HTTP Header** named: `Authorization`

# Endpoint

| ****        |                                                                                                |
| ----------- | ---------------------------------------------------------------------------------------------- |
| **Method**  | `POST`                                                                                         |
| **URI**     | `/auth`                                                                                        |
| **Headers** | - **Accept:** application/json (required)<br />- **Content-Type:** application/json (required) |
| **Returns** | a time limited,  JWT Bearer `token` to be used in other endpoints.                             |

# How to use the token?

Every Merchant API endpoint requires you to be authentified. The Token returned by the `/login` endpoint is used to ensure you are properly authentified and that you have the right authorizations.

In every request to the API, you should use the `Authorization` **HTTP header** to with the `token` you retrieved from the `POST /login` response body, prefixed by the keyword `Bearer` .

# Examples

First, requesting a token via the `/login` endpoint...

:::CodeblockTabs
Generate a token

```curl
curl -X POST https://api.neteven.com/auth -d '{"login": "mylogin@email.com", "password": "MyPassword1324"}'
```
:::

:::CodeblockTabs
Reponse 200

```json
{
	"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJyb2xlcyI6WyJwcm9kdWN0X21hbmFnZXIiLCJ3YXJlaG91c2VfbWFuYWdlciIsIm9yZGVyX21hbmFnZXIiLCJzdG9ja19tYW5hZ2VyIiwicHJpY2VfbWFuYWdlciIsIjEwMDAiXSwiaXNzIjoiYXBpLm5ldGV2ZW4uY29tIiwibG9naW4iOiJhcGktdGVzdC1hY2NvdW50QGVtYWlsLmNvbSIsInJldGFpbGVyX2lkIjpudWxsLCJkZWJ1ZyI6ZmFsc2UsImRlYnVnX2V4cGlyYXRpb25fZHR0IjpudWxsLCJzdWIiOjEwMDAsImlhdCI6MTYzMjEyNTEwNiwiZXhwIjoxNjMyMjExNTA2LCJhdWQiOiJhcGkubmV0ZXZlbi5jb20ifQ.3GfC01HmJl0PS2w16gIcoxgLN52vG5kkDhqNmrkkR4zIGK7ecVfFaZhQ4KCQnimwjWTrExszIE6Oc6d-hC0g-QQ",
	"expiration_date": "2021-09-21T10:05:06"
}
```
:::

...then using it in a HTTP header of a price update request:

:::CodeblockTabs
Use the token in PATCH prices

```curl
curl --request PATCH \
  --url https://api.neteven.com/v1/merchant/items/prices \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJyb2xlcyI6WyJwcm9kdWN0X21hbmFnZXIiLCJ3YXJlaG91c2VfbWFuYWdlciIsIm9yZGVyX21hbmFnZXIiLCJzdG9ja19tYW5hZ2VyIiwicHJpY2VfbWFuYWdlciIsIjEwMDAiXSwiaXNzIjoiYXBpLm5ldGV2ZW4uY29tIiwibG9naW4iOiJhcGktdGVzdC1hY2NvdW50QGVtYWlsLmNvbSIsInJldGFpbGVyX2lkIjpudWxsLCJkZWJ1ZyI6ZmFsc2UsImRlYnVnX2V4cGlyYXRpb25fZHR0IjpudWxsLCJzdWIiOjEwMDAsImlhdCI6MTYzMjEyNTEwNiwiZXhwIjoxNjMyMjExNTA2LCJhdWQiOiJhcGkubmV0ZXZlbi5jb20ifQ.3GfC01HmJl0PS2w16gIcoxgLN52vG5kkDhqNmrkkR4zIGK7ecVfFaZhQ4KCQnimwjWTrExszIE6Oc6d-hC0g-QQ' \
  --header 'Content-Type: application/json' \
  --data '{
    "items": [
      {
        "sku": "MySKU",
        "prices": [
          {
            "currency_id": "EUR",
            "name": "price_fixed",
            "value": 65.0
          }
        ]
      }
    ]
  }'
```
:::

