Skip to content

This page is available as Markdown at https://developers.klaviyo.com/en/docs/sparse_fieldsets.md. An index of every page is at https://developers.klaviyo.com/llms.txt.

KlaviyoKlaviyoDevelopers
v2026-10-15

Sparse fieldsets

Learn how to request specific fields from resources.

Sparse fieldsets allow you to request only specific fields from a resource or collection. Note that support for this functionality is endpoint-specific. Refer to the fields query parameter in our API reference documentation.

Sparse fieldsets syntax

Sparse fieldsets are specified using ?fields[TYPE]=field1,field2 as a query parameter, where TYPE is the singular resource type, e.g., profile, from which to select only field1 and field2.

Example request and response

A request to Get Catalogs Variants returns a considerable amount of data, including up to 15 different attributes per catalog variant. Large responses like these can lead to extra HTTP responses and data stored in memory. It’s likely you are only interested in a fraction of this data. Fortunately, this customization can be achieved with sparse fieldsets.

The following request to Get Catalogs Variant uses sparse fieldsets to return only external_id and title attributes from each catalog variant in the response:

Request
curl --request GET \
--url 'https://a.klaviyo.com/api/catalog-variants/?fields%5Bcatalog-variant%5D=external_id,title' \
--header 'Authorization: Klaviyo-API-Key your-private-api-key' \
--header 'accept: application/json' \
--header 'revision: 2023-09-15'
Response
{
    "data": [
        {
            "type": "catalog-variant",
            "id": "$custom:::$default:::SAMPLE-DATA-ITEM-1-VARIANT-MEDIUM",
            "attributes": {
                "external_id": "SAMPLE-DATA-ITEM-1-VARIANT-MEDIUM",
                "title": "Ocean Blue Shirt (Sample) Variant Medium"
            },
            "relationships": {
                "item": {
                    "links": {
                        "self": "https://a.klaviyo.com/api/catalog-variants/$custom:::$default:::SAMPLE-DATA-ITEM-1-VARIANT-MEDIUM/relationships/item/",
                        "related": "https://a.klaviyo.com/api/catalog-variants/$custom:::$default:::SAMPLE-DATA-ITEM-1-VARIANT-MEDIUM/item/"
                    }
                }
            },
            "links": {
                "self": "https://a.klaviyo.com/api/catalog-variants/$custom:::$default:::SAMPLE-DATA-ITEM-1-VARIANT-MEDIUM/"
            }
        },
        {
            "type": "catalog-variant",
            "id": "$custom:::$default:::SAMPLE-DATA-ITEM-1-VARIANT-LARGE",
            "attributes": {
                "external_id": "SAMPLE-DATA-ITEM-1-VARIANT-LARGE",
                "title": "Ocean Blue Shirt (Sample) Variant Large"
            },
            "relationships": {
                "item": {
                    "links": {
                        "self": "https://a.klaviyo.com/api/catalog-variants/$custom:::$default:::SAMPLE-DATA-ITEM-1-VARIANT-LARGE/relationships/item/",
                        "related": "https://a.klaviyo.com/api/catalog-variants/$custom:::$default:::SAMPLE-DATA-ITEM-1-VARIANT-LARGE/item/"
                    }
                }
            },
            "links": {
                "self": "https://a.klaviyo.com/api/catalog-variants/$custom:::$default:::SAMPLE-DATA-ITEM-1-VARIANT-LARGE/"
            }
        }
    ],
    "links": {
        "self": "https://a.klaviyo.com/api/catalog-variants?fields[catalog-variant]=external_id,title",
        "next": null,
        "prev": null
    }
}

Note that the relationships and links fields are still fully populated in the response. Each attribute object only contains the external_id and title fields as requested.

Sparse fieldsets with included resource types

You can specify sparse fieldsets for included resource types. For example, you might want to retrieve profile email addresses linked to a list of events. To do this, you must use the include query parameter to include the profile resource. Then, you can set profile as the resource type and email as a field as shown in the example below:

