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.
Go to Settings → Store Configurator → your store → Data Sources
Click Connect Data Source
In the modal, select Klar API or Klar Returns
Give the data source a name (e.g.
Order API) and save
Step 2: Copy your token
Your token is a JWT and will look like this:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhU291cmNlSWQiOiIkS0lEOkFHR19JRDoxYmEyYWY4OC0zODZiLTQyZjQtODE2Ni04NDVjNjc4NTEwOWE
6ZGYzOTc2MzAtYTdjOC00ODI3LWJhNjUtN2U0N2FjOGRjNmM5OiQiLCJ0eXBlIjoia2xhci1pbXBvcnQtYXBpIiwidmVyc2lvbiI6MCwiaWF0IjoxNjc2ODg0Mjg4
LCJhdWQiOiJrbGFyLWltcG9ydC1hcGkiLCJpc3MiOiJrbGFyIiwic3ViIjoiJEtJRDpBR0dfSUQ6MWJhMmFmODgtMzg2Yi00MmY0LTgxNjYtODQ1YzY3ODUxMDlhOm
RmMzk3NjMwLWE3YzgtNDgyNy1iYTY1LTdlNDdhYzhkYzZjOTokIn0.dPsPZ8RoCPikjNJFc_4FBfhaqN0a9Won19Rj4puz6c8

