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

# Authentication

How to authenticate Inventory API requests with a Bearer JWT and how to request an access token.

Both Inventory API endpoints require Bearer authentication. Supply the JWT access token in the `Authorization` header of every request.

```http
Authorization: Bearer {access_token}
```

The credentials and permissions required to call the API are provided during integration setup.

### Access Tokens

```bash
curl --location --request POST 'HOST_ADDRESS/connect/token' \
  --form 'grant_type=client_credentials' \
  --form 'scope=YOUR_SCOPE' \
  --form 'client_id=YOUR_CLIENT_ID' \
  --form 'client_secret=YOUR_CLIENT_SECRET'
```

Substitute the following variables as follows:

### **Request URL**

{% tabs %}
{% tab title="Sandbox" %}
{% code expandable="true" %}

```shellscript
https://security-sts.sandbox.eshopworld.com/connect/token
```

{% endcode %}
{% endtab %}

{% tab title="Scope" %}
{% code expandable="true" %}

```bash
logistics.inventory.cart.availability.api.read
```

{% endcode %}
{% endtab %}
{% endtabs %}

| Key             | Description                                                                                   |
| --------------- | --------------------------------------------------------------------------------------------- |
| `grant_type`    | The type of access to the users (for example, `client_credentials`).                          |
| `scope`         | The scope required by the client to access the API. The scope varies for each API and client. |
| `client_id`     | The unique ID assigned to each retailer by eShopWorld.                                        |
| `client_secret` | The client secret provided for the client.                                                    |

### Access Token Response

The following response includes the access token and the type of token (`token_type`), such as `Bearer`.

```json
{
    "access_token": "eyJhbGciOiJSUzI1NiIsImtpZC...I6IjQ3NkQ1QzE5QzI1Nzc0NUV",
    "expires_in": 3600,
    "token_type": "Bearer",
    "scope": "YOUR_SCOPE"
}
```

{% hint style="warning" %}
Do not expose authentication credentials or access tokens in application logs.
{% endhint %}

{% hint style="info" icon="square-terminal" %}
ESW APIs are based on Representational State Transfer (REST). The APIs follow industry standards and use predictable and resource-oriented URLs. The APIs use HTTP methods for operations and support input as well as output in JSON format.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.esw.com/inventory/inventory-api/authentication.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
