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
Copy section link
Fields | Description |
---|---|
expand
string
|
Embeds the associated object of the specified type into the response, for all Allowable Values: |
Sample requests and responses
Copy section link
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:
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: