/
5 minute read
September 15, 2023

Object Expansion

The Core API provides object expansion as a way to optimize the number of API calls and the size of the responses.

Some objects contain tokens of related objects in their response representations. For example, a card may have an associated user token. By default, a GET request returns an object representation that includes only tokens of associated objects, thus minimizing the response size.

Alternatively, you can use the expand query parameter to include the associated objects in the response, thus decreasing the number of required subsequent API calls. Objects that can be expanded are described in this page.

Query parameter details

Fields Description

expand

string
Optional

Embeds the associated object of the specified type into the response, for all GET /cards endpoints.

Allowable Values: user, cardproduct

Sample requests and responses

To retrieve a card object that includes only the token of the associated user, use the GET request without the expand query parameter:

GET /cards/{card_token}

This request returns a card object that contains the user_token field:

JSON
Copied

Is this helpful?

Yes
No

To embed the expanded user object in the response, use the GET request with the expand query parameter:

GET /cards/{card_token}?expand=user

This request returns a card object with the complete user object embedded within it:

JSON
Copied

Is this helpful?

Yes
No

Subscribe to our developer newsletter