post
/api/v2/zones/by-hierarchy
Python SDK method:
client.zones.by_hierarchy(params).run()

Start zones by hierarchy job

Creates a zones by hierarchy job. Returns zones of the requested type within the context of the input zones based on geography-based country hierarchies. Only 'State', 'County', and 'City' zone types are accepted — for example, pass in California to get all counties or cities within it.

Altitude Help Center — getStandardZonesByHierarchy

Request Body

zones by hierarchy parameters.

application/json: object

NameTypeInput ShapeValuesDescriptionValue Required
zoneIdsarray<string>--Encoded zone ID strings. Provide exactly one of zoneIds or zones (not both).N
zoneTypestring--Zone type of the child zones to return in the hierarchy (e.g. 'County' returns all counties within the selected states).Y
zonesarray<object>code: string; iso_3166_2: string; type: string-Zone objects with code, type, and iso_3166_2. Provide exactly one of zones or zoneIds (not both).N

Examples

State hierarchy request

Translated from the v1 getStandardZonesByHierarchy sample.

{
  "zoneType": "County",
  "zones": [
    {
      "code": "US-GA",
      "iso_3166_2": "US-GA",
      "type": "State"
    }
  ]
}

Success Responses

202 response: object

Job accepted and queued for processing. Poll the location header URL to check status.

NameTypeDescription
errorobjectDetails about why the job failed (RFC 7807 format), or null if it succeeded.
idstringUnique job identifier.
linksobjectNavigation URLs for polling and result retrieval.
statusstringCurrent job lifecycle state: PENDING, QUEUED, RUNNING, DONE, FAILED, CANCELED, or NOT_FOUND.

Response Errors

HTTP Status CodeReason
400The request body or parameters are invalid.
401Authentication is required or the provided credentials are invalid.
403The authenticated user lacks permission to perform this operation.
409The operation conflicts with the current state of the resource.
422The request is syntactically valid but semantically cannot be processed.
429The request rate limit has been exceeded.
500An unexpected server error occurred.