4klyft API (1.0.0)

Download OpenAPI specification:

4klyft API Support: [email protected] License: Proprietary

Commerce and order-fulfilment platform API for 4klyft.

Overview

This API provides endpoints for managing:

  • Catalog (PIM/DAM): products, variants, attributes, options, categories, brands, collections, assortments, and media
  • Sales: orders, customers, merchants, sales channels, and channel order import
  • Inventory: stock items, levels, lots, and serial units across custodians
  • Warehousing & Operations: goods receipt/issue, holds, and custodian operations
  • Fulfilment: fulfilment orders dispatched to third-party (3PL) providers
  • Shipping: carriers, shipments, labels, tracking, returns, and proof of delivery
  • Finance & Billing: payments, settlements, invoices, credit notes, tax, and subscriptions
  • Integration: sales-channel connections, providers, webhooks, and catalog/order sync
  • Documents: operational document generation and requests
  • Storage: file/drive storage with chunked upload and signed access
  • Identity & Access (IAM): authentication, users, roles, permissions, and tenants
  • Platform services: notifications, scheduling, numbering, data exchange, analytics, and workspace tables & views

Authentication

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>

Rate Limiting

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 size
  • X-RateLimit-Remaining — tokens left in the current window
  • X-RateLimit-Reset — Unix timestamp when a token next frees up

Exceeding 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.

Error Handling

The API uses RFC 7807 Problem Details for error responses.

Analytics

Represents an analytics report.

Reports provide aggregated analytics data for various aspects of delivery operations, including performance metrics, cost analysis, and SLA compliance.

Get activity feed

Retrieve recent activity feed items.

Authorizations:
Bearer
query Parameters
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

Responses

Get billing overview statistics

Retrieve aggregated billing statistics including invoice counts by status (total, paid, pending, overdue) and total revenue from the billing_invoice_views table.

Authorizations:
Bearer
query Parameters
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.

Responses

Response samples

Content type
application/json
{
  • "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 dashboard metrics

Retrieve all KPI metrics for the analytics dashboard with optional comparison to previous period.

Authorizations:
Bearer
query Parameters
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

Responses

Response samples

Content type
{
  • "@context": "string",
  • "@id": "string",
  • "@type": "string",
  • "id": "dashboard",
  • "data": {
    },
  • "calculatedAt": "string"
}

Get comprehensive dashboard data

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.

Authorizations:
Bearer
query Parameters
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

Responses

Response samples

Content type
application/json
{
  • "stats": {
    },
  • "deliveryTrends": [
    ],
  • "statusBreakdown": [
    ],
  • "recentRoutes": [
    ],
  • "billingOverview": {
    },
  • "shipmentsByCarrier": [
    ],
  • "dateRange": {
    },
  • "calculatedAt": "2019-08-24T14:15:22Z"
}

Get all metrics

Retrieve all available metrics for the specified period and optional filters.

Authorizations:
Bearer
query Parameters
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

Responses

Response samples

Content type
{
  • "totalItems": 0,
  • "search": {
    },
  • "view": {
    },
  • "member": [
    ]
}

Get metrics summary

Retrieve a summary dashboard with key metrics and trends.

Authorizations:
Bearer
query Parameters
carrierId
string <uuid>
Example: carrierId=01912345-6789-7abc-def0-123456789abc

Filter summary by carrier UUID

page
integer
Default: 1

The collection page number

Responses

Response samples

Content type
{
  • "totalItems": 0,
  • "search": {
    },
  • "view": {
    },
  • "member": [
    ]
}

Get a specific metric

Retrieve a single metric by name with detailed breakdown.

Authorizations:
Bearer
path Parameters
name
required
string
Enum: "total_shipments" "total_revenue" "average_order_value" "total_operational_cost" "revenue_by_customer"
Example: total_revenue

Metric name

query Parameters
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

Responses

Response samples

Content type
{
  • "@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": {
    },
  • "calculatedAt": "2024-06-16T12:00:00+00:00"
}

Get on-time performance

Retrieve on-time delivery performance metrics with target comparison.

Authorizations:
Bearer
query Parameters
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

Responses

Response samples

Content type
{
  • "@context": "string",
  • "@id": "string",
  • "@type": "string",
  • "id": "dashboard",
  • "data": {
    },
  • "calculatedAt": "string"
}

List reports

Retrieve a paginated list of generated reports with optional filters.

Authorizations:
Bearer
query Parameters
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

Responses

Response samples

Content type
{
  • "totalItems": 0,
  • "search": {
    },
  • "view": {
    },
  • "member": [
    ]
}

Generate a report

Request generation of a new analytics report. The report will be generated asynchronously.

Authorizations:
Bearer
Request Body schema: application/json
required

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

Responses

Request samples

Content type
application/json
{
  • "type": "cost_analysis",
  • "dateFrom": "2024-06-01",
  • "dateTo": "2024-06-30",
  • "carrierId": "01912345-6789-7abc-def0-123456789abc",
  • "format": "json",
  • "name": "June 2024 Delivery Performance"
}

Response samples

Content type
{
  • "@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"
}

Get a report

Retrieve a single report by its UUID. Includes report data if generation is complete.

Authorizations:
Bearer
path Parameters
id
required
string <uuid>
Example: 01912345-6789-7abc-def0-123456789abc

Report UUID

Responses

Response samples

Content type
{
  • "@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 a report

Download the report file. Only available for completed reports.

Authorizations:
Bearer
path Parameters
id
required
string <uuid>
Example: 01912345-6789-7abc-def0-123456789abc

Report UUID

Responses

Response samples

Content type
{
  • "@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"
}

Get status breakdown

Retrieve delivery status distribution breakdown with counts and percentages.

Authorizations:
Bearer
query Parameters
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

Responses

Response samples

Content type
{
  • "totalItems": 0,
  • "search": {
    },
  • "view": {
    },
  • "member": [
    ]
}

Billing

Billing Overview Analytics Resource.

Returns billing statistics: total invoices, paid, pending, overdue counts, and total revenue. Queries the billing_invoice_views read model table.

Get billing overview statistics

Retrieve aggregated billing statistics including invoice counts by status (total, paid, pending, overdue) and total revenue from the billing_invoice_views table.

Authorizations:
Bearer
query Parameters
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.

Responses

Response samples

Content type
application/json
{
  • "totalInvoices": 0,
  • "paid": 0,
  • "pending": 0,
  • "overdue": 0,
  • "totalRevenue": 0,
  • "startDate": "2019-08-24",
  • "endDate": "2019-08-24",
  • "calculatedAt": "2019-08-24T14:15:22Z"
}

Dashboard

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.

Get comprehensive dashboard data

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.

Authorizations:
Bearer
query Parameters
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

Responses

Response samples

Content type
application/json
{
  • "stats": {
    },
  • "deliveryTrends": [
    ],
  • "statusBreakdown": [
    ],
  • "recentRoutes": [
    ],
  • "billingOverview": {
    },
  • "shipmentsByCarrier": [
    ],
  • "dateRange": {
    },
  • "calculatedAt": "2019-08-24T14:15:22Z"
}