Skip to Content
DocsIntegrationsn8n Quickstart

n8n Quickstart

Status: Active Version: v1.1.0 Last updated: 2026-02-25

Companion docs:


Prerequisites

  • n8n instance (self-hosted or cloud, v1.20+)
  • RGL8R integration key (create via POST /api/integration-keys or Admin UI)
  • API base URL (e.g., https://api.rgl8r.com)

Store credentials in n8n’s Credential Manager — never hardcode keys in workflow nodes.


4-Node Workflow: SIMA Screening

This workflow implements the canonical flow: authenticate → enqueue → poll → fetch results.

Node 1: Token Exchange

Exchange your integration key for a short-lived bearer token.

SettingValue
Node typeHTTP Request
MethodPOST
URL{{ $env.RGL8R_BASE_URL }}/api/auth/token/integration
Headersx-api-key: {{ $credentials.rgl8rApiKey }}
ResponseJSON

Extract from response:

  • {{ $json.access_token }} — bearer token for subsequent requests
  • {{ $json.expires_in }} — token lifetime in seconds (default 3600)

Node 2: Enqueue Screening

Start a SIMA batch screening job.

SettingValue
Node typeHTTP Request
MethodPOST
URL{{ $env.RGL8R_BASE_URL }}/api/sima/batch
HeadersAuthorization: Bearer {{ $node["Token Exchange"].json.access_token }}
Content-Typeapplication/json
Body{"skus": null, "runPolicy": "always", "screeningAuthority": "US"}

Extract from response:

  • {{ $json.jobId }} — job identifier for polling
  • Expected status code: 202

Node 3: Poll Loop (Wait + IF)

Poll job status until terminal state (COMPLETED or FAILED).

Sub-node 3a: Wait

SettingValue
Node typeWait
Duration5 seconds

Sub-node 3b: Check Job Status

SettingValue
Node typeHTTP Request
MethodGET
URL{{ $env.RGL8R_BASE_URL }}/api/jobs/{{ $node["Enqueue Screening"].json.jobId }}
HeadersAuthorization: Bearer {{ $node["Token Exchange"].json.access_token }}

Sub-node 3c: IF (loop control)

SettingValue
Node typeIF
Condition{{ $json.status }} is not equal to COMPLETED AND is not equal to FAILED
True branch→ back to Wait (Sub-node 3a)
False branch→ Fetch Results (Node 4)

Set a maximum iterations limit (e.g., 40) on the loop to prevent runaway polling.

Node 4: Fetch Results

Retrieve screening results after job completion.

SettingValue
Node typeHTTP Request
MethodGET
URL{{ $env.RGL8R_BASE_URL }}/api/sima/results?limit=50
HeadersAuthorization: Bearer {{ $node["Token Exchange"].json.access_token }}
ResponseJSON

Results include SIMA screening outcomes: AT_RISK, NEEDS_REVIEW, CLEARED per SKU.


SHIP Upload Variant

For freight audit uploads, replace Node 2 with a multipart file upload:

SettingValue
Node typeHTTP Request
MethodPOST
URL{{ $env.RGL8R_BASE_URL }}/api/ship/upload
HeadersAuthorization: Bearer {{ $node["Token Exchange"].json.access_token }}
Content-Typemultipart/form-data
BodyBinary file field named file

The response returns { jobId, status } — use the same poll loop (Node 3) and replace Node 4 with:

  • GET /api/ship/findings — list findings with variance amounts
  • GET /api/ship/summary — KPI summary (total variance, finding counts)

Troubleshooting

SymptomLikely CauseAction
401 INVALID_API_KEY on Node 1Bad or revoked integration keyRotate key via POST /api/integration-keys/:id/rotate or Admin UI
401 INVALID_TOKEN on Nodes 2-4Bearer token expiredRe-run Node 1; check expires_in and reduce poll duration
403 SCOPE_DENIEDIntegration key missing required scopeReissue key with required scopes
400 INVALID_REQUEST on Node 2Malformed payload (e.g., bad screeningAuthority)Validate request body against OpenAPI spec
Poll loop never terminatesWorker backlog or job failureCheck GET /api/jobs/:id response for error field; verify max-iterations guard
429 RATE_LIMITEDToo many requestsAdd exponential backoff: 5s → 10s → 20s between polls

Next Steps

  • SHIP upload workflow: Replace Node 2 with the SHIP variant above
  • Catalog upload: Use POST /api/catalog/upload (multipart) for TRADE catalog ingestion
  • Webhook triggers (P12-B): When available, replace polling with webhook-triggered n8n workflows
  • Error notifications: Add an n8n Error Trigger node to alert on job failures via Slack/email

Plan ID: P12-A | Last updated: 2026-02-25