Developer Platform

Roll-Off Dispatch as an API

Push jobs, drivers, and trucks. Get back optimized routes with container chaining. Subscribe to real-time events. Your integration, our optimization engine.

Quick Start

Real endpoints, real responses

REST API with consistent JSON responses. Interactive Swagger docs at /docs on any running instance.

Optimize dispatch

Send a date. Get back optimized job-to-driver assignments with container chaining, time window compliance, and truck compatibility handled for you.

optimize.js
// 1. Start an async optimization
const response = await fetch('https://api.getklau.com/api/v1/dispatches/optimize', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer kl_live_your_key',
    'Content-Type': 'application/json',
    'Klau-Tenant-Id': '<company-uuid>',  // Required for vendor keys
  },
  body: JSON.stringify({ date: '2026-03-15' })
});

const { data } = await response.json();
// data.jobId:   "opt-abc123"
// data.status:  "PENDING"
// data.pollUrl: "/api/v1/dispatches/optimize/opt-abc123"

// 2. Poll for results
const result = await fetch(
  'https://api.getklau.com' + data.pollUrl,
  { headers: { 'Authorization': 'Bearer kl_live_your_key' } }
);
// result.data.status: "COMPLETED" | "RUNNING" | "PENDING"
// result.data.result: { ... optimization output ... }

Real-time webhooks

Subscribe to events. Job completed, job assigned, dispatch optimized — your server gets notified with HMAC-signed payloads.

webhook-payloads.json
// Webhook payload for job.completed
{
  "event": "job.completed",
  "data": {
    "jobId": "clx1abc...",
    "jobType": "PICKUP",
    "driverId": "clx2def...",
    "completedAt": "2026-03-15T14:32:00Z"
  }
}

// Webhook payload for dispatch.optimized
{
  "event": "dispatch.optimized",
  "data": {
    "dispatchId": "clx3ghi...",
    "date": "2026-03-15",
    "mode": "FULL_DAY",
    "metrics": { ... }
  }
}
Platform Features

What the API provides

Chain Optimization

Container chaining, truck compatibility, dump site hours, time windows — roll-off-specific optimization logic.

Webhooks

Transactional outbox pattern with exponential backoff retry. Events are never lost.

Security

API keys are hashed at rest. Scoped access per resource. Vendor keys enforce tenant isolation via ManagedTenant grants.

Swagger / OpenAPI

Interactive API docs at /docs on any running instance. Use it to explore endpoints and test requests.

Idempotency

Pass an Idempotency-Key header on writes. Same key within 24 hours returns the cached response.

Multi-Tenant

Vendor keys access multiple haulers via Klau-Tenant-Id header. Tenant isolation enforced at every layer.

Multi-Tenant

One key, many haulers

Vendor API keys access multiple hauler tenants through the Klau-Tenant-Id header. Each tenant grants specific scopes — read jobs, write dispatches, whatever your integration needs.

  • Scoped access

    Each tenant grants specific read/write scopes to your vendor key

  • Tenant isolation

    Data never leaks between haulers — enforced at the database layer

  • Rate limiting per identity

    500 requests per 15 minutes. Response headers show remaining quota.

vendor-integration.js
// Vendor integration: access multiple haulers with one key

// 1. Authenticate with your vendor API key
const headers = {
  'Authorization': 'Bearer kl_live_vendor_key',
  'Content-Type': 'application/json',
};

// 2. List jobs for District A
const districtA = await fetch(
  'https://api.getklau.com/api/v1/jobs?date=2026-03-15',
  { headers: { ...headers, 'Klau-Tenant-Id': '<district-a-uuid>' } }
);

// 3. Run optimization for District A
const optimize = await fetch(
  'https://api.getklau.com/api/v1/dispatches/optimize',
  {
    method: 'POST',
    headers: { ...headers, 'Klau-Tenant-Id': '<district-a-uuid>' },
    body: JSON.stringify({ date: '2026-03-15' })
  }
);

Ready to integrate?

API access is included with every Klau subscription. Request access and we'll get you set up with keys and documentation.