post
/api/v2/origin-destination/closed-matrixPython SDK method:
client.origin_destination.closed_matrix(params).run()Start closed OD matrix job
Creates a job to generate a closed origin-destination analysis. Generates a list of origin/destination zone pairs with journey metrics (count, distance, duration, percentiles, vehicle-class/vocation/fuel-type breakdowns). Set generateTimeSeries to true to produce time-series breakdowns retrievable from the companion time-series result endpoint.
Altitude Help Center — Closed OD APIRequest Body
Analysis parameters.
application/json: object
| Name | Type | Input Shape | Values | Description | Value Required |
|---|---|---|---|---|---|
aggregationUnits | array<string> | - | hour, dayofweek, daytype, daytypehour | Time-series dimensions to generate when generateTimeSeries is true. Valid values: hour, dayofweek, daytype, daytypehour. An empty array generates all four. | N |
componentTimeRange | object | component: string (values: Start, End, Both); timeFrom: string; timeTo: string | - | Time-of-day window and journey endpoint constraint applied to the analysis. | Y |
connectorAndCondition | boolean | - | - | When true, journeys must pass through all connectors; when false (default), passing through at least one is sufficient. | N |
connectorIds | array<string> | - | - | Encoded zone IDs that journeys must pass through. Provide either connectorIds or connectors, not both. | N |
connectors | array<object> | code: string; iso_3166_2: string; type: string (values: State, County, City, FSA, ZIP, TAZ, CTR, Custom) | - | Zone objects that journeys must pass through (subject to connectorAndCondition). Country, Segment, and RelatedRoad zones are not supported. Provide either connectors or connectorIds, not both. | N |
customAggregationValues | array<object> | aggregationValue: string; hourEnd: integer; hourStart: integer | - | Custom hourly range buckets appended to the time-series output in addition to any aggregationUnits selections. | N |
dateRanges | array<object> | dateFrom: string; dateTo: string | - | Date ranges to include in the analysis. Maximum 4 non-overlapping ranges, each up to 365 days. Results are aggregated across all ranges unless isTrendAnalysis is true. | Y |
daysOfWeek | array<integer> | - | 1, 2, 3, 4, 5, 6, 7 | Days of the week to include (1=Sunday … 7=Saturday). An empty array includes all days. | N |
destinationIds | array<string> | - | - | Encoded destination zone IDs. Provide either destinationIds or destinations, not both. | N |
destinations | array<object> | code: string; iso_3166_2: string; type: string (values: State, County, City, FSA, ZIP, TAZ, CTR, Custom) | - | Destination zone objects for the analysis. Country, Segment, and RelatedRoad zones are not supported. Provide either destinations or destinationIds, not both. | N |
generateTimeSeries | boolean | - | - | When true, a time-series breakdown child analysis is generated. Results are retrievable via GET /api/v2/origin-destination/closed-matrix/{id}/time-series once the job is complete. | Y |
industries | array<string> | - | agriculture, mining, utilities, construction, manufacturing, wholesale, retail, transportation_and_warehousing, information_and_cultural, finance_and_insurance, real_estate, science_and_technology, management, administrative_and_support, education, health_care, arts_and_entertainment, accommodation_and_food, public_administration, other_services, unclassified | Named industry IDs from GET /api/v2/filters/industries (e.g. 'manufacturing', 'retail'). Resolved to NAICS codes at query time and combined with any naics values. Leave both industries and naics empty to include all industries. | N |
isMetric | boolean | - | - | When true, distance values are returned in kilometres; when false, in miles. If omitted, defaults to the isMetric setting on the authenticated user's profile. | N |
isTrendAnalysis | boolean | - | - | When true, results are returned per date range instead of aggregated across all ranges. Applies to both the primary output and the time-series output. | N |
naics | array<integer> | - | - | Explicit raw NAICS integer codes to filter by. Combined with any industries values. Leave both naics and industries empty to include all industries. | N |
originIds | array<string> | - | - | Encoded origin zone IDs. Provide either originIds or origins, not both. | N |
origins | array<object> | code: string; iso_3166_2: string; type: string (values: State, County, City, FSA, ZIP, TAZ, CTR, Custom) | - | Origin zone objects for the analysis. Country, Segment, and RelatedRoad zones are not supported. Provide either origins or originIds, not both. | N |
percentiles | array<integer> | - | - | Percentile values (1–99) to calculate for journey distance, duration, and dwell time. Defaults to [15, 85] when omitted. | N |
tripChainCriteria | object | maxStopDuration: integer; shortJourneyDistanceThreshold: number | - | Trip-chaining criteria. Omit or send zero values to run without trip chaining. | N |
vehicleClassIds | array<string> | - | - | Vehicle class filter IDs from GET /api/v2/filters/vehicle-classes. IDs must use the scheme_vehicleClassIndex_categoryIndex format and share one scheme; IDs that do not name a known vehicle class are rejected. An empty array includes all vehicle classes. | N |
vehicleClassSchemeId | integer | - | 1, 2, 3, 4, 5 | Vehicle classification scheme, from 1 through 5. Defaults to 2 (FHWA/GVWR) when omitted. | N |
vehicleClasses | array<object> | vehicleType: string (values: Truck, Passenger, MPV, Bus, Limo, Other, n/a); weightClass: string (values: *, Class 1, Class 2, Class 3, Class 4, Class 5, Class 6, Class 7, Class 8, Class A, Class B, Class C, Class D, Class E, Class F, Class G, Class H) | - | Vehicle class filters. Use an empty array to include all vehicle classes. | N |
vocations | array<integer> | - | 1, 2, 3, 4, 5 | Vocation IDs from GET /api/v2/filters/vocations. An empty array includes all vocations. | N |
Examples
County-to-county closed OD request
Converted from the v1 closed OD example using v2 zone fields.
{
"componentTimeRange": {
"component": "Both",
"timeFrom": "00:00:00",
"timeTo": "23:59:59.999"
},
"dateRanges": [
{
"dateFrom": "2026-01-01",
"dateTo": "2026-01-31"
}
],
"destinations": [
{
"code": "32023",
"iso_3166_2": "US-NV",
"type": "County"
}
],
"generateTimeSeries": false,
"isMetric": false,
"origins": [
{
"code": "32003",
"iso_3166_2": "US-NV",
"type": "County"
}
],
"percentiles": [
15,
85
]
}Success Responses
202 response: object
Job accepted and queued for processing. Poll the location header URL to check status.
| Name | Type | Description |
|---|---|---|
error | object | Details about why the job failed (RFC 7807 format), or null if it succeeded. |
id | string | Unique job identifier. |
links | object | Navigation URLs for polling and result retrieval. |
status | string | Current job lifecycle state: PENDING, QUEUED, RUNNING, DONE, FAILED, CANCELED, or NOT_FOUND. |
Response Errors
| HTTP Status Code | Reason |
|---|---|
| 400 | The request body or parameters are invalid. |
| 401 | Authentication is required or the provided credentials are invalid. |
| 403 | The authenticated user lacks permission to perform this operation. |
| 409 | The operation conflicts with the current state of the resource. |
| 422 | The request is syntactically valid but semantically cannot be processed. |
| 429 | The request rate limit has been exceeded. |
| 500 | An unexpected server error occurred. |