Optimize: Validate

POST /api/v1/optimize/validate

Run all semantic validation checks on a request without invoking the solver. Fast, and the recommended first step when building or debugging a new request shape.

Description

Pydantic already validates structure and field types on parse. This endpoint additionally runs validate_request(): duplicate ID detection across resources/jobs/shipments/depots/dump-stations, matrix shape and index-range checks, referential integrity (every depot/resource/job ID referenced elsewhere must exist), time window ordering, and circular precedence detection in relations.

Request body

Full OptimizationRequest.

Response

{ "valid": true, "message": "Request is valid" }

Examples

curl -X POST https://api.fieldgenius.be/api/v1/optimize/validate \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-adapter-key" \
  -H "X-Client-Key: your-client-key" \
  -d @candidate_request.json
import httpx

headers = {"X-API-Key": "your-adapter-key", "X-Client-Key": "your-client-key"}
resp = httpx.post("https://api.fieldgenius.be/api/v1/optimize/validate", json=payload, headers=headers)
if resp.status_code == 200:
    print("valid")
else:
    print(resp.json()["detail"])

Errors

StatusCodeResolution
422VALIDATION_ERROR / UNKNOWN_REFERENCE / DUPLICATE_ID / INVALID_TIME_WINDOW / CIRCULAR_PRECEDENCE / MATRIX_SIZE_MISMATCHThe detail.message describes exactly what failed and detail.field often names the offending path.

FieldGenius VRP API documentation. Generated from the engineering source of truth (.tex docs and app/ source).