Skip to main content

API Authentication

How to generate your Klar API token and authenticate your requests using Bearer authentication.

Written by Frank Birzle

Klar uses Bearer authentication. Pass your token in the Authorization header of every request:

Authorization: Bearer <token>

Example — curl:

curl -X POST \
--data "@/path/to/filename" \
-H "Authorization: Bearer <token>" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
"https://open-api.durchsichtig.xyz/12.2022/orders/validate"

Example — TypeScript:

fetch('https://open-api.durchsichtig.xyz/12.2022/orders/validate', {
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.

Step 1: Connect the data source

Before you can generate a token, you need to connect a Klar API or Klar Returns data source.

  1. Go to SettingsStore Configurator → your store → Data Sources

  2. Click Connect Data Source

  3. In the modal, select Klar API or Klar Returns

  4. Give the data source a name (e.g. Order API) and save

Step 2: Copy your token

  1. Open the data source you just created

  2. Go to the Access Token tab

  3. Click Copy Token

Your token is a JWT and will look like this:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhU291cmNlSWQiOiIkS0lEOkFHR19JRDoxYmEyYWY4OC0zODZiLTQyZjQtODE2Ni04NDVjNjc4NTEwOWE  
6ZGYzOTc2MzAtYTdjOC00ODI3LWJhNjUtN2U0N2FjOGRjNmM5OiQiLCJ0eXBlIjoia2xhci1pbXBvcnQtYXBpIiwidmVyc2lvbiI6MCwiaWF0IjoxNjc2ODg0Mjg4
LCJhdWQiOiJrbGFyLWltcG9ydC1hcGkiLCJpc3MiOiJrbGFyIiwic3ViIjoiJEtJRDpBR0dfSUQ6MWJhMmFmODgtMzg2Yi00MmY0LTgxNjYtODQ1YzY3ODUxMDlhOm
RmMzk3NjMwLWE3YzgtNDgyNy1iYTY1LTdlNDdhYzhkYzZjOTokIn0.dPsPZ8RoCPikjNJFc_4FBfhaqN0a9Won19Rj4puz6c8
Did this answer your question?