Backend & APIs
AuraScore 91/100

Dynamic Dispatch and Multi-Stop Route Optimization API Spec

Design high-performance asynchronous API endpoints for complex vehicle routing, capacity constraints, and dynamic dispatching.

Use this spec when building backend interfaces for algorithmic vehicle routing problem (VRP) engines in parcel, freight, or passenger transit. It generates schema definitions, polling contracts, and compute boundary specs.

Template

Role: Lead Logistics Optimization Engineer and API Architect.

Context

  • Operational Constraints Matrix: {{routing_constraints}}
  • Maximum Concurrent Optimization Jobs: {{dispatch_concurrency_target}}
  • API Architectural Style: {{api_style}}
  • Third-Party Carrier Payload Format: {{carrier_integration_format}}
  • Solver Execution Timeout: {{sla_timeout_ms}}
  • Degraded Service Strategy: {{fallback_strategy}}

Task

Produce an API specification and execution lifecycle design for a multi-stop vehicle routing and dynamic dispatching backend service capable of evaluating complex load, time-window, and driver hours-of-service constraints.

Method

  1. Map {{routing_constraints}} into a normalized input schema supporting pickup/delivery time windows, vehicle cubing, and rest requirements.
  2. Design the interface boundaries conforming to {{api_style}} with explicit asynchronous job submission, progress polling, and webhook completion patterns.
  3. Model the solver lifecycle state machine (Submitted, Processing, FeasibleFound, OptimalFound, Failed, TimedOut).
  4. Specify deterministic error responses, partial solution handling, and fallback execution when processing hits {{sla_timeout_ms}} using {{fallback_strategy}}.
  5. Create conversion adapters for legacy transportation systems communicating via {{carrier_integration_format}}.
  6. Define rate limiting, queue isolation tiers, and worker pool resource allocation for {{dispatch_concurrency_target}} concurrent runs.
  7. Detail caching strategies for matrix distance/duration queries to minimize redundant routing engine computations.

Constraints

  • MUST write all interface schemas in production-valid OpenAPI 3.1 or GraphQL SDL depending on {{api_style}}.
  • MUST NOT allow synchronous blocking calls on routing jobs estimated to exceed 250ms computation time.
  • Payload validation MUST reject mathematically impossible constraints prior to enqueuing the optimization solver.
  • All timestamp fields MUST strictly follow ISO 8601 with explicit timezone offsets.

Output format

Deliver an API Specification containing:

  1. Interface Schema Definitions (OpenAPI 3.1 YAML or GraphQL SDL with full type declarations)
  2. Asynchronous Job Lifecycle State Machine (Mermaid state diagram)
  3. Edge-Case Matrix (handling infeasible routes, driver hour violations, and vehicle capacity overflow)
  4. Carrier Translation Layer (field mapping rules for {{carrier_integration_format}})
  5. Performance & Concurrency Controls (worker pool sizing and token bucket rate limits) Keep overall output between 1,200 and 2,000 words.

Self-review

  • Ensure all variables in {{routing_constraints}} are represented as validated fields in the request schema.
  • Check that the asynchronous polling headers (e.g., Retry-After) and webhook signature verifications are defined.
  • Verify that the degraded fallback mechanism handles solver timeouts without data corruption.
AuraScore breakdown
91/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering12/12 · Strong

Hard boundaries — what the model must and must not do.

Output specification14/14 · Strong

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness5/5 · Strong

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

developers
developers-backend-apis
transport-logistics
api-design
route-optimization
logistics