Get started with the API
The API lets your own system read a business’s records, run its actions and read its dashboard numbers. Every request acts for one business and one person: the person who created the token.
This guide uses a made-up shop, Demo Traders, with an orders screen. Your product’s
reference lists its real screens and operations.
What you need
- An account in the product’s app that may manage API tokens. Who may depends on the business’s roles. Your product’s reference page says where tokens are created and who may create them.
- The product’s API address. The samples read it from
API_BASE. Where the address isn’t published yet, ask support for it.
Create a token
- In the app, open API Tokens and press Create Token.
- Enter a Token Name that says which system uses it, for example
Website enquiry form. - In Scopes, choose only what that system needs. The list offers only permissions you hold yourself. Presets, when the product has them, add several scopes at once.
- Optionally set Expires At. Left blank, the token doesn’t expire.
- Save. The app may first ask you to confirm your password or your second factor.
- Copy the token now. The app keeps only a fingerprint of it and never shows it again.
Store the token like a password: on a server, in its secret store. Never put it in a web page, a mobile app or a git repository.
Make your first request
List the first page of records of a screen your token may read:
curl
curl "$API_BASE/page/orders/records?page=1&per_page=20" \
-H "Authorization: Bearer $API_TOKEN"
Node.js
const response = await fetch(`${process.env.API_BASE}/page/orders/records?page=1&per_page=20`, {
headers: { Authorization: `Bearer ${process.env.API_TOKEN}` },
});
const answer = await response.json();
console.log(answer.total, answer.records.length);
Python
import os
import requests
response = requests.get(
f"{os.environ['API_BASE']}/page/orders/records",
params={"page": 1, "per_page": 20},
headers={"Authorization": f"Bearer {os.environ['API_TOKEN']}"},
timeout=30,
)
answer = response.json()
print(answer["total"], len(answer["records"]))
PHP
<?php
$ch = curl_init(getenv('API_BASE') . '/page/orders/records?page=1&per_page=20');
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('API_TOKEN')],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
]);
$answer = json_decode(curl_exec($ch), true);
echo $answer['total'], ' ', count($answer['records']);
The answer is { "total": …, "page": 1, "per_page": 20, "records": [ … ] }. The business comes
from the token: never send a business id.
The three kinds of operation
| Request | What it does | Answer |
|---|---|---|
GET /page/<screen>/records |
A page of a screen’s records | { total, page, per_page, records } |
GET /page/<screen>/records/<id> |
One record | { record } |
POST /action/<action>/run |
Runs an action: creates or changes records | { success, records, meta? } |
GET /dashboard/<dashboard>/data |
A dashboard’s numbers | { widgets, meta } |
Only the screens, actions and dashboards in your product’s reference are open to tokens.