APEXReference

Batch estimation

POST /estimate/batch prices up to 500 lanes in one call. Items are deduplicated and all lookups are batched, so a 500-item request is far cheaper than 500 single calls. Items fail independently.

POST /api/v1/estimate/batch prices up to 500 lanes in a single request. Items are deduplicated internally — repeated lanes cost one lookup — and all location, corridor, and statistics lookups are batched, so a 500-item request is far cheaper than 500 single estimate calls. Use it to enrich a whole set of shipments at once.

Request

curl -X POST https://apex.tovr.eu/api/v1/estimate/batch \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-api-key" \
  -d '{
    "items": [
      { "index": 0, "request": { "loading_country": "PL", "loading_postal_code": "50-148", "unloading_country": "DE", "unloading_postal_code": "60311", "distance_km": 700 } },
      { "index": 1, "request": { "loading_country": "DE", "unloading_country": "FR", "distance_km": 900 } }
    ]
  }'

Each item is { "index": n, "request": { …estimate request… } }. The request object takes the same fields as a single estimate.

Response

{
  "results": [
    {
      "index": 0,
      "result": {
        "estimated_price_eur": 1168.3,
        "estimated_price_per_km": 1.669,
        "confidence_score": 0.87,
        "quality_status": "HIGH",
        "match_level": "exact",
        "observation_count": 3496,
        "data_freshness_hours": 237,
        "p25_price_per_km": 1.5935,
        "median_price_per_km": 1.669,
        "p75_price_per_km": 1.8707
      }
    },
    {
      "index": 1,
      "result": {
        "estimated_price_eur": 1725.21,
        "match_level": "country_pair",
        "confidence_score": 0.53,
        "quality_status": "HIGH",
        "estimated_price_per_km": 1.9169,
        "p25_price_per_km": 1.7235,
        "median_price_per_km": 1.9169,
        "p75_price_per_km": 2.1404,
        "observation_count": 8554,
        "data_freshness_hours": 240
      }
    }
  ]
}

Each result echoes your index, so ordering never matters. Items fail independently — a failed item carries error instead of result:

{
  "results": [
    { "index": 0, "result": { "estimated_price_eur": 1168.3 } },
    { "index": 1, "error": "distance_km must be positive" }
  ]
}

Always iterate the results and check for error per item. Batch-level failures (malformed body, more than 500 items) return a single error — see Errors.

On this page