{
  "jobs": [
    {"name": "delivery-1", "location": {"latitude": 51.1279, "longitude": 17.0485}},
    {"name": "delivery-2", "location": {"latitude": 51.1350, "longitude": 17.0600}}
  ],
  "resources": [{
    "name": "driver-1",
    "category": "CAR",
    "shift": {
      "from": "2025-01-01T08:00:00Z",
      "to": "2025-01-01T18:00:00Z"
    }
  }],
  "customDistanceMatrices": {
    "profileMatrices": {
      "CAR": {
        "8": "matrix-car-morning-rush",    // 8 AM matrix ID
        "12": "matrix-car-midday",        // 12 PM matrix ID
        "16": "matrix-car-evening-rush"   // 4 PM matrix ID
      }
    }
  }
}

External Distance Matrices

Upload pre-computed distance matrices to routing.solvice.io/table/upload and reference them by ID in your VRP requests for faster processing and custom traffic patterns.

Basic Configuration

Configure different distance matrices for different times of day:
{
  "jobs": [
    {"name": "delivery-1", "location": {"latitude": 51.1279, "longitude": 17.0485}},
    {"name": "delivery-2", "location": {"latitude": 51.1350, "longitude": 17.0600}}
  ],
  "resources": [{
    "name": "driver-1",
    "category": "CAR",
    "shift": {
      "from": "2025-01-01T08:00:00Z",
      "to": "2025-01-01T18:00:00Z"
    }
  }],
  "customDistanceMatrices": {
    "profileMatrices": {
      "CAR": {
        "8": "matrix-car-morning-rush",    // 8 AM matrix ID
        "12": "matrix-car-midday",        // 12 PM matrix ID
        "16": "matrix-car-evening-rush"   // 4 PM matrix ID
      }
    }
  }
}

Matrix Upload

Upload your distance matrix to get an ID:
{
  "coordinates": [
    [4.9, 50.2],   // [longitude, latitude]
    [4.8, 50.4]
  ],
  "durations": [
    [0, 1976.1],
    [2010.2, 0]
  ],
  "vehicleType": "CAR",
  "departureTime": "2025-01-01T08:00:00"
}
Then reference the returned matrix ID:
{
  "customDistanceMatrices": {
    "profileMatrices": {
      "CAR": {
        "8": "matrix-id-from-upload-response"
      }
    }
  }
}

Multi-Vehicle Configuration

Different vehicle types can use different routing matrices:
{
  "customDistanceMatrices": {
    "profileMatrices": {
      "CAR": {
        "6": "car-early-commute",
        "9": "car-midday-traffic",
        "16": "car-evening-rush"
      },
      "TRUCK": {
        "6": "truck-early-delivery",
        "12": "truck-midday-routes"
      }
    }
  }
}

API Reference

profileMatrices
object
required
Map of vehicle profiles to time-based matrix configurations. Keys are vehicle categories (CAR, TRUCK, BIKE, etc.)
matrixServiceUrl
string
Optional URL for custom matrix service endpoint