User Guide
This section explains how to think about an FG-API request and response — what a job actually is, what comes back, what constraints you can apply, and how to run solves asynchronously. It's conceptual; for exhaustive field-by-field documentation, see the API Reference.
The request/response cycle
Every interaction with FG-API follows the same shape: you describe a problem, the API solves it, and you get routes back.
- You describe the world. Resources (vehicles or crews) that can do work, jobs (and/or shipments) that need to be done, and the travel times/distances between locations. Everything else — time windows, capacities, skills, zones, breaks — is a constraint layered on top of that core triangle.
- FG-API normalizes and solves. Symbolic IDs become integer indices, missing matrices get computed automatically, and the solver searches for the lowest-cost feasible assignment of jobs to vehicle routes.
- You get routes, or reasons why not. The response always has a
status. Served jobs appear insideroutes[].activitieswith full timing and load detail. Anything the solver couldn't fit appears inunservedwith a specific reason code — never silently dropped.
The pages in this section walk through each side of that cycle: building a correct job, reading everything the response gives you, applying constraints deliberately, running the cycle asynchronously, and avoiding the most common mistakes.
In this section
Creating a Job
Location, demands, time windows, skills, mandatory/penalty/revenue tradeoffs, and the departure_time pinning mechanism.
Understanding the Response
Status values, route activities, unserved reasons, and the score breakdown — top to bottom.
Constraints
A survey of every constraint type: time windows, capacities, skills, zones, relations, breaks, and locks.
Webhooks & Async
Submitting long-running solves asynchronously and polling for status. Webhook notifications are accepted but not yet delivered.
Result Caching
How identical requests are served from a Redis-backed cache instead of re-solving, and how in-flight async duplicates are deduplicated.
Live Solve Tracking
Watching an async solve's progress while it runs, and recovering a best-found-so-far result when you cancel.
Durable Job Queue
How async job records survive a server restart or crash, with automatic recovery and a capped retry policy.
Best Practices
Sizing time limits, validating before solving, and structuring multi-day problems.
- New to FG-API? Start with Getting Started first.
- Need exact field definitions? Jump to OptimizationRequest and OptimizationResponse.