Skip to main content

Authenticate your application against the Klar API

Frank Birzle avatar
Written by Frank Birzle
Updated over a week ago

We're using Bearer authentication (also called token authentication) which is an HTTP authentication scheme that involves security tokens called bearer tokens. The client must send this token in the Authorization header when making requests to protected resources:

Authorization: Bearer <token>

Example in curl:

curl -X POST \
--data "@/path/to/filename" \
-H "Authorization: Bearer <token>" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \

Example in TypeScirpt

fetch('', {
method: 'POST',
headers: {
'Authorization': 'Bearer <token>',
'Accept': 'application/json',
'Content-Type': 'application/json'
body: [...]

Good to know: In order to generate a token for the Klar API or Klar Returns you have to connect a data source of the type "Klar Api" or ""Klar Returns" first.

This can be achieved by navigating to Settings > Store Configurator > Your Store > Data Sources and clicking on Connect Data Source. In the appearing modal, please select Klar Api / Klar Returns and give your data source a name, e.g. Order API.

Klar API data source in Connect Data Source modal

Klar Returns data source in Connect Data Source modal

Once the data source has been created, you can navigate to the tab Access Token and click the button Copy Token.

The token should look like this:


Did this answer your question?