Request
curl --request GET \
--url 'https://a.klaviyo.com/api/events?include=profile&fields%5Bprofile%5D=email' \
--header 'Authorization: Klaviyo-API-Key your-private-api-key' \
--header 'accept: application/json' \
--header 'revision: 2023-09-15'
Response
{
    "data": [
        {
            "type": "event",
            "id": "4v7eCFTjDyX",
            "attributes": {
                "timestamp": 1691679684,
                "event_properties": {
                    "browser": "Firefox",
                    "os": "Windows",
                    "page": "http://www.example.com/landing",
                    "$event_id": "sample_data_gen:b80a551a-061e-42d1-8890-432006b54c8b"
                },
                "datetime": "2023-08-10 15:01:24+00:00",
                "uuid": "c5e3fa00-378e-11ee-8001-08175e8dffb7"
            },
            "relationships": {
                "profile": {
                    "data": {
                        "type": "profile",
                        "id": "01H7FZEVHAZB1TNK8KBVGE0YZR"
                    },
                    "links": {
                        "self": "https://a.klaviyo.com/api/events/4v7eCFTjDyX/relationships/profile/",
                        "related": "https://a.klaviyo.com/api/events/4v7eCFTjDyX/profile/"
                    }
                },
                "metric": {
                    "data": {
                        "type": "metric",
                        "id": "XWCLtq"
                    },
                    "links": {
                        "self": "https://a.klaviyo.com/api/events/4v7eCFTjDyX/relationships/metric/",
                        "related": "https://a.klaviyo.com/api/events/4v7eCFTjDyX/metric/"
                    }
                }
            },
            "links": {
                "self": "https://a.klaviyo.com/api/events/4v7eCFTjDyX/"
            }
        },
        ...
    ],
    "included": [
        {
            "type": "profile",
            "id": "01H7FZEVHAZB1TNK8KBVGE0YZR",
            "attributes": {
                "email": "lindsey.smith@klaviyo-demo.com"
            },
            "relationships": {
                "lists": {
                    "links": {
                        "self": "https://a.klaviyo.com/api/profiles/01H7FZEVHAZB1TNK8KBVGE0YZR/relationships/lists/",
                        "related": "https://a.klaviyo.com/api/profiles/01H7FZEVHAZB1TNK8KBVGE0YZR/lists/"
                    }
                },
                "segments": {
                    "links": {
                        "self": "https://a.klaviyo.com/api/profiles/01H7FZEVHAZB1TNK8KBVGE0YZR/relationships/segments/",
                        "related": "https://a.klaviyo.com/api/profiles/01H7FZEVHAZB1TNK8KBVGE0YZR/segments/"
                    }
                }
            },
            "links": {
                "self": "https://a.klaviyo.com/api/profiles/01H7FZEVHAZB1TNK8KBVGE0YZR/"
            }
        },
		...
	],
	"links": {
        "self": "https://a.klaviyo.com/api/events?include=profile&fields[profile]=email",
        "next": null,
        "prev": null
    }
}

Note that the included field of the response payload contains a list of profiles with its attributes limited to the email field as requested.

Additional fields

You can use ?additional-fields as a query parameter to return additional fields not shown by default in the response body. This query parameter shares the same syntax as sparse fieldsets, i.e., ?additional-fields[TYPE]=field, where TYPE is the singular resource type, e.g., profile, and field is the additional field. Support for additional-fields is endpoint-specific.

Example request and response

The following request to Get List uses the ?additional-fields query parameter to return profile_count, a field representing the number of profiles on a given list:

Request
curl --request GET \
--url 'https://a.klaviyo.com/api/lists/RB89mt/?additional-fields%5Blist%5D=profile_count' \
--header 'Authorization: Klaviyo-API-Key your-private-api-key' \
--header 'accept: application/json' \
--header 'revision: 2023-09-15'
Response
{
    "data": {
        "type": "list",
        "id": "RB89mt",
        "attributes": {
            "name": "Profile List",
            "created": "2023-06-05T14:49:54+00:00",
            "updated": "2023-06-06T14:20:50+00:00",
            "profile_count": 10
        },
        "relationships": {
            "profiles": {
                "links": {
                    "self": "https://a.klaviyo.com/api/lists/RB89mt/relationships/profiles/",
                    "related": "https://a.klaviyo.com/api/lists/RB89mt/profiles/"
                }
            },
            "tags": {
                "links": {
                    "self": "https://a.klaviyo.com/api/lists/RB89mt/relationships/tags/",
                    "related": "https://a.klaviyo.com/api/lists/RB89mt/tags/"
                }
            }
        },
        "links": {
            "self": "https://a.klaviyo.com/api/lists/RB89mt/"
        }
    }
}

Predictive analytics

The ?additional-fields parameter allows you to retrieve predictive analytics via API, which are valuable for monitoring metrics such as customer lifetime value (CLV) and order predictions for profiles.

The full list of predictive analytics fields that can be returned for a profile are:

Field Description
historic_clv Total value of all historically placed orders.
predicted_clv Predicted value of all placed orders in the next 365 days.
total_clv Sum of historic and predicted CLV.
historic_number_of_orders Number of placed orders.
predicted_number_of_orders Predicted number of placed orders in the next 365 days.
average_days_between_orders Average number of days between orders, over all time.
average_order_value Average value of historically placed orders.
churn_probability Probability that the customer will never make another purchase, or churn.
expected_date_of_next_order Expected date of next order, calculated at the time of their most recent order.
ranked_channel_affinity Lists the profile's subscribed channels from most-preferred to least, for example, ["sms", "email", "push"]. If a profile is not subscribed to any channels, this field has a value of None.

SDK example (Node, PHP, Python, Ruby)

This SDK example shows how to request events along with their related profile attributes limited to external_id and title fields:

Node
import { ConfigWrapper, Events } from 'klaviyo-api';
ConfigWrapper(process.env["KLAVIYO_PRIVATE_API_KEY"]));

const eventsList = await Events.getEvents({fieldsProfile:["external_id","title"],include:["profile"]});
PHP
$klaviyo->Events->getEvents(
    $fields_event=NULL,
    $fields_metric=NULL,
    $fields_profile=['external_id','title'],
    $include=['profile'],
    $page_cursor=NULL
);
Python
klaviyo.Events.get_events(
    fields_profile=['external_id','title'],
    include=['profile']
    )
Ruby
opts = {
  fields_profile: ["external_id","title"],
 include: ['profile']
}

response = KlaviyoAPI::Events.get_events(opts)

Additional resources

Last updated 2025-08-14