X-Sitter API
The X-Sitter API lets you read and change your company's data straight from your own system, for example your ERP, your online shop or a spreadsheet. All requests go to the same address and answer in JSON.
Step by step
Guides: Query stock and Read and maintain articles.
What the API can do
Create a token
Every request needs a token. You create it yourself in X-Sitter:
- Log in to X-Sitter, click your name in the top right corner and then Settings (German: Einstellungen).
- Choose API access (API Zugang) in the menu on the left. If the entry is missing, your user does not have the permission for it; ask your company's administrator.
- In the API token section, enter a Name (Bezeichnung) that tells you later what the token is for (e.g. "ERP integration").
- Optional: set a date under Valid until (Gültig bis). Empty means unlimited.
- Tick the Permissions the token needs, and only those. X-Sitter only offers permissions your user also has in X-Sitter itself.
- Click Create token (Token anlegen).
- The token (it starts with
xst_) is shown exactly once. Copy it right away and store it in your system. X-Sitter only keeps a hash and cannot show it to you again later.
The list below shows all tokens of your company with their permissions, expiry date and when they were last used (Zuletzt benutzt). There you can lock (and enable again) or delete a token at any time. A deleted token stops working immediately.
Treat the token like a password
Anyone who has the token can access your company's data with its permissions. Do not send it by email or chat, do not put it into publicly reachable code (e.g. JavaScript in the browser or a public Git repository), and create a separate token for every connected system. If a token has fallen into the wrong hands, delete it and create a new one.
Permissions
Each token gets its permissions when it is created. If it lacks the permission for an address, the API answers with 403 scope_missing and names the missing permission.
In the German interface the groups are called Artikel, Bestand and Lagerplätze, the permissions lesen, anlegen, ändern and löschen.
Logisticians and clients
X-Sitter distinguishes two kinds of companies:
- Logistician: runs the warehouse and manages the articles of its customers.
- Client: a customer of a logistician whose goods are stored and shipped there.
A token always works for the company it was created in. As a client you do not need to do anything else: you automatically see only your own articles and their stock.
As a logistician you can also use your token on behalf of one of your clients. Send the client's company number in the header X-Company (or in the parameter company). The permissions stay those of your token.
curl https://app.x-sitter.com/api/v1/stock \
-H "Authorization: Bearer xst_YOUR_TOKEN" \
-H "X-Company: 27"
Fetching lists page by page
Addresses that return lists answer page by page. page selects the page, per_page the number of entries per page (default 25, at most 500). meta tells you how many entries and pages there are in total:
"meta": { "page": 1, "per_page": 25, "total": 312, "total_pages": 13 }
Keep requesting the next page until page equals total_pages. You will find an example in the guide Query stock.
Errors
If something goes wrong, the API answers with a matching HTTP status and always the same structure:
{
"error": {
"code": "scope_missing",
"message": "The token has no right for stock:read.",
"details": { "scope": "stock:read" }
}
}
Evaluate the code in your program, not the text of the message. The text may change.
On a 500, try again after a short pause. If the error keeps coming back, contact support via Create ticket (Ticket erstellen) in the footer of X-Sitter and send the time, the address and the response (but never the token).