Skip to main content

Building Integrations

MoveTheWheels is API-first, so most extension work is integration work: pushing demand in, pulling tracking out, and keeping your systems in sync with the freight spine.

How integrations work​

A MoveTheWheels integration connects an external system — a storefront, an ERP, a carrier, or a TMS — to the logistics spine through three building blocks:

  • Queries & mutations over GraphQL (orders, shipments, tracking, …)
  • API keys for authenticated, automated access
  • Domain events so your system reacts to shipment and tracking changes

Connect​

Authenticate with an API key minted from the developer portal. Every request is authenticated and permission-checked before it reaches your data.

# Confirm connectivity with a read query
curl -s https://graphqlworkspaces.burdenoff.com/workspaces/graphql \
-H "Authorization: Bearer $MOVETHEWHEELS_API_KEY" \
-H "Content-Type: application/json" \
-H "x-workspace-id: $WORKSPACE_ID" \
-d '{"query":"{ shipments(pagination:{limit:1}) { id shipmentNumber status } }"}'

Push demand in​

Create an order, then hand it off to a shipment — keeping the spine intact.

import { request } from 'graphql-request';

const endpoint = 'https://graphqlworkspaces.burdenoff.com/workspaces/graphql';
const headers = {
authorization: `Bearer ${process.env.MOVETHEWHEELS_API_KEY}`,
'x-workspace-id': process.env.WORKSPACE_ID!,
};

// 1. Capture demand
const { createOrder } = await request(endpoint, /* GraphQL */ `
mutation ($input: CreateOrderInput!) {
createOrder(input: $input) { id status }
}
`, { input: order }, headers);

// 2. Turn it into a tracked shipment
const { createShipment } = await request(endpoint, /* GraphQL */ `
mutation ($input: CreateShipmentInput!) {
createShipment(input: $input) { id shipmentNumber status trackingNumber }
}
`, { input: { orderId: createOrder.id, origin, destination, cargoDetails } }, headers);

Report progress​

As freight moves, record typed tracking events so the tracking page and control tower always reflect reality.

await request(endpoint, /* GraphQL */ `
mutation ($input: AddTrackingEventInput!) {
addTrackingEvent(input: $input) { id type occurredAt }
}
`, {
input: {
shipmentId,
type: 'IN_TRANSIT',
location: 'Hub A',
occurredAt: new Date().toISOString(),
},
}, headers);

Stay in sync with events​

Rather than polling, react to changes as they happen:

consumer.on('shipment.status_changed', (e) => syncShipment(e.shipmentId, e.status));
consumer.on('tracking.event_added', (e) => forwardTracking(e.shipmentId, e.event));

Error handling​

Failures surface as GraphQL errors with a machine-readable extensions.code:

try {
await createShipment(input);
} catch (err) {
const code = err?.response?.errors?.[0]?.extensions?.code;
if (code === 'VALIDATION_ERROR') throw err;
if (code === 'FORBIDDEN') throw err;
}

Environment selection​

Default is production:

BURDENOFF_ENV=prod # default
BURDENOFF_ENV=alpha
BURDENOFF_ENV=local

Testing your integration​

Validate against a non-production workspace before going live:

  • Confirm connectivity with a read query (shipments)
  • Exercise the full spine — order → shipment → tracking → proof of delivery
  • Assert that RBAC scoping rejects cross-workspace access
  • Replay event consumers to confirm idempotency

Best practices​

  • Respect the spine — create shipments from orders; record state as tracking events
  • Attach carriers from the service-provider marketplace, not free-text
  • Be idempotent — events and retries should not double-book shipments
  • Stay workspace-scoped — never assume access across tenants
  • Log and monitor — every mutation is audited; design for attributability

Getting started​

  • Review the GraphQL API Reference
  • Generate an API key and confirm connectivity with a read query
  • Start with a single demand-inbound flow before adding carriers

For technical support, reach our team at [email protected].