Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Authentication

Get an STS token, make a first authenticated call, and cache tokens. About 10 minutes.

Every ESW API request carries an OAuth 2.0 access token issued by the ESW Security Token Service (STS). In this quick start you request a token with the client credentials flow, use it to make a first authenticated call, and add token caching so your integration never requests a token on every call.

Time: about 10 minutes

Environment: sandbox

Before you begin

You need these from ESW:

  • A sandbox client_id and client_secret

  • Your tenantCode, the retailer identifier used in API paths

  • The scopes enabled for your client

1

Choose your scopes

A scope grants access to an API or a group of actions. Request only the scopes your integration needs, as a space-separated list.

Scope
Grants
Used in

checkout.preorder.api.all

PreOrder requests to the Checkout API

Checkout

order.transaction.create.api.all

Order create actions

Order

order.transaction.get.api.all

Get Order

Order

order.transaction.update.api.all

Order update actions

Order

order.transaction.cancel.api.all

Order cancel actions

Order

pricing.advisor.api.all

Full access to Pricing Advisor

Pricing Advisor

logistics.catalog.api.upload

Catalog upload actions

Customs Catalog

logistics.package.api.all

Full access to the Package API

Package

logistics.returns.api.all

Full access to the Returns API

Returns

logistics.inventory.cart.availability.api.read

Inventory availability access.

Inventory

This table covers the scopes the quick starts use. For every scope, including narrower read-only and per-action scopes, see Access Tokens.

2

Request an access token

Send a POST to the STS token endpoint. The body must be form URL encoded, not JSON.

export ESW_CLIENT_ID="<client_id>"
export ESW_CLIENT_SECRET="<client_secret>"

curl --request POST "https://security-sts.sandbox.eshopworld.com/connect/token" \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "grant_type=client_credentials" \
  --data-urlencode "scope=pricing.advisor.api.all" \
  --data-urlencode "client_id=$ESW_CLIENT_ID" \
  --data-urlencode "client_secret=$ESW_CLIENT_SECRET"

A successful call returns 200:

{
  "access_token": "<jwt>",
  "expires_in": 3600,
  "token_type": "Bearer",
  "scope": "pricing.advisor.api.all"
}

expires_in is the token lifetime in seconds. Keep the access_token value for the next step.

3

Make your first authenticated call

Send the token in the Authorization header. This example calls Pricing Advisor, which is read-only, so it is safe to run as a smoke test. Replace <tenantCode> with your tenant code.

export ESW_TOKEN="<access_token>"

curl "https://pricing-advisor-api.sandbox.eshopworld.com/api/4.0/MultiplierAdvice/<tenantCode>/DE" \
  --header "Authorization: Bearer $ESW_TOKEN" \
  --header "Accept: application/json"

A 200 response with pricing data confirms that your credentials, scope, and tenant code are all valid.

STS hosts only issue tokens. Send API requests to the service base URLs listed in API Base URLs, never to an STS host.

4

Cache and refresh tokens

A token stays valid until expires_in elapses. Request one, reuse it, and refresh it shortly before it expires. If an idempotent request returns 401 for an expired token, refresh once and retry it. Do not automatically replay a mutating request unless its API documentation confirms it is retry-safe.

Sandbox

Service
Sandbox

STS (token endpoint)

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

To move to production, request tokens from the production STS endpoint with the credentials ESW provides for production. Confirm the production API base URL for each API with your ESW representative before go-live.

Credential lifecycle

Client credentials are valid for six months. A one-month rollover window lets you rotate secrets without downtime. Put a rotation reminder in your team calendar when you receive new credentials.

Troubleshooting

Symptom
Likely cause
Fix

STS returns 403 with invalid_client

client_id or client_secret is wrong, or you are using credentials for a different environment

Re-check both values and confirm you are calling the STS host that matches your credentials

STS rejects the token request

Body sent as JSON, or a parameter is missing

Send a form URL encoded body with grant_type, scope, client_id, and client_secret

STS returns 400 with invalid_scope

The requested scope is unknown or not enabled for your client

Check the scope spelling, then ask ESW to enable the required scope

API returns 401

Token missing, malformed, or expired

Send Authorization: Bearer <access_token> and request a new token when the current one expires

API returns 403

Token does not carry the scope the endpoint needs, or the credentials are insufficient

Request a token with the scope for that API. Ask ESW to enable it on your client if it is missing

API returns 429

Too many requests

Wait for the number of seconds in the Retry-After header, then retry

Request to an STS host returns an error

API request sent to the token endpoint

Send API requests to the service base URL, not STS

Next steps

Last updated

Was this helpful?