Public Distance Matrix
POST /v1/distance-matrix · X-API-Key
/v1/distance-matrixPublic Distance Matrix
Public Distance Matrix API (OSRM table, one normalized schema).
`distances_meters and durations_seconds are always
origin_count × destination_count. An unreachable pair is an
explicit null cell instead of a shortened array; per_cell_errors
distinguishes no_route (no duration) from distance_unavailable`
(OSRM returned a duration but no distance annotation).
- Credential
X-API-Key- Plane
https://api.bardiyamap.com- Billing
- 1 credit per cell (origins x destinations)
- Operation id
distanceMatrix
A cell the road network cannot reach is reported per cell instead of failing the whole matrix. Read errors before you read durations.
Parameters
Header parameters
| Name | Type | Required | Description |
|---|---|---|---|
Idempotency-Key | string | null | no | Opaque key that makes a retried POST safe. Reuse the same value for every retry of the same intent; a new value is a new chargeable operation. |
Request body
application/json · required
| Field | Type | Required | Notes |
|---|---|---|---|
destinations | PublicCoordinate[] | yes | The default deployment accepts at most 25 destinations and at most 625 elements (origins x destinations). A larger request is rejected with 413 request_too_large. The schema bound stays looser than the enforced limit so a deployment that raises MAPS_MAX_MATRIX_ORIGINS / MAPS_MAX_MATRIX_DESTINATIONS / MAPS_MAX_MATRIX_ELEMENTS is not rejected here; read the enforced values from GET /console/services quota or the documentation.<= 100 items |
origins | PublicCoordinate[] | yes | The default deployment accepts at most 25 origins and at most 625 elements (origins x destinations). A larger request is rejected with 413 request_too_large. The schema bound stays looser than the enforced limit so a deployment that raises MAPS_MAX_MATRIX_ORIGINS / MAPS_MAX_MATRIX_DESTINATIONS / MAPS_MAX_MATRIX_ELEMENTS is not rejected here; read the enforced values from GET /console/services quota or the documentation.<= 100 items |
profile | string | no | Travel profile used for every cell.<= 20 chars / default "driving" |
{
"profile": "driving"
}Request example
curl -X POST "https://api.bardiyamap.com/v1/distance-matrix" \
-H "X-API-Key: $BARDIYA_API_KEY" \
-H "Content-Type: application/json" \
--data '{"profile":"driving"}'Response 200 · DistanceMatrixResponse
| Field | Type | Required | Notes |
|---|---|---|---|
destination_count | integer | yes | |
distances_meters | number | null[][] | yes | Row-major table of metres; distances_meters[i][j] is origin i to destination j. A null cell means no route and is always accompanied by a matching per_cell_errors entry. |
durations_seconds | number | null[][] | yes | Row-major table of seconds; durations_seconds[i][j] is origin i to destination j. A null cell means no route. |
origin_count | integer | yes | |
per_cell_errors | MatrixCellError[] | no | Per-cell failures for cells OSRM could not compute. The table shape is never shortened: an unreachable pair remains an explicit null cell. |
Errors
| Status | Meaning |
|---|---|
400 | Request is malformed or a parameter is out of range |
401 | Missing or invalid credential |
403 | Credential is valid but lacks the required scope, or the request origin is not allowed |
404 | Resource not found or not visible to this credential's organization |
413 | Too many matrix origins, destinations or elements for this deployment. |
422 | Validation Error |
429 | Rate limit or quota exceeded; honour `Retry-After` |
503 | The upstream provider is temporarily unavailable |
Error bodies use the shared envelope documented in Errors: { "error": { "code", "message", "details", "request_id" } }.
POST /v1/distance-matrix is part of the Distance Matrix group. Values on this page are generated from contract version 1.1.0.
