Download OpenAPI specification:
Commerce and order-fulfilment platform API for 4klyft.
This API provides endpoints for managing:
All API endpoints (except /api/docs and /api/v1/iam/auth/*) require JWT Bearer token authentication.
Include the token in the Authorization header:
Authorization: Bearer <your-jwt-token>
Every /api/ request is rate-limited per caller — by your authenticated
identity when a token is present, otherwise by client IP. The
authentication endpoints (/auth/login, /auth/refresh,
/auth/request-password-reset) carry stricter, IP-based limits.
Each response advertises your current budget via headers:
X-RateLimit-Limit — the bucket sizeX-RateLimit-Remaining — tokens left in the current windowX-RateLimit-Reset — Unix timestamp when a token next frees upExceeding a limit returns 429 Too Many Requests (RFC 6585) with a
Retry-After header (seconds to wait). Back off and retry after the
indicated delay rather than hammering the endpoint.
Represents an analytics report.
Reports provide aggregated analytics data for various aspects of delivery operations, including performance metrics, cost analysis, and SLA compliance.
Retrieve recent activity feed items.
| limit | integer [ 1 .. 100 ] Default: 20 Example: limit=20 Maximum number of items to return |
| entityType | string Enum: "route" "shipment" "carrier" "execution" Example: entityType=route Filter by entity type |
| page | integer Default: 1 The collection page number |
Retrieve aggregated billing statistics including invoice counts by status (total, paid, pending, overdue) and total revenue from the billing_invoice_views table.
| startDate | string <date> Example: startDate=2024-06-01 Start date for the period (YYYY-MM-DD). Defaults to 30 days ago. |
| endDate | string <date> Example: endDate=2024-06-30 End date for the period (YYYY-MM-DD). Defaults to today. |
{- "totalInvoices": 0,
- "paid": 0,
- "pending": 0,
- "overdue": 0,
- "totalRevenue": 0,
- "startDate": "2019-08-24",
- "endDate": "2019-08-24",
- "calculatedAt": "2019-08-24T14:15:22Z"
}Retrieve all KPI metrics for the analytics dashboard with optional comparison to previous period.
| dateFrom | string <date> Example: dateFrom=2024-06-01 Start date for the period (YYYY-MM-DD) |
| dateTo | string <date> Example: dateTo=2024-06-30 End date for the period (YYYY-MM-DD) |
| includeComparison | boolean Default: true Example: includeComparison=true Include comparison with previous period |
| carrierId | string <uuid> Example: carrierId=01912345-6789-7abc-def0-123456789abc Filter by carrier UUID |
{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "dashboard",
- "data": {
- "property1": "string",
- "property2": "string"
}, - "calculatedAt": "string"
}Retrieve aggregated dashboard data from multiple bounded contexts including routes, shipments, invoices, vehicles, and drivers. Returns KPI metrics, delivery trends, status breakdown, recent routes, billing overview, and shipments by carrier.
| startDate | string <date> Example: startDate=2024-06-01 Start date for the dashboard period (YYYY-MM-DD format). Defaults to 30 days ago. |
| endDate | string <date> Example: endDate=2024-06-30 End date for the dashboard period (YYYY-MM-DD format). Defaults to today. |
| carrierId | string <uuid> Example: carrierId=01912345-6789-7abc-def0-123456789abc Optional carrier UUID to filter data by a specific carrier |
{- "stats": {
- "activeRoutes": 0,
- "pendingRoutes": 0,
- "completedRoutes": 0,
- "pendingShipments": 0,
- "inTransitShipments": 0,
- "deliveredToday": 0,
- "totalDelivered": 0,
- "failedShipments": 0,
- "onTimeRate": 0.1,
- "pendingInvoices": 0,
- "totalRevenue": 0
}, - "deliveryTrends": [
- {
- "date": "2019-08-24",
- "deliveries": 0,
- "completed": 0,
- "failed": 0
}
], - "statusBreakdown": [
- {
- "status": "string",
- "count": 0,
- "percentage": 0.1,
- "color": "string"
}
], - "recentRoutes": [
- {
- "id": "string",
- "code": "string",
- "date": "2019-08-24",
- "status": "string",
- "carrier": "string",
- "nodeCount": 0
}
], - "billingOverview": {
- "pendingAmount": 0,
- "paidThisMonth": 0,
- "overdueCount": 0
}, - "shipmentsByCarrier": [
- {
- "carrierId": "string",
- "carrierName": "string",
- "count": 0
}
], - "dateRange": {
- "start": "2019-08-24",
- "end": "2019-08-24"
}, - "calculatedAt": "2019-08-24T14:15:22Z"
}Retrieve time-series data of deliveries over time with completed and failed counts.
| dateFrom | string <date> Example: dateFrom=2024-06-01 Start date for the period (YYYY-MM-DD) |
| dateTo | string <date> Example: dateTo=2024-06-30 End date for the period (YYYY-MM-DD) |
| groupBy | string Default: "day" Enum: "day" "week" "month" Example: groupBy=day Group data by time interval |
| carrierId | string <uuid> Example: carrierId=01912345-6789-7abc-def0-123456789abc Filter by carrier UUID |
| page | integer Default: 1 The collection page number |
{- "totalItems": 0,
- "search": {
- "@type": "string",
- "template": "string",
- "variableRepresentation": "string",
- "mapping": [
- {
- "@type": "string",
- "variable": "string",
- "property": "string",
- "required": true
}
]
}, - "view": {
- "@id": "string",
- "@type": "string",
- "first": "string",
- "last": "string",
- "previous": "string",
- "next": "string"
}, - "member": [
- {
- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "dashboard",
- "data": {
- "property1": "string",
- "property2": "string"
}, - "calculatedAt": "string"
}
]
}Retrieve all available metrics for the specified period and optional filters.
| period | string Default: "today" Enum: "today" "yesterday" "this_week" "last_week" "this_month" "last_month" "custom" Example: period=this_week Time period for metrics aggregation |
| dateFrom | string <date> Example: dateFrom=2024-06-01 Custom period start date (required if period=custom) |
| dateTo | string <date> Example: dateTo=2024-06-30 Custom period end date (required if period=custom) |
| carrierId | string <uuid> Example: carrierId=01912345-6789-7abc-def0-123456789abc Filter metrics by carrier UUID |
| includeComparison | boolean Default: false Example: includeComparison=true Include comparison with previous period |
| page | integer Default: 1 The collection page number |
{- "totalItems": 0,
- "search": {
- "@type": "string",
- "template": "string",
- "variableRepresentation": "string",
- "mapping": [
- {
- "@type": "string",
- "variable": "string",
- "property": "string",
- "required": true
}
]
}, - "view": {
- "@id": "string",
- "@type": "string",
- "first": "string",
- "last": "string",
- "previous": "string",
- "next": "string"
}, - "member": [
- {
- "@context": "string",
- "@id": "string",
- "@type": "string",
- "name": "total_revenue",
- "label": "On-Time Delivery Rate",
- "description": "Percentage of deliveries completed within the scheduled time window",
- "value": 94.5,
- "unit": "percent",
- "previousValue": 92.3,
- "change": 2.2,
- "changePercent": 2.38,
- "trend": "up",
- "trendIsPositive": true,
- "period": "this_week",
- "periodStart": "2024-06-10",
- "periodEnd": "2024-06-16",
- "breakdown": {
- "2024-06-10": 95.2,
- "2024-06-11": 93.8,
- "2024-06-12": 94.1
}, - "calculatedAt": "2024-06-16T12:00:00+00:00"
}
]
}Retrieve a summary dashboard with key metrics and trends.
| carrierId | string <uuid> Example: carrierId=01912345-6789-7abc-def0-123456789abc Filter summary by carrier UUID |
| page | integer Default: 1 The collection page number |
{- "totalItems": 0,
- "search": {
- "@type": "string",
- "template": "string",
- "variableRepresentation": "string",
- "mapping": [
- {
- "@type": "string",
- "variable": "string",
- "property": "string",
- "required": true
}
]
}, - "view": {
- "@id": "string",
- "@type": "string",
- "first": "string",
- "last": "string",
- "previous": "string",
- "next": "string"
}, - "member": [
- {
- "@context": "string",
- "@id": "string",
- "@type": "string",
- "name": "total_revenue",
- "label": "On-Time Delivery Rate",
- "description": "Percentage of deliveries completed within the scheduled time window",
- "value": 94.5,
- "unit": "percent",
- "previousValue": 92.3,
- "change": 2.2,
- "changePercent": 2.38,
- "trend": "up",
- "trendIsPositive": true,
- "period": "this_week",
- "periodStart": "2024-06-10",
- "periodEnd": "2024-06-16",
- "breakdown": {
- "2024-06-10": 95.2,
- "2024-06-11": 93.8,
- "2024-06-12": 94.1
}, - "calculatedAt": "2024-06-16T12:00:00+00:00"
}
]
}Retrieve a single metric by name with detailed breakdown.
| name required | string Enum: "total_shipments" "total_revenue" "average_order_value" "total_operational_cost" "revenue_by_customer" Example: total_revenue Metric name |
| period | string Default: "today" Enum: "today" "yesterday" "this_week" "last_week" "this_month" "last_month" "custom" Example: period=this_week Time period for metric aggregation |
| dateFrom | string <date> Example: dateFrom=2024-06-01 Custom period start date |
| dateTo | string <date> Example: dateTo=2024-06-30 Custom period end date |
| carrierId | string <uuid> Example: carrierId=01912345-6789-7abc-def0-123456789abc Filter metric by carrier UUID |
| groupBy | string Enum: "day" "week" "month" "carrier" "driver" Example: groupBy=day Group breakdown by dimension |
{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "name": "total_revenue",
- "label": "On-Time Delivery Rate",
- "description": "Percentage of deliveries completed within the scheduled time window",
- "value": 94.5,
- "unit": "percent",
- "previousValue": 92.3,
- "change": 2.2,
- "changePercent": 2.38,
- "trend": "up",
- "trendIsPositive": true,
- "period": "this_week",
- "periodStart": "2024-06-10",
- "periodEnd": "2024-06-16",
- "breakdown": {
- "2024-06-10": 95.2,
- "2024-06-11": 93.8,
- "2024-06-12": 94.1
}, - "calculatedAt": "2024-06-16T12:00:00+00:00"
}Retrieve on-time delivery performance metrics with target comparison.
| dateFrom | string <date> Example: dateFrom=2024-06-01 Start date for the period (YYYY-MM-DD) |
| dateTo | string <date> Example: dateTo=2024-06-30 End date for the period (YYYY-MM-DD) |
| target | number <float> Default: 95 Example: target=95 Target on-time percentage for comparison |
| carrierId | string <uuid> Example: carrierId=01912345-6789-7abc-def0-123456789abc Filter by carrier UUID |
{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "dashboard",
- "data": {
- "property1": "string",
- "property2": "string"
}, - "calculatedAt": "string"
}Retrieve a paginated list of generated reports with optional filters.
| type | string Enum: "cost_analysis" "customer_metrics" Example: type=cost_analysis Filter by report type |
| status | string Enum: "pending" "generating" "completed" "failed" "expired" Example: status=completed Filter by report status |
| dateFrom | string <date> Example: dateFrom=2024-06-01 Filter reports created from this date (inclusive) |
| dateTo | string <date> Example: dateTo=2024-06-30 Filter reports created up to this date (inclusive) |
| page | integer >= 1 Default: 1 Example: page=1 Page number for pagination |
| itemsPerPage | integer [ 1 .. 100 ] Default: 30 Example: itemsPerPage=30 Number of items per page |
{- "totalItems": 0,
- "search": {
- "@type": "string",
- "template": "string",
- "variableRepresentation": "string",
- "mapping": [
- {
- "@type": "string",
- "variable": "string",
- "property": "string",
- "required": true
}
]
}, - "view": {
- "@id": "string",
- "@type": "string",
- "first": "string",
- "last": "string",
- "previous": "string",
- "next": "string"
}, - "member": [
- {
- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "01912345-6789-7abc-def0-123456789abc",
- "name": "June 2024 Delivery Performance",
- "type": "cost_analysis",
- "status": "pending",
- "format": "json",
- "dateFrom": "2024-06-01",
- "dateTo": "2024-06-30",
- "carrierId": "01912345-6789-7abc-def0-123456789abc",
- "progressPercent": 100,
- "errorMessage": "Insufficient data for the specified period",
- "fileSizeBytes": 102400,
- "downloadUrl": "/api/v1/analytics/reports/01912345-6789-7abc-def0-123456789abc/download",
- "expiresAt": "2024-07-15T14:30:00+00:00",
- "generationStartedAt": "2024-06-15T14:30:00+00:00",
- "generationCompletedAt": "2024-06-15T14:31:00+00:00",
- "createdAt": "2024-06-15T14:30:00+00:00",
- "updatedAt": "2024-06-15T14:31:00+00:00"
}
]
}Request generation of a new analytics report. The report will be generated asynchronously.
Report generation parameters
| type required | string Enum: "cost_analysis" "customer_metrics" Type of report to generate |
| dateFrom required | string <date> Start date for report data (inclusive) |
| dateTo required | string <date> End date for report data (inclusive) |
| carrierId | string or null <uuid> Optional carrier UUID to filter report data |
| format | string Default: "json" Enum: "json" "csv" "pdf" Output format for the report |
| name | string or null <= 255 characters Optional custom name for the report |
{- "type": "cost_analysis",
- "dateFrom": "2024-06-01",
- "dateTo": "2024-06-30",
- "carrierId": "01912345-6789-7abc-def0-123456789abc",
- "format": "json",
- "name": "June 2024 Delivery Performance"
}{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "01912345-6789-7abc-def0-123456789abc",
- "name": "June 2024 Delivery Performance",
- "type": "cost_analysis",
- "status": "pending",
- "format": "json",
- "dateFrom": "2024-06-01",
- "dateTo": "2024-06-30",
- "carrierId": "01912345-6789-7abc-def0-123456789abc",
- "progressPercent": 100,
- "errorMessage": "Insufficient data for the specified period",
- "fileSizeBytes": 102400,
- "downloadUrl": "/api/v1/analytics/reports/01912345-6789-7abc-def0-123456789abc/download",
- "expiresAt": "2024-07-15T14:30:00+00:00",
- "generationStartedAt": "2024-06-15T14:30:00+00:00",
- "generationCompletedAt": "2024-06-15T14:31:00+00:00",
- "createdAt": "2024-06-15T14:30:00+00:00",
- "updatedAt": "2024-06-15T14:31:00+00:00"
}Retrieve a single report by its UUID. Includes report data if generation is complete.
| id required | string <uuid> Example: 01912345-6789-7abc-def0-123456789abc Report UUID |
{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "01912345-6789-7abc-def0-123456789abc",
- "name": "June 2024 Delivery Performance",
- "type": "cost_analysis",
- "status": "pending",
- "format": "json",
- "dateFrom": "2024-06-01",
- "dateTo": "2024-06-30",
- "carrierId": "01912345-6789-7abc-def0-123456789abc",
- "progressPercent": 100,
- "errorMessage": "Insufficient data for the specified period",
- "fileSizeBytes": 102400,
- "downloadUrl": "/api/v1/analytics/reports/01912345-6789-7abc-def0-123456789abc/download",
- "expiresAt": "2024-07-15T14:30:00+00:00",
- "generationStartedAt": "2024-06-15T14:30:00+00:00",
- "generationCompletedAt": "2024-06-15T14:31:00+00:00",
- "createdAt": "2024-06-15T14:30:00+00:00",
- "updatedAt": "2024-06-15T14:31:00+00:00"
}Download the report file. Only available for completed reports.
| id required | string <uuid> Example: 01912345-6789-7abc-def0-123456789abc Report UUID |
{- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "01912345-6789-7abc-def0-123456789abc",
- "name": "June 2024 Delivery Performance",
- "type": "cost_analysis",
- "status": "pending",
- "format": "json",
- "dateFrom": "2024-06-01",
- "dateTo": "2024-06-30",
- "carrierId": "01912345-6789-7abc-def0-123456789abc",
- "progressPercent": 100,
- "errorMessage": "Insufficient data for the specified period",
- "fileSizeBytes": 102400,
- "downloadUrl": "/api/v1/analytics/reports/01912345-6789-7abc-def0-123456789abc/download",
- "expiresAt": "2024-07-15T14:30:00+00:00",
- "generationStartedAt": "2024-06-15T14:30:00+00:00",
- "generationCompletedAt": "2024-06-15T14:31:00+00:00",
- "createdAt": "2024-06-15T14:30:00+00:00",
- "updatedAt": "2024-06-15T14:31:00+00:00"
}Retrieve delivery status distribution breakdown with counts and percentages.
| dateFrom | string <date> Example: dateFrom=2024-06-01 Start date for the period (YYYY-MM-DD) |
| dateTo | string <date> Example: dateTo=2024-06-30 End date for the period (YYYY-MM-DD) |
| carrierId | string <uuid> Example: carrierId=01912345-6789-7abc-def0-123456789abc Filter by carrier UUID |
| page | integer Default: 1 The collection page number |
{- "totalItems": 0,
- "search": {
- "@type": "string",
- "template": "string",
- "variableRepresentation": "string",
- "mapping": [
- {
- "@type": "string",
- "variable": "string",
- "property": "string",
- "required": true
}
]
}, - "view": {
- "@id": "string",
- "@type": "string",
- "first": "string",
- "last": "string",
- "previous": "string",
- "next": "string"
}, - "member": [
- {
- "@context": "string",
- "@id": "string",
- "@type": "string",
- "id": "dashboard",
- "data": {
- "property1": "string",
- "property2": "string"
}, - "calculatedAt": "string"
}
]
}Billing Overview Analytics Resource.
Returns billing statistics: total invoices, paid, pending, overdue counts, and total revenue. Queries the billing_invoice_views read model table.
Retrieve aggregated billing statistics including invoice counts by status (total, paid, pending, overdue) and total revenue from the billing_invoice_views table.
| startDate | string <date> Example: startDate=2024-06-01 Start date for the period (YYYY-MM-DD). Defaults to 30 days ago. |
| endDate | string <date> Example: endDate=2024-06-30 End date for the period (YYYY-MM-DD). Defaults to today. |
{- "totalInvoices": 0,
- "paid": 0,
- "pending": 0,
- "overdue": 0,
- "totalRevenue": 0,
- "startDate": "2019-08-24",
- "endDate": "2019-08-24",
- "calculatedAt": "2019-08-24T14:15:22Z"
}GET /api/dashboard/widgets — descriptors + role-default layout for the caller.
Singleton id="me" so the resource lives at /api/dashboard/widgets (no plural, no {id} variant). The UI hits this on dashboard mount, intersects descriptors with the persisted layout from GET /api/dashboard/layout, and falls back to defaultLayout when no persisted layout exists.
Retrieve aggregated dashboard data from multiple bounded contexts including routes, shipments, invoices, vehicles, and drivers. Returns KPI metrics, delivery trends, status breakdown, recent routes, billing overview, and shipments by carrier.
| startDate | string <date> Example: startDate=2024-06-01 Start date for the dashboard period (YYYY-MM-DD format). Defaults to 30 days ago. |
| endDate | string <date> Example: endDate=2024-06-30 End date for the dashboard period (YYYY-MM-DD format). Defaults to today. |
| carrierId | string <uuid> Example: carrierId=01912345-6789-7abc-def0-123456789abc Optional carrier UUID to filter data by a specific carrier |
{- "stats": {
- "activeRoutes": 0,
- "pendingRoutes": 0,
- "completedRoutes": 0,
- "pendingShipments": 0,
- "inTransitShipments": 0,
- "deliveredToday": 0,
- "totalDelivered": 0,
- "failedShipments": 0,
- "onTimeRate": 0.1,
- "pendingInvoices": 0,
- "totalRevenue": 0
}, - "deliveryTrends": [
- {
- "date": "2019-08-24",
- "deliveries": 0,
- "completed": 0,
- "failed": 0
}
], - "statusBreakdown": [
- {
- "status": "string",
- "count": 0,
- "percentage": 0.1,
- "color": "string"
}
], - "recentRoutes": [
- {
- "id": "string",
- "code": "string",
- "date": "2019-08-24",
- "status": "string",
- "carrier": "string",
- "nodeCount": 0
}
], - "billingOverview": {
- "pendingAmount": 0,
- "paidThisMonth": 0,
- "overdueCount": 0
}, - "shipmentsByCarrier": [
- {
- "carrierId": "string",
- "carrierName": "string",
- "count": 0
}
], - "dateRange": {
- "start": "2019-08-24",
- "end": "2019-08-24"
}, - "calculatedAt": "2019-08-24T14:15:22Z"
}