Skip to content

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.

  1. Get your client name. Your base URL is https://<your-client-name>.api.mendrix.cloud/api — see Environments & URLs.

  2. Create an API token in the TMS (Custom Link → Api Tokens), as described in Authentication. Copy the secret — it is shown only once.

Keep the token out of your code. Export it as an environment variable:

Terminal window
export MENDRIX_API_TOKEN="YOUR_API_TOKEN"
export MENDRIX_BASE="https://<your-client-name>.api.mendrix.cloud/api"

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

Terminal window
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];

curl

Terminal window
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`);

A successful call returns 200 OK with a JSON body containing the client records and a pagination cursor. If you get: