Using n8n with MendriX
n8n is a low-code workflow automation tool. This guide sets
up the foundation every other n8n guide in this portal builds on: a reusable
credential, the HTTP Request node, pagination and error handling. Each
integration guide also ships an importable workflow JSON under /n8n/.
Step 1 — Credential + login node
Section titled “Step 1 — Credential + login node”MendriX authentication is a two-step flow: your long-lived API token is exchanged for a short-lived access token (JWT) which authenticates the actual API calls — see Authentication. In n8n that means: one credential holding the API token, and one login node at the start of every workflow.
On the manual path you log in once and use the returned access token:
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')
curl "$MENDRIX_BASE/client/clients/" \ -H "Authorization: Bearer $MENDRIX_ACCESS_TOKEN"Create the credential once:
- Credentials → New → Custom Auth.
- Name:
MendriX API token. - JSON:
{ "body": { "token": "YOUR_API_TOKEN" } }
- Save.
Then start every workflow with an HTTP Request node named
Get access token:
- Method:
POST - URL:
https://<your-client-name>.api.mendrix.cloud/api/account/login-api-token - Authentication: Generic Credential Type → Custom Auth →
MendriX API token(injects the token into the request body).
Its output contains data.items[0].access — a JWT that is fresh for the
duration of the run, so workflows never need refresh handling. Using a
credential (rather than pasting the token into the node) keeps the secret out
of your workflow JSON when you export it.
Step 2 — The HTTP Request node
Section titled “Step 2 — The HTTP Request node”The manual equivalent is a single HTTP call. See Your first integration for curl and JavaScript.
- Add an HTTP Request node after
Get access token. - Method: the endpoint’s verb (
GET,POST,PATCH, …). - URL:
https://<your-client-name>.api.mendrix.cloud/api/<path>. - Headers: add
Authorization=Bearer {{ $('Get access token').first().json.data.items[0].access }}. - For
GET, add Query Parameters (limit,cursor,sort,since). - For
POST/PATCH, set Body Content Type toJSONand provide the body. Add aContent-Type: application/jsonheader.
Step 3 — Page through results
Section titled “Step 3 — Page through results”Follow the cursor as described in Pagination & sync.
The HTTP Request node has built-in pagination:
- In the HTTP Request node, enable Pagination.
- Pagination Mode: Response Contains Next URL if the API returns one,
otherwise Update a Parameter in Each Request and set the
cursorquery parameter from the previous response’s cursor field. - Stop condition: when no cursor is returned.
- Set limit to
1000to minimise the number of requests.
Step 4 — Handle errors
Section titled “Step 4 — Handle errors”Check the status code and read the body on failure — see Errors & conventions.
- On each HTTP Request node, open Settings.
- Set On Error to Continue (using error output) so a failure does not abort the whole run.
- Wire the error output to an IF/Switch node: retry
429/5xxwith a Wait node and back-off; route4xxto a notification/log. - Enable Retry On Fail for transient errors.
Importable workflows
Section titled “Importable workflows”Every guide links its own workflow JSON. Import any of them via Workflows →
Import from File, then attach your MendriX API token Custom Auth credential
to the Get access token node and replace <your-client-name>:
first-integration.json— list clientsclient-crm-sync.json— incremental client syncorder-intake.json— submit an order (SOAP XML)order-status-tracking.json— receive order webhooksinvoices-accounting.json— pull invoices, post payments