Skip to main content
Many Chataigne resources reference other resources by their id. For example, an organization includes a location_ids array of location ID ids rather than the full location objects. To avoid a second round trip, you can ask the API to expand those references and return the related objects inline.

How it works

Pass one or more expand[] query parameters naming the fields you want to inline. Each expandable field has a documented expansion target — for an organization, the expandable field is locations.

Without expansion

By default, the organization returns only ids. You would need a follow-up request per location to hydrate them.
Default response

With expansion

When you expand locations, the response adds a locations field containing the full location objects inline. The original id fields are preserved.
Expanded response
Expansion is additive. The location_ids array still appears alongside the expanded locations field, so existing integrations that read ids keep working.

ids vs. expandable fields

Fields that hold a reference are named with the _id or _ids suffix and return opaque resource IDs. Each one maps to an expandable field you can request via expand[].
Only fields documented as expandable can be passed to expand[]. The organization_id on a location is a reference id but is not currently expandable.

List expansions are conservative

Expansion is also available on list endpoints, but it is applied conservatively: the expand[] parameter resolves references on each item in the data array, and only documented expandable fields are honored. Combine it with pagination to keep responses bounded.
List response (truncated)
Expanding a list multiplies the number of objects in the response — a page of 10 organizations with many locations each can become large. Keep limit low and page through results rather than requesting a large page with deep expansions.

Parameters

string[]
Repeatable. Each value names a documented expandable field on the resource (or on each item, for lists). Unrecognized field names are ignored rather than expanded.

Response fields

string[]
Always present on an organization. The location ID ids of its locations, returned whether or not locations is expanded.
location[]
Present only when expand[]=locations is requested. Contains the full location objects referenced by location_ids.

Pagination

Page through list endpoints with cursor-based limit, starting_after, and ending_before — pair it with conservative list expansions.