Related entities
Entities in Paddle relate to each other. Use the include query parameter to get related entities in a single query.
Entities in the Paddle API often relate to each other. For example:
- Subscriptions generate related transactions for subscription lifecycle events.
There are two ways to get information about a related entity:
Make a separate request for an entity.
Use the
include
parameter, where available, to get related entities in a single request.
Make a separate request
Responses from the API sometimes include its related entity IDs. For example, Paddle returns a product_id
when getting a price.
Paddle ID of the price entity to work with.
12345678910111213141516171819201{
2 "data": {
3 "id": "pri_01gsz8x8sawmvhz1pv30nge1ke",
4 "product_id": "pro_01gsz4t5hdjse780zja8vvr7jg",
5 "type": "standard",
6 "description": "Monthly",
7 "name": "Monthly (per seat)",
8 "billing_cycle": {
9 "interval": "month",
10 "frequency": 1
11 },
12 "trial_period": null,
13 "tax_mode": "account_setting",
14 "unit_price": {
15 "amount": "3000",
16 "currency_code": "USD"
17 },
18 "unit_price_overrides": [],
19 "custom_data": null,
20 "status": "active",
To get information about a related entity, make a new request using its ID. In the example above, we'd make a call to the /products/{product_id}
endpoint to get pro_01gsz4vmqbjk3x4vvtafffd540
.
Paddle ID of the product entity to work with.
12345678910111213141516171819201{
2 "data": {
3 "id": "pro_01gsz4t5hdjse780zja8vvr7jg",
4 "name": "AeroEdit Pro",
5 "tax_category": "standard",
6 "type": "standard",
7 "description": "Designed for professional pilots, including all features plus in Basic plus\ncompliance monitoring, route optimization, and third-party integrations.",
8 "image_url": "https://paddle.s3.amazonaws.com/user/165798/bT1XUOJAQhOUxGs83cbk_pro.png",
9 "custom_data": {
10 "features": {
11 "aircraft_performance": true,
12 "compliance_monitoring": true,
13 "flight_log_management": true,
14 "payment_by_invoice": false,
15 "route_planning": true,
16 "sso": false
17 },
18 "suggested_addons": [
19 "pro_01h1vjes1y163xfj1rh1tkfb65",
20 "pro_01gsz97mq9pa4fkyy0wqenepkz"
In cases where entities have multiple related entities, like transactions, you might need to make more than one API call to get all related entities. This could have an impact on the performance of your integration.
Use include parameter
Rather than making multiple API calls, some operations let you get related entities using the include
query parameter. This is generally more efficient as it requires fewer calls.
When including entities:
- Paddle returns an object or an array with the included entities.
- All related entities are returned, including archived entities.
- Related entities aren't paginated.
When an entity may only be linked to one of a related entity, an object is returned. For example, a price may only be related to one product. Paddle returns a product
object as part of the price data
object.
This example includes the related product entity when getting a price.
Paddle ID of the price entity to work with.
Include related entities in the response.
161718192021222324252627282930313233343516 "currency_code": "USD"
17 },
18 "unit_price_overrides": [],
19 "custom_data": null,
20 "status": "active",
21 "quantity": {
22 "minimum": 1,
23 "maximum": 999
24 },
25 "product": {
26 "id": "pro_01gsz4t5hdjse780zja8vvr7jg",
27 "name": "AeroEdit Pro",
28 "tax_category": "standard",
29 "type": "standard",
30 "description": "Designed for professional pilots, including all features plus in Basic plus compliance monitoring, route optimization, and third-party integrations.",
31 "image_url": "https://paddle.s3.amazonaws.com/user/165798/bT1XUOJAQhOUxGs83cbk_pro.png",
32 "custom_data": {
33 "features": {
34 "aircraft_performance": true,
35 "compliance_monitoring": true,
You can include multiple entities using a comma separated list. Keep in mind that including multiple entities might result in longer response times and larger responses, which could impact performance.
If you try to
include
an entity that isn't supported, Paddle returns an error.