Handover and on-time shipping

Shipped status and on-time reporting from evidenced carrier handover of every required unit, never from labels, manifests or delivery dates.

Request with "decision": "handover" and one of these operations: mark_shipped, report_on_time.

Clauses applied

  • handover.fulfilled: FulfilledAt is the latest evidenced tender needed for all non-cancelled units, including split shipments; calendar ShipDate and manifest transmission cannot satisfy the cutoff.
  • handover.transmitted: Transmitted means acknowledged submission, not pickup.
  • handover.shipped: Orders become Shipped only when every non-cancelled unit is tendered; FulfilledAt captures the final required tender.
  • handover.manifest: Manifest close freezes a batch; actual tender alone authorises the warehouse issue, and delivery confirmation does not issue again.

Evidence questions

handover_by_cutoff@1

This is the evidence recorded for one outbound shipment. Does it show the carrier taking physical possession of the shipment, and was that by the cutoff given?

AnswerMeaning
before_cutoffThe carrier took the shipment at or before the cutoff.
after_cutoffThe carrier took the shipment after the cutoff.
time_unknownThe carrier took the shipment, but the evidence does not show whether it was by the cutoff.
no_handoverIt does not show the carrier taking the shipment: only a label print, a manifest, a booking or a scheduled pickup, or the shipment still at the dock.

Examples

A split order whose last carton left after the cutoff

{
  "decision": "handover",
  "proposal": {
    "operation": "report_on_time",
    "on_time": true
  },
  "order": {
    "id": "SO-77105",
    "cutoff_at": "2026-10-02T17:00:00-04:00",
    "units": "6",
    "timezone": "America/New_York"
  },
  "shipments": [
    {
      "id": "SH-1",
      "units": "4",
      "pickup_scan_at": "2026-10-02T16:55:00-04:00"
    },
    {
      "id": "SH-2",
      "units": "2",
      "manifest_closed_at": "2026-10-02T16:30:00-04:00",
      "evidence": "Driver scan export, route 412: SH-2 PU 17:05 EDT, signed K. Morales"
    }
  ]
}

Response from the rules with no model loaded, so every question abstains.

{
  "verdict": "review",
  "next": {
    "action": "confirm_handover",
    "text": "The tender evidence for SH-2 does not settle whether or when the carrier took it.",
    "role": "Shipping Clerk"
  },
  "questions": [
    {
      "ask": "shipments/1",
      "question": "handover_by_cutoff@1",
      "status": "model_unavailable",
      "evidence": [
        "/shipments/1/evidence"
      ]
    }
  ]
}

Run this example in the consoleDownload the request

Call it from your code

Each snippet sends the first example above to the hosted API with the key in RACKSORT_API_KEY and prints the verdict and the next step. Create an account, then create a key. The quickstart walks through the first request.

curl

export RACKSORT_API_KEY="paste-your-key-here"
curl https://racksort.com/api/v1/decide \
  -H "Authorization: Bearer $RACKSORT_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'EOF'
{
  "decision": "handover",
  "proposal": {
    "operation": "report_on_time",
    "on_time": true
  },
  "order": {
    "id": "SO-77105",
    "cutoff_at": "2026-10-02T17:00:00-04:00",
    "units": "6",
    "timezone": "America/New_York"
  },
  "shipments": [
    {
      "id": "SH-1",
      "units": "4",
      "pickup_scan_at": "2026-10-02T16:55:00-04:00"
    },
    {
      "id": "SH-2",
      "units": "2",
      "manifest_closed_at": "2026-10-02T16:30:00-04:00",
      "evidence": "Driver scan export, route 412: SH-2 PU 17:05 EDT, signed K. Morales"
    }
  ]
}
EOF

Python

Python 3.8 or newer, standard library only. Keep the User-Agent header: requests with Python's default one are refused. With requests or httpx it is not needed.

import json
import os
import urllib.error
import urllib.request

request = {
    "decision": "handover",
    "proposal": {
        "operation": "report_on_time",
        "on_time": True,
    },
    "order": {
        "id": "SO-77105",
        "cutoff_at": "2026-10-02T17:00:00-04:00",
        "units": "6",
        "timezone": "America/New_York",
    },
    "shipments": [
        {
            "id": "SH-1",
            "units": "4",
            "pickup_scan_at": "2026-10-02T16:55:00-04:00",
        },
        {
            "id": "SH-2",
            "units": "2",
            "manifest_closed_at": "2026-10-02T16:30:00-04:00",
            "evidence": "Driver scan export, route 412: SH-2 PU 17:05 EDT, signed K. Morales",
        },
    ],
}

call = urllib.request.Request(
    "https://racksort.com/api/v1/decide",
    data=json.dumps(request).encode(),
    headers={
        "Authorization": f"Bearer {os.environ['RACKSORT_API_KEY']}",
        "Content-Type": "application/json",
        # Cloudflare refuses Python's default User-Agent, so name the client.
        "User-Agent": "racksort-example/1.0",
    },
)
try:
    with urllib.request.urlopen(call, timeout=30) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise SystemExit(json.load(error)["error"]["message"])
print(result["verdict"], "-", result["next"]["text"])

TypeScript

Node.js 18 or newer. Save it as decide.mts and run npx tsx decide.mts.

type Verdict = "allow" | "replay" | "reject" | "review" | "reconcile";
interface Decision {
  verdict: Verdict;
  state?: string;
  next: { action: string; text: string; role?: string };
}

const request = {
  "decision": "handover",
  "proposal": {
    "operation": "report_on_time",
    "on_time": true
  },
  "order": {
    "id": "SO-77105",
    "cutoff_at": "2026-10-02T17:00:00-04:00",
    "units": "6",
    "timezone": "America/New_York"
  },
  "shipments": [
    {
      "id": "SH-1",
      "units": "4",
      "pickup_scan_at": "2026-10-02T16:55:00-04:00"
    },
    {
      "id": "SH-2",
      "units": "2",
      "manifest_closed_at": "2026-10-02T16:30:00-04:00",
      "evidence": "Driver scan export, route 412: SH-2 PU 17:05 EDT, signed K. Morales"
    }
  ]
};

const response = await fetch("https://racksort.com/api/v1/decide", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.RACKSORT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(request),
});
const body = await response.json();
if (!response.ok) throw new Error(body.error.message);
const result = body as Decision;
console.log(result.verdict, "-", result.next.text);

Request schema

{
  "type": "object",
  "required": [
    "decision",
    "proposal",
    "order"
  ],
  "additionalProperties": false,
  "properties": {
    "decision": {
      "const": "handover"
    },
    "proposal": {
      "type": "object",
      "required": [
        "operation"
      ],
      "additionalProperties": false,
      "properties": {
        "operation": {
          "type": "string",
          "enum": [
            "mark_shipped",
            "report_on_time"
          ]
        },
        "on_time": {
          "type": "boolean"
        },
        "as_of": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "order": {
      "type": "object",
      "required": [
        "id",
        "cutoff_at",
        "units"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "cutoff_at": {
          "type": "string",
          "format": "date-time"
        },
        "units": {
          "type": "string",
          "format": "decimal"
        },
        "timezone": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      }
    },
    "shipments": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "units"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "units": {
            "type": "string",
            "format": "decimal"
          },
          "pickup_scan_at": {
            "type": "string",
            "format": "date-time"
          },
          "evidence": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000
          },
          "label_printed_at": {
            "type": "string",
            "format": "date-time"
          },
          "manifest_closed_at": {
            "type": "string",
            "format": "date-time"
          },
          "manifest_transmitted_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "maxItems": 200
    }
  }
}