Your first integration
This ten-minute quickstart takes you from zero to your first successful API call — listing clients. Every step is shown two ways: Manual (REST) and n8n. Pick a tab; your choice is remembered across the whole site.
Before you start
Section titled “Before you start”-
Get your client name. Your base URL is
https://<your-client-name>.api.mendrix.cloud/api— see Environments & URLs. -
Create an API token in the TMS (Custom Link → Api Tokens), as described in Authentication. Copy the secret — it is shown only once.
Step 1 — Store your credentials
Section titled “Step 1 — Store your credentials”Keep the token out of your code. Export it as an environment variable:
export MENDRIX_API_TOKEN="YOUR_API_TOKEN"export MENDRIX_BASE="https://<your-client-name>.api.mendrix.cloud/api"Create a reusable credential that holds your API token. It is used by the login node (Step 2) and stays out of your workflow JSON when you export:
- In n8n, go to Credentials → New → Custom Auth.
- Set Name to
MendriX API token. - Set JSON to:
{ "body": { "token": "YOUR_API_TOKEN" } }
- Save.
Step 2 — Get an access token
Section titled “Step 2 — Get an access token”MendriX uses a two-step flow: exchange your long-lived API token for a short-lived access token (JWT) at the account service, then call the API with that JWT — see Authentication.
curl
export MENDRIX_ACCESS_TOKEN=$(curl -s -X POST \ "$MENDRIX_BASE/account/login-api-token" \ -H "Content-Type: application/json" \ -d "{\"token\": \"$MENDRIX_API_TOKEN\"}" \ | jq -r '.data.items[0].access')JavaScript (fetch)
const BASE = process.env.MENDRIX_BASE;
const login = await fetch(`${BASE}/account/login-api-token`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ token: process.env.MENDRIX_API_TOKEN }),});if (!login.ok) throw new Error(`Login failed: ${login.status}`);const { access } = (await login.json()).data.items[0];- Add a Manual Trigger node (for testing) — later swap it for a Schedule Trigger.
- Add an HTTP Request node, name it
Get access token, and connect it to the trigger. - Configure it:
- Method:
POST - URL:
https://<your-client-name>.api.mendrix.cloud/api/account/login-api-token - Authentication: Generic Credential Type → Custom Auth → select
your
MendriX API tokencredential (it injects the token into the body).
- Method:
- Execute the node — the output contains
data.items[0].access.
Step 3 — List clients
Section titled “Step 3 — List clients”curl
curl "$MENDRIX_BASE/client/clients/?limit=25" \ -H "Authorization: Bearer $MENDRIX_ACCESS_TOKEN" \ -H "Accept: application/json"JavaScript (fetch)
const res = await fetch(`${BASE}/client/clients/?limit=25`, { headers: { Authorization: `Bearer ${access}`, Accept: 'application/json', },});
if (!res.ok) { throw new Error(`MendriX API error ${res.status}: ${await res.text()}`);}
const clients = await res.json();console.log(`Fetched ${clients.data?.length ?? 0} clients`);- Add a second HTTP Request node after
Get access token. - Configure it:
- Method:
GET - URL:
https://<your-client-name>.api.mendrix.cloud/api/client/clients/ - Headers: add
Authorization=Bearer {{ $('Get access token').first().json.data.items[0].access }} - Query Parameters: add
limit=25.
- Method:
- Click Execute Node. The clients appear in the node output.
Importable workflow: download
first-integration.json and import it via
Workflows → Import from File. Then open the Get access token node,
attach your MendriX API token Custom Auth credential, and replace
<your-client-name> in both URLs.
Step 4 — Handle the response
Section titled “Step 4 — Handle the response”A successful call returns 200 OK with a JSON body containing the client
records and a pagination cursor. If you get:
401— your access token is missing or expired; log in again (or refresh).403— your token lacks the scope; see Authentication.- other errors — read the body; see Errors & conventions.
Next steps
Section titled “Next steps”- Keep your CRM aligned with Client & CRM sync.
- Bring orders in via Order intake.
- Explore every endpoint in the REST API reference.