/**
* Klaviyo API
* The Klaviyo REST API. Please visit https://developers.klaviyo.com for more details.
*
* Contact: developers@klaviyo.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { AxiosResponse } from "axios";
import { GetFlowResponseCollection } from '../model/getFlowResponseCollection';
import { GetSegmentFlowTriggersRelationshipsResponseCollection } from '../model/getSegmentFlowTriggersRelationshipsResponseCollection';
import { GetSegmentListResponseCollectionCompoundDocument } from '../model/getSegmentListResponseCollectionCompoundDocument';
import { GetSegmentMemberResponseCollection } from '../model/getSegmentMemberResponseCollection';
import { GetSegmentProfilesRelationshipsResponseCollection } from '../model/getSegmentProfilesRelationshipsResponseCollection';
import { GetSegmentRetrieveResponseCompoundDocument } from '../model/getSegmentRetrieveResponseCompoundDocument';
import { GetSegmentTagsRelationshipsResponseCollection } from '../model/getSegmentTagsRelationshipsResponseCollection';
import { GetTagResponseCollection } from '../model/getTagResponseCollection';
import { PatchSegmentPartialUpdateResponse } from '../model/patchSegmentPartialUpdateResponse';
import { PostSegmentCreateResponse } from '../model/postSegmentCreateResponse';
import { SegmentCreateQuery } from '../model/segmentCreateQuery';
import { SegmentPartialUpdateQuery } from '../model/segmentPartialUpdateQuery';
import { Session } from './apis';
export declare class SegmentsApi {
session: Session;
protected _basePath: string;
protected _defaultHeaders: any;
protected _useQuerystring: boolean;
constructor(session: Session);
set useQuerystring(value: boolean);
set basePath(basePath: string);
set defaultHeaders(defaultHeaders: any);
get defaultHeaders(): any;
get basePath(): string;
/**
* Create a segment.
*Rate limits*:
Burst: `1/s`
Steady: `15/m`
Daily: `100/d` **Scopes:** `segments:write`
* @summary Create Segment
* @param segmentCreateQuery
*/
createSegment(segmentCreateQuery: SegmentCreateQuery): Promise<{
response: AxiosResponse;
body: PostSegmentCreateResponse;
}>;
/**
* Delete a segment with the given segment ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `segments:write`
* @summary Delete Segment
* @param id
*/
deleteSegment(id: string): Promise<{
response: AxiosResponse;
body?: any;
}>;
/**
* Get all flows where the given segment ID is being used as the trigger.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:read` `segments:read`
* @summary Get Flows Triggered by Segment
* @param id Primary key that uniquely identifies this segment. Generated by Klaviyo.
* @param fieldsFlow For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sparse-fieldsets
*/
getFlowsTriggeredBySegment(id: string, options?: {
fieldsFlow?: Array<'archived' | 'created' | 'name' | 'status' | 'trigger_type' | 'updated'>;
}): Promise<{
response: AxiosResponse;
body: GetFlowResponseCollection;
}>;
/**
* Get the IDs of all flows where the given segment is being used as the trigger.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:read` `segments:read`
* @summary Get IDs for Flows Triggered by Segment
* @param id Primary key that uniquely identifies this segment. Generated by Klaviyo.
*/
getIdsForFlowsTriggeredBySegment(id: string): Promise<{
response: AxiosResponse;
body: GetSegmentFlowTriggersRelationshipsResponseCollection;
}>;
/**
* Get all profile membership [relationships](https://developers.klaviyo.com/en/reference/api_overview#relationships) for the given segment ID.
*Rate limits*:
Burst: `75/s`
Steady: `750/m` **Scopes:** `profiles:read` `segments:read`
* @summary Get Profile IDs for Segment
* @param id Primary key that uniquely identifies this segment. Generated by Klaviyo.
* @param filter For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`profile_id`: `any`, `equals`<br>`email`: `any`, `equals`<br>`phone_number`: `any`, `equals`<br>`push_token`: `any`, `equals`<br>`_kx`: `equals`<br>`joined_group_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`* @param pageCursor For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#pagination* @param pageSize Default: 20. Min: 1. Max: 100.* @param sort For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sorting
*/
getProfileIdsForSegment(id: string, options?: {
filter?: string;
pageCursor?: string;
pageSize?: number;
sort?: 'joined_group_at' | '-joined_group_at';
}): Promise<{
response: AxiosResponse;
body: GetSegmentProfilesRelationshipsResponseCollection;
}>;
/**
* Get all profiles within a segment with the given segment ID. Filter to request a subset of all profiles. Profiles can be filtered by `email`, `phone_number`, `push_token`, and `joined_group_at` fields. Profiles can be sorted by the following fields, in ascending and descending order: `joined_group_at`
*Rate limits*:
Burst: `75/s`
Steady: `750/m` **Scopes:** `profiles:read` `segments:read`
* @summary Get Profiles for Segment
* @param id Primary key that uniquely identifies this segment. Generated by Klaviyo.
* @param additionalFieldsProfile Request additional fields not included by default in the response. Supported values: \'subscriptions\', \'predictive_analytics\'* @param fieldsProfile For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sparse-fieldsets* @param filter For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`profile_id`: `any`, `equals`<br>`email`: `any`, `equals`<br>`phone_number`: `any`, `equals`<br>`push_token`: `any`, `equals`<br>`_kx`: `equals`<br>`joined_group_at`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`* @param pageCursor For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#pagination* @param pageSize Default: 20. Min: 1. Max: 100.* @param sort For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sorting
*/
getProfilesForSegment(id: string, options?: {
additionalFieldsProfile?: Array<'subscriptions' | 'predictive_analytics'>;
fieldsProfile?: Array<'created' | 'email' | 'external_id' | 'first_name' | 'image' | 'joined_group_at' | 'last_event_date' | 'last_name' | 'locale' | 'location' | 'location.address1' | 'location.address2' | 'location.city' | 'location.country' | 'location.ip' | 'location.latitude' | 'location.longitude' | 'location.region' | 'location.timezone' | 'location.zip' | 'organization' | 'phone_number' | 'predictive_analytics' | 'predictive_analytics.average_days_between_orders' | 'predictive_analytics.average_order_value' | 'predictive_analytics.churn_probability' | 'predictive_analytics.expected_date_of_next_order' | 'predictive_analytics.historic_clv' | 'predictive_analytics.historic_number_of_orders' | 'predictive_analytics.predicted_clv' | 'predictive_analytics.predicted_number_of_orders' | 'predictive_analytics.ranked_channel_affinity' | 'predictive_analytics.total_clv' | 'properties' | 'subscriptions' | 'subscriptions.email' | 'subscriptions.email.marketing' | 'subscriptions.email.marketing.can_receive_email_marketing' | 'subscriptions.email.marketing.consent' | 'subscriptions.email.marketing.consent_timestamp' | 'subscriptions.email.marketing.custom_method_detail' | 'subscriptions.email.marketing.double_optin' | 'subscriptions.email.marketing.last_updated' | 'subscriptions.email.marketing.list_suppressions' | 'subscriptions.email.marketing.method' | 'subscriptions.email.marketing.method_detail' | 'subscriptions.email.marketing.suppression' | 'subscriptions.mobile_push' | 'subscriptions.mobile_push.marketing' | 'subscriptions.mobile_push.marketing.can_receive_push_marketing' | 'subscriptions.mobile_push.marketing.consent' | 'subscriptions.mobile_push.marketing.consent_timestamp' | 'subscriptions.sms' | 'subscriptions.sms.marketing' | 'subscriptions.sms.marketing.can_receive_sms_marketing' | 'subscriptions.sms.marketing.consent' | 'subscriptions.sms.marketing.consent_timestamp' | 'subscriptions.sms.marketing.last_updated' | 'subscriptions.sms.marketing.method' | 'subscriptions.sms.marketing.method_detail' | 'subscriptions.sms.transactional' | 'subscriptions.sms.transactional.can_receive_sms_transactional' | 'subscriptions.sms.transactional.consent' | 'subscriptions.sms.transactional.consent_timestamp' | 'subscriptions.sms.transactional.last_updated' | 'subscriptions.sms.transactional.method' | 'subscriptions.sms.transactional.method_detail' | 'subscriptions.whatsapp' | 'subscriptions.whatsapp.conversational' | 'subscriptions.whatsapp.conversational.can_receive' | 'subscriptions.whatsapp.conversational.consent' | 'subscriptions.whatsapp.conversational.consent_timestamp' | 'subscriptions.whatsapp.conversational.created_timestamp' | 'subscriptions.whatsapp.conversational.last_updated' | 'subscriptions.whatsapp.conversational.metadata' | 'subscriptions.whatsapp.conversational.phone_number' | 'subscriptions.whatsapp.conversational.valid_until' | 'subscriptions.whatsapp.marketing' | 'subscriptions.whatsapp.marketing.can_receive' | 'subscriptions.whatsapp.marketing.consent' | 'subscriptions.whatsapp.marketing.consent_timestamp' | 'subscriptions.whatsapp.marketing.created_timestamp' | 'subscriptions.whatsapp.marketing.last_updated' | 'subscriptions.whatsapp.marketing.metadata' | 'subscriptions.whatsapp.marketing.phone_number' | 'subscriptions.whatsapp.marketing.valid_until' | 'subscriptions.whatsapp.transactional' | 'subscriptions.whatsapp.transactional.can_receive' | 'subscriptions.whatsapp.transactional.consent' | 'subscriptions.whatsapp.transactional.consent_timestamp' | 'subscriptions.whatsapp.transactional.created_timestamp' | 'subscriptions.whatsapp.transactional.last_updated' | 'subscriptions.whatsapp.transactional.metadata' | 'subscriptions.whatsapp.transactional.phone_number' | 'subscriptions.whatsapp.transactional.valid_until' | 'title' | 'updated'>;
filter?: string;
pageCursor?: string;
pageSize?: number;
sort?: 'joined_group_at' | '-joined_group_at';
}): Promise<{
response: AxiosResponse;
body: GetSegmentMemberResponseCollection;
}>;
/**
* Get a segment with the given segment ID.
*Rate limits*:
Burst: `75/s`
Steady: `750/m`
Rate limits when using the `additional-fields[segment]=profile_count` parameter in your API request:
Burst: `1/s`
Steady: `15/m`
To learn more about how the `additional-fields` parameter impacts rate limits, check out our [Rate limits, status codes, and errors](https://developers.klaviyo.com/en/v2026-04-15/docs/rate_limits_and_error_handling) guide. **Scopes:** `segments:read`
* @summary Get Segment
* @param id
* @param additionalFieldsSegment Request additional fields not included by default in the response. Supported values: \'profile_count\'* @param fieldsFlow For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sparse-fieldsets* @param fieldsSegment For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sparse-fieldsets* @param fieldsTag For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sparse-fieldsets* @param include For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#relationships
*/
getSegment(id: string, options?: {
additionalFieldsSegment?: Array<'profile_count'>;
fieldsFlow?: Array<'archived' | 'created' | 'name' | 'status' | 'trigger_type' | 'updated'>;
fieldsSegment?: Array<'created' | 'definition' | 'definition.condition_groups' | 'is_active' | 'is_processing' | 'is_starred' | 'name' | 'profile_count' | 'updated'>;
fieldsTag?: Array<'name'>;
include?: Array<'flow-triggers' | 'tags'>;
}): Promise<{
response: AxiosResponse;
body: GetSegmentRetrieveResponseCompoundDocument;
}>;
/**
* Get all segments in an account. Filter to request a subset of all segments. Segments can be filtered by `name`, `created`, and `updated` fields. Returns a maximum of 10 results per page.
*Rate limits*:
Burst: `75/s`
Steady: `750/m` **Scopes:** `segments:read`
* @summary Get Segments
* @param fieldsFlow For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sparse-fieldsets* @param fieldsSegment For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sparse-fieldsets* @param fieldsTag For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sparse-fieldsets* @param filter For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`name`: `any`, `equals`<br>`id`: `any`, `equals`<br>`created`: `greater-than`<br>`updated`: `greater-than`<br>`is_active`: `any`, `equals`<br>`is_starred`: `equals`* @param include For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#relationships* @param pageCursor For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#pagination* @param sort For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sorting
*/
getSegments(options?: {
fieldsFlow?: Array<'archived' | 'created' | 'name' | 'status' | 'trigger_type' | 'updated'>;
fieldsSegment?: Array<'created' | 'definition' | 'definition.condition_groups' | 'is_active' | 'is_processing' | 'is_starred' | 'name' | 'updated'>;
fieldsTag?: Array<'name'>;
filter?: string;
include?: Array<'flow-triggers' | 'tags'>;
pageCursor?: string;
sort?: 'created' | '-created' | 'id' | '-id' | 'name' | '-name' | 'updated' | '-updated';
}): Promise<{
response: AxiosResponse;
body: GetSegmentListResponseCollectionCompoundDocument;
}>;
/**
* If `related_resource` is `tags`, returns the tag IDs of all tags associated with the given segment ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `segments:read` `tags:read`
* @summary Get Tag IDs for Segment
* @param id
*/
getTagIdsForSegment(id: string): Promise<{
response: AxiosResponse;
body: GetSegmentTagsRelationshipsResponseCollection;
}>;
/**
* Return all tags associated with the given segment ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `segments:read` `tags:read`
* @summary Get Tags for Segment
* @param id
* @param fieldsTag For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sparse-fieldsets
*/
getTagsForSegment(id: string, options?: {
fieldsTag?: Array<'name'>;
}): Promise<{
response: AxiosResponse;
body: GetTagResponseCollection;
}>;
/**
* Update a segment with the given segment ID.
*Rate limits*:
Burst: `1/s`
Steady: `15/m`
Daily: `100/d` **Scopes:** `segments:write`
* @summary Update Segment
* @param id * @param segmentPartialUpdateQuery
*/
updateSegment(id: string, segmentPartialUpdateQuery: SegmentPartialUpdateQuery): Promise<{
response: AxiosResponse;
body: PatchSegmentPartialUpdateResponse;
}>;
}
export interface SegmentsApi {
/**
* Alias of {@link SegmentsApi.getFlowsTriggeredBySegment}
*
* @deprecated Use {@link SegmentsApi.getFlowsTriggeredBySegment} instead
*/
getFlowTriggersForSegment: typeof SegmentsApi.prototype.getFlowsTriggeredBySegment;
}
export interface SegmentsApi {
/**
* Alias of {@link SegmentsApi.getFlowsTriggeredBySegment}
*
* @deprecated Use {@link SegmentsApi.getFlowsTriggeredBySegment} instead
*/
getSegmentFlowTriggers: typeof SegmentsApi.prototype.getFlowsTriggeredBySegment;
}
export interface SegmentsApi {
/**
* Alias of {@link SegmentsApi.getIdsForFlowsTriggeredBySegment}
*
* @deprecated Use {@link SegmentsApi.getIdsForFlowsTriggeredBySegment} instead
*/
getFlowTriggerIdsForSegment: typeof SegmentsApi.prototype.getIdsForFlowsTriggeredBySegment;
}
export interface SegmentsApi {
/**
* Alias of {@link SegmentsApi.getIdsForFlowsTriggeredBySegment}
*
* @deprecated Use {@link SegmentsApi.getIdsForFlowsTriggeredBySegment} instead
*/
getSegmentRelationshipsFlowTriggers: typeof SegmentsApi.prototype.getIdsForFlowsTriggeredBySegment;
}
export interface SegmentsApi {
/**
* Alias of {@link SegmentsApi.getProfileIdsForSegment}
*
* @deprecated Use {@link SegmentsApi.getProfileIdsForSegment} instead
*/
getSegmentRelationshipsProfiles: typeof SegmentsApi.prototype.getProfileIdsForSegment;
}
export interface SegmentsApi {
/**
* Alias of {@link SegmentsApi.getProfilesForSegment}
*
* @deprecated Use {@link SegmentsApi.getProfilesForSegment} instead
*/
getSegmentProfiles: typeof SegmentsApi.prototype.getProfilesForSegment;
}
export interface SegmentsApi {
/**
* Alias of {@link SegmentsApi.getTagIdsForSegment}
*
* @deprecated Use {@link SegmentsApi.getTagIdsForSegment} instead
*/
getSegmentRelationshipsTags: typeof SegmentsApi.prototype.getTagIdsForSegment;
}
export interface SegmentsApi {
/**
* Alias of {@link SegmentsApi.getTagsForSegment}
*
* @deprecated Use {@link SegmentsApi.getTagsForSegment} instead
*/
getSegmentTags: typeof SegmentsApi.prototype.getTagsForSegment;
}