klaviyo-api-fetch
Version:
A native fetch API using hey-api ts codegen
1,730 lines (1,622 loc) • 1.12 MB
text/typescript
// This file is auto-generated by @hey-api/openapi-ts
export type ClientOptions = {
baseUrl: 'https://a.klaviyo.com' | (string & {});
};
export type CouponEnum = 'coupon';
export type CouponResponseObjectResource = {
type: CouponEnum;
/**
* The internal id of a Coupon is equivalent to its external id stored within an integration.
*/
id: string;
attributes: {
/**
* This is the id that is stored in an integration such as Shopify or Magento.
*/
external_id: string;
/**
* A description of the coupon.
*/
description?: string | null;
/**
* The monitor configuration for the coupon.
*/
monitor_configuration?: {
[key: string]: unknown;
} | null;
};
links: ObjectLinks;
};
export type GetCouponResponseCollection = {
data: Array<CouponResponseObjectResource>;
links?: CollectionLinks;
};
export type GetCouponResponse = {
data: CouponResponseObjectResource;
links?: ObjectLinks;
};
export type GetCouponCodeCouponRelationshipResponse = {
data: {
type: CouponEnum;
/**
* The internal id of a Coupon is equivalent to its external id stored within an integration.
*/
id: string;
};
links?: ObjectLinks;
};
export type CouponCodeEnum = 'coupon-code';
export type CouponCodeResponseObjectResource = {
type: CouponCodeEnum;
/**
* The id of a coupon code is a combination of its unique code and the id of the coupon it is associated with.
*/
id: string;
attributes: {
/**
* This is a unique string that will be or is assigned to each customer/profile and is associated with a coupon.
*/
unique_code?: string | null;
/**
* The datetime when this coupon code will expire. If not specified or set to null, it will be automatically set to 1 year.
*/
expires_at?: string | null;
/**
* The current status of the coupon code.
*/
status?: 'ASSIGNED_TO_PROFILE' | 'DELETING' | 'PROCESSING' | 'UNASSIGNED' | 'USED' | 'VERSION_NOT_ACTIVE';
};
links: ObjectLinks;
};
export type GetCouponCodeResponseCollectionCompoundDocument = {
data: Array<CouponCodeResponseObjectResource & {
relationships?: {
coupon?: {
data?: {
type: CouponEnum;
id: string;
};
links?: RelationshipLinks;
};
profile?: {
links?: RelationshipLinks;
};
};
}>;
links?: CollectionLinks;
included?: Array<CouponResponseObjectResource>;
};
export type GetCouponCodeResponseCompoundDocument = {
data: CouponCodeResponseObjectResource & {
relationships?: {
coupon?: {
data?: {
type: CouponEnum;
id: string;
};
links?: RelationshipLinks;
};
profile?: {
links?: RelationshipLinks;
};
};
};
included?: Array<CouponResponseObjectResource>;
links?: ObjectLinks;
};
export type GetCouponCodeResponseCollection = {
data: Array<CouponCodeResponseObjectResource & {
relationships?: {
coupon?: {
links?: RelationshipLinks;
};
profile?: {
links?: RelationshipLinks;
};
};
}>;
links?: CollectionLinks;
};
export type GetCouponCodesRelationshipsResponseCollection = {
data: Array<{
type: CouponCodeEnum;
/**
* The id of a coupon code is a combination of its unique code and the id of the coupon it is associated with.
*/
id: string;
}>;
links?: CollectionLinks;
};
export type CatalogItemEnum = 'catalog-item';
export type CatalogVariantEnum = 'catalog-variant';
export type CatalogVariantResponseObjectResource = {
type: CatalogVariantEnum;
/**
* The catalog variant ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
*/
id: string;
attributes: {
/**
* The ID of the catalog item variant in an external system.
*/
external_id?: string | null;
/**
* The title of the catalog item variant.
*/
title?: string | null;
/**
* A description of the catalog item variant.
*/
description?: string | null;
/**
* The SKU of the catalog item variant.
*/
sku?: string | null;
/**
* This field controls the visibility of this catalog item variant in product feeds/blocks. This field supports the following values:
* `1`: a product will not appear in dynamic product recommendation feeds and blocks if it is out of stock.
* `0` or `2`: a product can appear in dynamic product recommendation feeds and blocks regardless of inventory quantity.
*/
inventory_policy?: 0 | 1 | 2;
/**
* The quantity of the catalog item variant currently in stock.
*/
inventory_quantity?: number | null;
/**
* This field can be used to set the price on the catalog item variant, which is what gets displayed for the item variant when included in emails. For most price-update use cases, you will also want to update the `price` on any parent items using the [Update Catalog Item Endpoint](https://developers.klaviyo.com/en/reference/update_catalog_item).
*/
price?: number | null;
/**
* URL pointing to the location of the catalog item variant on your website.
*/
url?: string | null;
/**
* URL pointing to the location of a full image of the catalog item variant.
*/
image_full_url?: string | null;
/**
* URL pointing to the location of an image thumbnail of the catalog item variant.
*/
image_thumbnail_url?: string | null;
/**
* List of URLs pointing to the locations of images of the catalog item variant.
*/
images?: Array<string> | null;
/**
* Flat JSON blob to provide custom metadata about the catalog item variant. May not exceed 100kb.
*/
custom_metadata?: {
[key: string]: unknown;
} | null;
/**
* Boolean value indicating whether the catalog item variant is published.
*/
published?: boolean | null;
/**
* Date and time when the catalog item variant was created, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
created?: string | null;
/**
* Date and time when the catalog item variant was last updated, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
updated?: string | null;
};
links: ObjectLinks;
};
export type CatalogItemResponseObjectResource = {
type: CatalogItemEnum;
/**
* The catalog item ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
*/
id: string;
attributes: {
/**
* The ID of the catalog item in an external system.
*/
external_id?: string | null;
/**
* The title of the catalog item.
*/
title?: string | null;
/**
* A description of the catalog item.
*/
description?: string | null;
/**
* This field can be used to set the price on the catalog item, which is what gets displayed for the item when included in emails. For most price-update use cases, you will also want to update the `price` on any child variants, using the [Update Catalog Variant Endpoint](https://developers.klaviyo.com/en/reference/update_catalog_variant).
*/
price?: number | null;
/**
* URL pointing to the location of the catalog item on your website.
*/
url?: string | null;
/**
* URL pointing to the location of a full image of the catalog item.
*/
image_full_url?: string | null;
/**
* URL pointing to the location of an image thumbnail of the catalog item
*/
image_thumbnail_url?: string | null;
/**
* List of URLs pointing to the locations of images of the catalog item.
*/
images?: Array<string> | null;
/**
* Flat JSON blob to provide custom metadata about the catalog item. May not exceed 100kb.
*/
custom_metadata?: {
[key: string]: unknown;
} | null;
/**
* Boolean value indicating whether the catalog item is published.
*/
published?: boolean | null;
/**
* Date and time when the catalog item was created, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
created?: string | null;
/**
* Date and time when the catalog item was last updated, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
updated?: string | null;
};
links: ObjectLinks;
};
export type GetCatalogItemResponseCollectionCompoundDocument = {
data: Array<CatalogItemResponseObjectResource & {
relationships?: {
variants?: {
data?: Array<{
type: CatalogVariantEnum;
id: string;
}>;
links?: RelationshipLinks;
};
};
}>;
links?: CollectionLinks;
included?: Array<CatalogVariantResponseObjectResource>;
};
export type GetCatalogItemResponseCompoundDocument = {
data: CatalogItemResponseObjectResource & {
relationships?: {
variants?: {
data?: Array<{
type: CatalogVariantEnum;
id: string;
}>;
links?: RelationshipLinks;
};
};
};
included?: Array<CatalogVariantResponseObjectResource>;
links?: ObjectLinks;
};
export type GetCatalogCategoryItemsRelationshipsResponseCollection = {
data: Array<{
type: CatalogItemEnum;
/**
* The catalog item ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
*/
id: string;
}>;
links?: CollectionLinks;
};
export type GetCatalogVariantResponseCollection = {
data: Array<CatalogVariantResponseObjectResource & {
relationships?: {
item?: {
links?: RelationshipLinks;
};
};
}>;
links?: CollectionLinks;
};
export type GetCatalogVariantResponse = {
data: CatalogVariantResponseObjectResource & {
relationships?: {
item?: {
links?: RelationshipLinks;
};
};
};
links?: ObjectLinks;
};
export type GetCatalogItemVariantsRelationshipsResponseCollection = {
data: Array<{
type: CatalogVariantEnum;
/**
* The catalog variant ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
*/
id: string;
}>;
links?: CollectionLinks;
};
export type CatalogCategoryEnum = 'catalog-category';
export type CatalogCategoryResponseObjectResource = {
type: CatalogCategoryEnum;
/**
* The catalog category ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
*/
id: string;
attributes: {
/**
* The ID of the catalog category in an external system.
*/
external_id?: string | null;
/**
* The name of the catalog category.
*/
name?: string | null;
/**
* Date and time when the catalog category was last updated, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
updated?: string | null;
};
links: ObjectLinks;
};
export type GetCatalogCategoryResponseCollection = {
data: Array<CatalogCategoryResponseObjectResource & {
relationships?: {
items?: {
links?: RelationshipLinks;
};
};
}>;
links?: CollectionLinks;
};
export type GetCatalogCategoryResponse = {
data: CatalogCategoryResponseObjectResource & {
relationships?: {
items?: {
links?: RelationshipLinks;
};
};
};
links?: ObjectLinks;
};
export type ErrorSource = {
/**
* A pointer to the source of the error in the request payload.
*/
pointer?: string | null;
};
export type ApiJobErrorPayload = {
/**
* Unique identifier for the error.
*/
id: string;
/**
* A code for classifying the error type.
*/
code: string;
/**
* A high-level message about the error.
*/
title: string;
/**
* Specific details about the error.
*/
detail: string;
source: ErrorSource;
};
export type CouponCodeBulkCreateJobEnum = 'coupon-code-bulk-create-job';
export type CouponCodeCreateJobResponseObjectResource = {
type: CouponCodeBulkCreateJobEnum;
/**
* Unique identifier for retrieving the job. Generated by Klaviyo.
*/
id: string;
attributes: {
/**
* Status of the asynchronous job.
*/
status: 'cancelled' | 'complete' | 'processing' | 'queued';
/**
* The date and time the job was created in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
created_at: string;
/**
* The total number of operations to be processed by the job. See `completed_count` for the job's current progress.
*/
total_count: number;
/**
* The total number of operations that have been completed by the job.
*/
completed_count?: number | null;
/**
* The total number of operations that have failed as part of the job.
*/
failed_count?: number | null;
/**
* Date and time the job was completed in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
completed_at?: string | null;
/**
* Array of errors encountered during the processing of the job.
*/
errors?: Array<ApiJobErrorPayload> | null;
/**
* Date and time the job expires in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
expires_at?: string | null;
};
links: ObjectLinks;
};
export type GetCouponCodeCreateJobResponseCollectionCompoundDocument = {
data: Array<CouponCodeCreateJobResponseObjectResource & {
relationships?: {
'coupon-codes'?: {
data?: Array<{
type: CouponCodeEnum;
/**
* IDs of the created coupon codes.
*/
id: string;
}>;
links?: RelationshipLinks;
};
};
}>;
links?: CollectionLinks;
};
export type GetCouponCodeCreateJobResponseCompoundDocument = {
data: CouponCodeCreateJobResponseObjectResource & {
relationships?: {
'coupon-codes'?: {
data?: Array<{
type: CouponCodeEnum;
/**
* IDs of the created coupon codes.
*/
id: string;
}>;
links?: RelationshipLinks;
};
};
};
included?: Array<CouponCodeResponseObjectResource>;
links?: ObjectLinks;
};
export type GetCatalogItemCategoriesRelationshipsResponseCollection = {
data: Array<{
type: CatalogCategoryEnum;
/**
* The catalog category ID is a compound ID (string), with format: `{integration}:::{catalog}:::{external_id}`. Currently, the only supported integration type is `$custom`, and the only supported catalog is `$default`.
*/
id: string;
}>;
links?: CollectionLinks;
};
export type EventEnum = 'event';
export type ProfileEnum = 'profile';
export type MetricEnum = 'metric';
export type AttributionEnum = 'attribution';
export type FlowEnum = 'flow';
export type MetricResponseObjectResource = {
type: MetricEnum;
/**
* The Metric ID
*/
id: string;
attributes: {
/**
* The name of the metric
*/
name?: string | null;
/**
* Creation time in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm)
*/
created?: string | null;
/**
* Last updated time in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm)
*/
updated?: string | null;
/**
* The integration associated with the event
*/
integration?: {
[key: string]: unknown;
} | null;
};
links: ObjectLinks;
};
export type ProfileLocation = {
/**
* First line of street address
*/
address1?: string | null;
/**
* Second line of street address
*/
address2?: string | null;
/**
* City name
*/
city?: string | null;
/**
* Country name
*/
country?: string | null;
/**
* Latitude coordinate. We recommend providing a precision of four decimal places.
*/
latitude?: string | number | null;
/**
* Longitude coordinate. We recommend providing a precision of four decimal places.
*/
longitude?: string | number | null;
/**
* Region within a country, such as state or province
*/
region?: string | null;
/**
* Zip code
*/
zip?: string | null;
/**
* Time zone name. We recommend using time zones from the IANA Time Zone Database.
*/
timezone?: string | null;
/**
* IP Address
*/
ip?: string | null;
};
export type EmailMarketingSuppression = {
/**
* The reason the profile was suppressed.
*/
reason: 'HARD_BOUNCE' | 'INVALID_EMAIL' | 'SPAM_COMPLAINT' | 'UNSUBSCRIBE' | 'USER_SUPPRESSED';
/**
* The timestamp when the profile was suppressed, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
timestamp: string;
};
export type EmailMarketingListSuppression = {
/**
* The ID of list to which the suppression applies.
*/
list_id: string;
/**
* The reason the profile was suppressed from the list.
*/
reason: string;
/**
* The timestamp when the profile was suppressed from the list, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
timestamp: string;
};
export type EmailMarketing = {
/**
* Whether or not this profile has implicit consent to receive email marketing. True if it does profile does not have any global suppressions.
*/
can_receive_email_marketing: boolean;
/**
* The consent status for email marketing.
*/
consent: string;
/**
* The timestamp when consent was recorded or updated for email marketing, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
consent_timestamp?: string | null;
/**
* The timestamp when a field on the email marketing object was last modified.
*/
last_updated?: string | null;
/**
* The method by which the profile was subscribed to email marketing.
*/
method?: string | null;
/**
* Additional details about the method by which the profile was subscribed to email marketing. This may be empty if no details were provided.
*/
method_detail?: string | null;
/**
* Additional detail provided by the caller when the profile was subscribed. This may be empty if no details were provided.
*/
custom_method_detail?: string | null;
/**
* Whether the profile was subscribed to email marketing using a double opt-in.
*/
double_optin?: boolean | null;
/**
* The global email marketing suppression for this profile.
*/
suppression?: Array<EmailMarketingSuppression> | null;
/**
* The list suppressions for this profile.
*/
list_suppressions?: Array<EmailMarketingListSuppression> | null;
};
export type EmailChannel = {
marketing?: EmailMarketing;
};
export type SmsMarketing = {
/**
* Whether or not this profile is subscribed to receive SMS marketing.
*/
can_receive_sms_marketing: boolean;
/**
* The consent status for SMS marketing.
*/
consent: string;
/**
* The timestamp when consent was recorded or updated for SMS marketing, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
consent_timestamp?: string | null;
/**
* The method by which the profile was subscribed to SMS marketing.
*/
method?: string | null;
/**
* Additional details about the method which the profile was subscribed to SMS marketing. This may be empty if no details were provided.
*/
method_detail?: string | null;
/**
* The timestamp when the SMS consent record was last modified, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
last_updated?: string | null;
};
export type SmsTransactional = {
/**
* Whether or not this profile is subscribed to receive transactional SMS.
*/
can_receive_sms_transactional: boolean;
/**
* The consent status for SMS Transactional.
*/
consent: string;
/**
* The timestamp when consent was recorded or updated for Transactional SMS messaging , in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
consent_timestamp?: string | null;
/**
* The method by which the profile was subscribed to Transactional SMS messaging .
*/
method?: string | null;
/**
* Additional details about the method which the profile was subscribed to Transactional SMS messaging. This may be empty if no details were provided.
*/
method_detail?: string | null;
/**
* The timestamp when the SMS consent record was last modified, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
last_updated?: string | null;
};
export type SmsChannel = {
marketing?: SmsMarketing;
transactional?: SmsTransactional;
};
export type PushMarketing = {
/**
* Whether or not this profile is subscribed to receive mobile push.
*/
can_receive_push_marketing: boolean;
/**
* The consent status for mobile push marketing.
*/
consent: string;
/**
* The timestamp when the consent was last changed, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
consent_timestamp?: string | null;
};
export type PushChannel = {
marketing?: PushMarketing;
};
export type WhatsappMarketingChannel = {
/**
* The consent status for the channel.
*/
consent: string;
/**
* The timestamp when consent was recorded or updated for the channel, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
consent_timestamp?: string | null;
/**
* The timestamp when the channel was last modified, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
last_updated?: string | null;
/**
* The timestamp when the channel was created, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
created_timestamp?: string | null;
/**
* Channel-specific metadata containing additional information about the permission.
*/
metadata?: {
[key: string]: unknown;
} | null;
/**
* Whether the profile can receive messages on this channel.
*/
can_receive: boolean;
/**
* Optional expiration date for the permission, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
valid_until?: string | null;
/**
* Phone number to which the consent was granted for.
*/
phone_number: string;
};
export type WhatsappTransactionalChannel = {
/**
* The consent status for the channel.
*/
consent: string;
/**
* The timestamp when consent was recorded or updated for the channel, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
consent_timestamp?: string | null;
/**
* The timestamp when the channel was last modified, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
last_updated?: string | null;
/**
* The timestamp when the channel was created, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
created_timestamp?: string | null;
/**
* Channel-specific metadata containing additional information about the permission.
*/
metadata?: {
[key: string]: unknown;
} | null;
/**
* Whether the profile can receive messages on this channel.
*/
can_receive: boolean;
/**
* Optional expiration date for the permission, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
valid_until?: string | null;
/**
* Phone number to which the consent was granted for.
*/
phone_number: string;
};
export type WhatsappConversationalChannel = {
/**
* The consent status for the channel.
*/
consent: string;
/**
* The timestamp when consent was recorded or updated for the channel, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
consent_timestamp?: string | null;
/**
* The timestamp when the channel was last modified, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
last_updated?: string | null;
/**
* The timestamp when the channel was created, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
created_timestamp?: string | null;
/**
* Channel-specific metadata containing additional information about the permission.
*/
metadata?: {
[key: string]: unknown;
} | null;
/**
* Whether the profile can receive messages on this channel.
*/
can_receive: boolean;
/**
* Optional expiration date for the permission, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm).
*/
valid_until?: string | null;
/**
* Phone number to which the consent was granted for.
*/
phone_number: string;
};
export type WhatsappChannel = {
marketing?: WhatsappMarketingChannel;
transactional?: WhatsappTransactionalChannel;
conversational?: WhatsappConversationalChannel;
};
export type Subscriptions = {
email?: EmailChannel;
sms?: SmsChannel;
mobile_push?: PushChannel;
whatsapp?: WhatsappChannel;
};
export type PredictiveAnalytics = {
/**
* Total value of all historically placed orders
*/
historic_clv?: number | null;
/**
* Predicted value of all placed orders in the next 365 days
*/
predicted_clv?: number | null;
/**
* Sum of historic and predicted CLV
*/
total_clv?: number | null;
/**
* Number of already placed orders
*/
historic_number_of_orders?: number | null;
/**
* Predicted number of placed orders in the next 365 days
*/
predicted_number_of_orders?: number | null;
/**
* Average number of days between orders (None if only one order has been placed)
*/
average_days_between_orders?: number | null;
/**
* Average value of placed orders
*/
average_order_value?: number | null;
/**
* Probability the customer has churned
*/
churn_probability?: number | null;
/**
* Expected date of next order, as calculated at the time of their most recent order
*/
expected_date_of_next_order?: string | null;
/**
* List of channels ranked by their predicted effectiveness for this profile, with the best channel being listed first at index 0
*/
ranked_channel_affinity?: Array<'email' | 'push' | 'sms'> | null;
};
export type ListEnum = 'list';
export type SegmentEnum = 'segment';
export type PushTokenEnum = 'push-token';
export type ProfileResponseObjectResource = {
type: ProfileEnum;
/**
* Primary key that uniquely identifies this profile. Generated by Klaviyo.
*/
id?: string | null;
attributes: {
/**
* Individual's email address
*/
email?: string | null;
/**
* Individual's phone number in E.164 format
*/
phone_number?: string | null;
/**
* A unique identifier used by customers to associate Klaviyo profiles with profiles in an external system, such as a point-of-sale system. Format varies based on the external system.
*/
external_id?: string | null;
/**
* Individual's first name
*/
first_name?: string | null;
/**
* Individual's last name
*/
last_name?: string | null;
/**
* Name of the company or organization within the company for whom the individual works
*/
organization?: string | null;
/**
* The locale of the profile, in the IETF BCP 47 language tag format like (ISO 639-1/2)-(ISO 3166 alpha-2)
*/
locale?: string | null;
/**
* Individual's job title
*/
title?: string | null;
/**
* URL pointing to the location of a profile image
*/
image?: string | null;
/**
* Date and time when the profile was created, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm)
*/
created?: string | null;
/**
* Date and time when the profile was last updated, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm)
*/
updated?: string | null;
/**
* Date and time of the most recent event the triggered an update to the profile, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm)
*/
last_event_date?: string | null;
location?: ProfileLocation;
/**
* An object containing key/value pairs for any custom properties assigned to this profile
*/
properties?: {
[key: string]: unknown;
} | null;
};
links: ObjectLinks;
};
export type CampaignEnum = 'campaign';
export type CampaignMessageEnum = 'campaign-message';
export type FlowMessageEnum = 'flow-message';
export type AttributionResponseObjectResource = {
type: AttributionEnum;
/**
* The ID of the attribution
*/
id: string;
relationships?: {
event?: {
data?: {
type: EventEnum;
/**
* Event
*/
id: string;
};
};
'attributed-event'?: {
data?: {
type: EventEnum;
/**
* Attributed Event
*/
id: string;
};
};
campaign?: {
data?: {
type: CampaignEnum;
/**
* Attributed Campaign
*/
id: string;
};
};
'campaign-message'?: {
data?: {
type: CampaignMessageEnum;
/**
* Attributed Campaign Message
*/
id: string;
};
};
flow?: {
data?: {
type: FlowEnum;
/**
* Attributed Flow
*/
id: string;
};
};
'flow-message'?: {
data?: {
type: FlowMessageEnum;
/**
* Attributed Flow Message
*/
id: string;
};
};
'flow-message-variation'?: {
data?: {
type: FlowMessageEnum;
/**
* Attributed Flow Message Variation
*/
id: string;
};
};
};
links: ObjectLinks;
};
export type EventResponseObjectResource = {
type: EventEnum;
/**
* The Event ID
*/
id: string;
attributes: {
/**
* Event timestamp in seconds
*/
timestamp?: number | null;
/**
* Event properties, can include identifiers and extra properties
*/
event_properties?: {
[key: string]: unknown;
} | null;
/**
* Event timestamp in ISO8601 format (YYYY-MM-DDTHH:MM:SS+hh:mm)
*/
datetime?: string | null;
/**
* A unique identifier for the event, this can be used as a cursor in pagination
*/
uuid?: string | null;
};
links: ObjectLinks;
};
export type GetEventResponseCollectionCompoundDocument = {
data: Array<EventResponseObjectResource & {
relationships?: {
profile?: {
data?: {
type: ProfileEnum;
/**
* Profile ID of the associated profile, if available
*/
id: string;
};
links?: RelationshipLinks;
};
metric?: {
data?: {
type: MetricEnum;
/**
* The Metric ID
*/
id: string;
};
links?: RelationshipLinks;
};
attributions?: {
data?: Array<{
type: AttributionEnum;
/**
* Attributions for this event
*/
id: string;
}>;
links?: RelationshipLinks;
};
};
}>;
links?: CollectionLinks;
included?: Array<MetricResponseObjectResource | ProfileResponseObjectResource | AttributionResponseObjectResource>;
};
export type GetEventResponseCompoundDocument = {
data: EventResponseObjectResource & {
relationships?: {
profile?: {
data?: {
type: ProfileEnum;
/**
* Profile ID of the associated profile, if available
*/
id: string;
};
links?: RelationshipLinks;
};
metric?: {
data?: {
type: MetricEnum;
/**
* The Metric ID
*/
id: string;
};
links?: RelationshipLinks;
};
attributions?: {
data?: Array<{
type: AttributionEnum;
/**
* Attributions for this event
*/
id: string;
}>;
links?: RelationshipLinks;
};
};
};
included?: Array<MetricResponseObjectResource | ProfileResponseObjectResource | AttributionResponseObjectResource>;
links?: ObjectLinks;
};
export type GetMetricResponse = {
data: MetricResponseObjectResource & {
relationships?: {
'flow-triggers'?: {
links?: RelationshipLinks;
};
};
};
links?: ObjectLinks;
};
export type GetEventMetricRelationshipResponse = {
data: {
type: MetricEnum;
/**
* The Metric ID
*/
id: string;
};
links?: ObjectLinks;
};
export type GetProfileResponse = {
data: ProfileResponseObjectResource & {
relationships?: {
lists?: {
links?: RelationshipLinks;
};
segments?: {
links?: RelationshipLinks;
};
'push-tokens'?: {
links?: RelationshipLinks;
};
};
} & {
type?: ProfileEnum;
attributes?: {
subscriptions?: Subscriptions;
predictive_analytics?: PredictiveAnalytics;
};
};
links?: ObjectLinks;
};
export type GetEventProfileRelationshipResponse = {
data: {
type: ProfileEnum;
/**
* Primary key that uniquely identifies this profile. Generated by Klaviyo.
*/
id: string;
};
links?: ObjectLinks;
};
export type FlowActionEnum = 'flow-action';
export type TagEnum = 'tag';
export type FlowResponseObjectResource = {
type: FlowEnum;
id: string;
attributes: {
name?: string | null;
status?: string | null;
archived?: boolean | null;
created?: string | null;
updated?: string | null;
/**
* Corresponds to the object which triggered the flow.
*/
trigger_type?: 'Added to List' | 'Date Based' | 'Low Inventory' | 'Metric' | 'Price Drop' | 'Unconfigured';
};
links: ObjectLinks;
};
export type GetMetricResponseCollectionCompoundDocument = {
data: Array<MetricResponseObjectResource & {
relationships?: {
'flow-triggers'?: {
data?: Array<{
type: FlowEnum;
id: string;
}>;
links?: RelationshipLinks;
};
};
}>;
links?: CollectionLinks;
included?: Array<FlowResponseObjectResource>;
};
export type GetMetricResponseCompoundDocument = {
data: MetricResponseObjectResource & {
relationships?: {
'flow-triggers'?: {
data?: Array<{
type: FlowEnum;
id: string;
}>;
links?: RelationshipLinks;
};
};
};
included?: Array<FlowResponseObjectResource>;
links?: ObjectLinks;
};
export type GetFlowResponseCollection = {
data: Array<FlowResponseObjectResource & {
relationships?: {
'flow-actions'?: {
links?: RelationshipLinks;
};
tags?: {
links?: RelationshipLinks;
};
};
}>;
links?: CollectionLinks;
};
export type GetMetricFlowTriggersRelationshipsResponseCollection = {
data: Array<{
type: FlowEnum;
id: string;
}>;
links?: CollectionLinks;
};
export type TagGroupEnum = 'tag-group';
export type TagResponseObjectResource = {
type: TagEnum;
/**
* The Tag ID
*/
id: string;
attributes: {
/**
* The Tag name
*/
name: string;
};
links: ObjectLinks;
};
export type ListListResponseObjectResource = {
type: ListEnum;
/**
* Primary key that uniquely identifies this list. Generated by Klaviyo.
*/
id: string;
attributes: {
/**
* A helpful name to label the list
*/
name?: string | null;
/**
* Date and time when the list was created, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm)
*/
created?: string | null;
/**
* Date and time when the list was last updated, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm)
*/
updated?: string | null;
/**
* The opt-in process for this list. Valid values: 'double_opt_in', 'single_opt_in'.
*/
opt_in_process?: 'double_opt_in' | 'single_opt_in';
};
links: ObjectLinks;
};
export type GetListListResponseCollectionCompoundDocument = {
data: Array<ListListResponseObjectResource & {
relationships?: {
profiles?: {
links?: RelationshipLinks;
};
tags?: {
data?: Array<{
type: TagEnum;
id: string;
}>;
links?: RelationshipLinks;
};
'flow-triggers'?: {
data?: Array<{
type: FlowEnum;
id: string;
}>;
links?: RelationshipLinks;
};
};
}>;
links?: CollectionLinks;
included?: Array<TagResponseObjectResource | FlowResponseObjectResource>;
};
export type ListRetrieveResponseObjectResource = {
type: ListEnum;
/**
* Primary key that uniquely identifies this list. Generated by Klaviyo.
*/
id: string;
attributes: {
/**
* A helpful name to label the list
*/
name?: string | null;
/**
* Date and time when the list was created, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm)
*/
created?: string | null;
/**
* Date and time when the list was last updated, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm)
*/
updated?: string | null;
/**
* The opt-in process for this list. Valid values: 'double_opt_in', 'single_opt_in'.
*/
opt_in_process?: 'double_opt_in' | 'single_opt_in';
};
links: ObjectLinks;
};
export type GetListRetrieveResponseCompoundDocument = {
data: ListRetrieveResponseObjectResource & {
relationships?: {
profiles?: {
links?: RelationshipLinks;
};
tags?: {
data?: Array<{
type: TagEnum;
id: string;
}>;
links?: RelationshipLinks;
};
'flow-triggers'?: {
data?: Array<{
type: FlowEnum;
id: string;
}>;
links?: RelationshipLinks;
};
};
} & {
type?: ListEnum;
attributes?: {
profile_count?: number | null;
};
};
included?: Array<TagResponseObjectResource | FlowResponseObjectResource>;
links?: ObjectLinks;
};
export type GetTagResponseCollection = {
data: Array<TagResponseObjectResource & {
relationships?: {
'tag-group'?: {
links?: RelationshipLinks;
};
lists?: {
links?: RelationshipLinks;
};
segments?: {
links?: RelationshipLinks;
};
campaigns?: {
links?: RelationshipLinks;
};
flows?: {
links?: RelationshipLinks;
};
};
}>;
links?: CollectionLinks;
};
export type GetListTagsRelationshipsResponseCollection = {
data: Array<{
type: TagEnum;
/**
* The Tag ID
*/
id: string;
}>;
links?: CollectionLinks;
};
export type ListMemberResponseObjectResource = {
type: ProfileEnum;
/**
* Primary key that uniquely identifies this profile. Generated by Klaviyo.
*/
id?: string | null;
attributes: {
/**
* Individual's email address
*/
email?: string | null;
/**
* Individual's phone number in E.164 format
*/
phone_number?: string | null;
/**
* A unique identifier used by customers to associate Klaviyo profiles with profiles in an external system, such as a point-of-sale system. Format varies based on the external system.
*/
external_id?: string | null;
/**
* Individual's first name
*/
first_name?: string | null;
/**
* Individual's last name
*/
last_name?: string | null;
/**
* Name of the company or organization within the company for whom the individual works
*/
organization?: string | null;
/**
* The locale of the profile, in the IETF BCP 47 language tag format like (ISO 639-1/2)-(ISO 3166 alpha-2)
*/
locale?: string | null;
/**
* Individual's job title
*/
title?: string | null;
/**
* URL pointing to the location of a profile image
*/
image?: string | null;
/**
* Date and time when the profile was created, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm)
*/
created?: string | null;
/**
* Date and time when the profile was last updated, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm)
*/
updated?: string | null;
/**
* Date and time of the most recent event the triggered an update to the profile, in ISO 8601 format (YYYY-MM-DDTHH:MM:SS.mmmmmm)
*/
last_event_date?: string | null;
location?: ProfileLocation;
/**
* An object containing key/value pairs for any custom properties assigned to this profile
*/
properties?: {
[key: string]: unknown;
} | null;
/**
* The datetime when this profile most recently joined the list.
*/
joined_group_at: string;
};
links: ObjectLinks;
};
export type GetListMemberResponseCollection = {
data: Array<ListMemberResponseObjectResource & {
relationships?: {
lists?: {
links?: RelationshipLinks;
};
segments?: {
links?: RelationshipLinks;
};
'push-tokens'?: {
links?: RelationshipLinks;
};
};
} & {
type?: ProfileEnum;
attributes?: {
subscriptions?: Subscriptions;
predictive_analytics?: PredictiveAnalytics;
};
}>;
links?: CollectionLinks;
};
export type GetListProfilesRelationshipsResponseCollection = {
data: Array<{
type: ProfileEnum;
/**
* Primary key that uniquely identifies this profile. Generated by Klaviyo.
*/
id: string;
}>;
links?: CollectionLinks;
};
export type GetListFlowTriggersRelationshipsResponseCollection = {
data: Array<{
type: FlowEnum;
id: string;
}>;
links?: CollectionLinks;
};
export type ProfileGroupMembershipEnum = 'profile-group-membership';
export type DateEnum = 'date';
export type StaticDateFilter = {
type: DateEnum;
/**
* Operators for static date filters.
*
* E.g. "before 2023-01-01"
*/
operator: 'after' | 'before';
date: string;
};
export type StaticDateRangeFilter = {
type: DateEnum;
/**
* Operators for static date range filters.
*
* E.g. "between 2023-01-01 and 2023-02-01"
*/
operator: 'between-static';
start: string;
end: string;
};
export type RelativeDateOperatorBaseRelativeDateFilter = {
type: DateEnum;
/**
* Operators for relative date filters.
*
* e.g. "in the last 10 days"
*/
operator: 'at-least' | 'in-the-last' | 'in-the-next';
/**
* Units for relative date filters.
*/
unit: 'day' | 'hour' | 'week';
quantity: number;
};
export type RelativeDateRangeFilter = {
type: DateEnum;
/**
* Operators for relative date range filters.
*
* e.g. "between 10 and 20 days ago"
*/
operator: 'between';
start: number;
end: number;
/**
* Units for relative date filters.
*/
unit: 'day' | 'hour' | 'week';
};
export type ProfileHasGroupMembershipCondition = {
type: ProfileGroupMembershipEnum;
is_member: true;
group_ids: Array<string>;
timeframe_filter?: StaticDateFilter | StaticDateRangeFilter | RelativeDateOperatorBaseRelativeDateFilter | RelativeDateRangeFilter | null;
};
export type ProfileNoGroupMembershipCondition = {
type: ProfileGroupMembershipEnum;
is_member: false;
group_ids: Array<string>;
};
export type ProfileMetricEnum = 'profile-metric';
export type NumericEnum = 'numeric';
export type NumericOperatorNumericFilter = {
type: NumericEnum;
/**
* Operators for numeric filters.
*/
operator: 'equals' | 'greater-than' | 'greater-than-or-equal' | 'less-than' | 'less-than-or-equal' | 'not-equals';
value: number | number;
};
export type RelativeAnniversaryDateFilter = {
type: DateEnum;
/**
* Operators for relative date filters.
*
* e.g. "anniversary in the last 10 days"
*/
operator: 'anniversary-last' | 'anniversary-next';
/**
* Units for relative date filters.
*/
unit: 'day' | 'hour' | 'week';
quantity: number;
};
export type AlltimeDateFilter = {
type: DateEnum;
/**
* Operators for alltime date filters.
*/
operator: 'alltime';
};
export type StringEnum = 'string';
export type StringOperatorStringFilter = {
type: StringEnum;
/**
* Operators for string filters.
*/
operator: 'contains' | 'ends-with' | 'equals' | 'not-contains' | 'not-ends-with' | 'not-equals' | 'not-starts-with' | 'nregex' | 'regex' | 'starts-with';
value: string | null;
};
export type StringArrayOperatorStringArrayFilter = {
type: StringEnum;
/**
* Operators for string-in-array filters.
*/
operator: 'in' | 'not-in';
value: Array<string>;
};
export type ExistenceEnum = 'existence';
export type ExistenceOperatorExistenceFilter = {
type: ExistenceEnum;
/**
* Operators for existence filters.
*/
operator: 'is-set' | 'not-set';
};
export type ListSetFilter = {
type: ListEnum;
/**
* Operators for list contains set filter