Node SDK
Official TypeScript SDK for MoveTheWheels, with programmatic access to drivers, vehicles, warehouses, inventory, delivery jobs, shipments, and routes.
Installation
Install @movethewheels/sdk. Use Node.js 24.11 or later, or Bun 1.4.4 or later.
npm install @movethewheels/sdk
# or
bun add @movethewheels/sdk
Quick start
import { MovethewheelsSDK } from '@movethewheels/sdk';
const { MOVETHEWHEELS_USERNAME, MOVETHEWHEELS_PASSWORD, MOVETHEWHEELS_WORKSPACE_ID } = process.env;
if (!MOVETHEWHEELS_USERNAME || !MOVETHEWHEELS_PASSWORD || !MOVETHEWHEELS_WORKSPACE_ID) {
throw new Error('Set the MoveTheWheels username, password, and workspace ID.');
}
const sdk = new MovethewheelsSDK({ productOrigin: 'https://app.movethewheels.com' });
await sdk.auth.signIn({ username: MOVETHEWHEELS_USERNAME, password: MOVETHEWHEELS_PASSWORD });
const workspace = (await sdk.auth.fetchWorkspaces()).find(
({ id }) => id === MOVETHEWHEELS_WORKSPACE_ID
);
if (!workspace) throw new Error('The requested workspace is unavailable to this account.');
await sdk.auth.issueWorkspaceToken(workspace.id, workspace.organizationId);
const vehicles = await sdk.movethewheels.vehicles.list(undefined, { limit: 10 });
const shipments = await sdk.movethewheels.shipments.list(undefined, { limit: 10 });
Environment selection
The endpoints default to production. For production requests set
productOrigin or MOVETHEWHEELS_ORIGIN to https://app.movethewheels.com.
Use explicit endpoint overrides for local development:
MOVETHEWHEELS_WORKSPACE_ENDPOINT=http://localhost:4003/workspaces/graphql
MOVETHEWHEELS_GLOBAL_ENDPOINT=http://localhost:4000/global/graphql
Or override endpoints explicitly:
const sdk = new MovethewheelsSDK({
workspaceEndpoint: 'http://localhost:4003/workspaces/graphql',
globalEndpoint: 'http://localhost:4000/global/graphql',
});
Authentication
- Email / Password:
sdk.auth.signIn({ username, password }) - OAuth2 Device Code:
sdk.auth.loginWithDeviceCode() - OAuth2 Authorization Code + PKCE:
sdk.auth.buildAuthorizationUrl()+sdk.auth.exchangeAuthCode() - Client Credentials:
sdk.auth.authenticateApp(clientId, clientSecret) - Workspace Token:
sdk.auth.issueWorkspaceToken(workspaceId, organizationId)
Modules
| Namespace | Description |
|---|---|
sdk.auth | Sign in/up, OAuth flows, token management |
sdk.movethewheels | Domain operations for customers, drivers, vehicles, warehouses, inventory, delivery jobs, shipments, tracking, routes, marketplace, settings, and analytics |
sdk.sandbox | Ephemeral sandbox environments |
sdk.billing | Subscriptions, invoices, plans |
sdk.channels | Channel-based pub/sub |
sdk.conversations | Conversation CRUD |
sdk.devportal | Apps, OAuth, API keys, webhooks |
sdk.export | Export jobs, templates |
sdk.files | Browse, upload, share |
sdk.groups | Group management |
sdk.health | Gateway/service health |
sdk.integrations | Third-party integrations |
sdk.notifications | Notification center |
sdk.organizations | Organizations + invites |
sdk.products | Feature flags, content pages |
sdk.rbac | Permissions, role assignment |
sdk.scheduler | Scheduled jobs |
sdk.security | Vaults, secrets |
sdk.store | Marketplace |
sdk.support | Tickets, knowledge base |
sdk.tags | Tag CRUD |
sdk.tours | Onboarding tours |
sdk.workspaces | Workspace CRUD + members |
Error handling
import { AuthenticationError, NetworkError } from '@movethewheels/sdk';
try {
await sdk.auth.signIn({ username: 'invalid', password: 'invalid' });
} catch (error) {
if (error instanceof AuthenticationError) {
console.error('Auth failed:', error.message);
} else if (error instanceof NetworkError) {
console.error('Network error:', error.message);
}
}
Source
The source repository is github.com/algoshred/movethewheels-sdk-node.