Resource Expansion
Many endpoints support expanding related resources in a single request using the include parameter. This reduces the number of API calls needed to fetch related data.
Example:
GET /v2/customers/cus_123?include=cards,stats,fieldsThis returns the customer with their payment cards, statistics, and custom fields included:
{
"id": "cus_123",
"email": "john@example.com",
"name": "John Smith",
// ... other customer fields ...
"cards": [
{ "id": "card_456", "last4": "4242", "brand": "Visa" }
],
"stats": {
"total_orders": 15,
"total_spent": 1250.00,
"avg_order_value": 83.33
},
"fields": [
{ "name": "preferred_contact", "value": "email" }
]
}Available expansions are listed in each endpoint's documentation. Multiple expansions can be requested as a comma-separated list.
Last updated