Many objects allow you to request additional information as an expanded response by using the expand
request parameter. This parameter is available on all API requests, and applies to the response of that request only. You can expand responses in two ways.
In many cases, an object contains the ID of a related object in its response properties. For example, a Charge
might have an associated Customer ID. You can expand these objects in line with the expand request parameter. The expandable
label in this documentation indicates ID fields that you can expand into objects.
Some available fields aren’t included in the responses by default, such as the number
and cvc
fields for the Issuing Card object. You can request these fields as an expanded response by using the expand
request parameter.
You can expand recursively by specifying nested fields after a dot (.
). For example, requesting payment_
on a charge expands the payment_
property into a full PaymentIntent object, then expands the customer
property on that payment intent into a full Customer object.
You can use the expand
parameter on any endpoint that returns expandable fields, including list, create, and update endpoints.
Expansions on list requests start with the data
property. For example, you can expand data.
on a request to list charges and associated customers. Performing deep expansions on numerous list requests might result in slower processing times.
Expansions have a maximum depth of four levels (for example, the deepest expansion allowed when listing charges is data.
).
You can expand multiple objects at the same time by identifying multiple items in the expand
array.
- Related guide: Expanding responses
- Related video: Expand
{ "id": "ch_3LmzzQ2eZvKYlo2C0XjzUzJV", "object": "charge", "customer": { "id": "cu_14HOpH2eZvKYlo2CxXIM7Pb2", "object": "customer", // ... }, "payment_intent": { "id": "pi_3MtwBwLkdIwHu7ix28a3tqPa", "object": "payment_intent", "customer": { "id": "cus_NffrFeUfNV2Hib", "object": "customer", // ... }, // ... }, // ...}