/**
* 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.
*/
const axios = require('axios');
import {AxiosRequestConfig, AxiosResponse} from "axios";
import FormData from 'form-data'
/* tslint:disable:no-unused-locals */
import { FlowActionUpdateQuery } from '../model/flowActionUpdateQuery';
import { FlowCreateQuery } from '../model/flowCreateQuery';
import { FlowUpdateQuery } from '../model/flowUpdateQuery';
import { GetAccounts4XXResponse } from '../model/getAccounts4XXResponse';
import { GetFlowActionEncodedResponse } from '../model/getFlowActionEncodedResponse';
import { GetFlowActionEncodedResponseCollection } from '../model/getFlowActionEncodedResponseCollection';
import { GetFlowActionEncodedResponseCompoundDocument } from '../model/getFlowActionEncodedResponseCompoundDocument';
import { GetFlowActionFlowMessageRelationshipResponseCollection } from '../model/getFlowActionFlowMessageRelationshipResponseCollection';
import { GetFlowActionFlowRelationshipResponse } from '../model/getFlowActionFlowRelationshipResponse';
import { GetFlowFlowActionRelationshipListResponseCollection } from '../model/getFlowFlowActionRelationshipListResponseCollection';
import { GetFlowMessageActionRelationshipResponse } from '../model/getFlowMessageActionRelationshipResponse';
import { GetFlowMessageEncodedResponseCollection } from '../model/getFlowMessageEncodedResponseCollection';
import { GetFlowMessageEncodedResponseCompoundDocument } from '../model/getFlowMessageEncodedResponseCompoundDocument';
import { GetFlowMessageTemplateRelationshipResponse } from '../model/getFlowMessageTemplateRelationshipResponse';
import { GetFlowResponse } from '../model/getFlowResponse';
import { GetFlowResponseCollectionCompoundDocument } from '../model/getFlowResponseCollectionCompoundDocument';
import { GetFlowTagsRelationshipsResponseCollection } from '../model/getFlowTagsRelationshipsResponseCollection';
import { GetFlowV2ResponseCompoundDocument } from '../model/getFlowV2ResponseCompoundDocument';
import { GetTagResponseCollection } from '../model/getTagResponseCollection';
import { GetTemplateResponse } from '../model/getTemplateResponse';
import { PatchFlowActionEncodedResponse } from '../model/patchFlowActionEncodedResponse';
import { PatchFlowResponse } from '../model/patchFlowResponse';
import { PostFlowV2Response } from '../model/postFlowV2Response';
import { ObjectSerializer } from '../model/models';
import {RequestFile, queryParamPreProcessor, RetryWithExponentialBackoff, Session} from './apis';
let defaultBasePath = 'https://a.klaviyo.com';
// ===============================================
// This file is autogenerated - Please do not edit
// ===============================================
export class FlowsApi {
session: Session
protected _basePath = defaultBasePath;
protected _defaultHeaders : any = {};
protected _useQuerystring : boolean = false;
constructor(session: Session){
this.session = session
}
set useQuerystring(value: boolean) {
this._useQuerystring = value;
}
set basePath(basePath: string) {
this._basePath = basePath;
}
set defaultHeaders(defaultHeaders: any) {
this._defaultHeaders = defaultHeaders;
}
get defaultHeaders() {
return this._defaultHeaders;
}
get basePath() {
return this._basePath;
}
/**
* Create a new flow using an encoded flow definition. New objects within the flow definition, such as actions, will need to use a `temporary_id` field for identification. These will be replaced with traditional `id` fields after successful creation. A successful request will return the new definition to you.
*Rate limits*:
Burst: `1/s`
Steady: `15/m`
Daily: `100/d` **Scopes:** `flows:write`
* @summary Create Flow
* @param flowCreateQuery Creates a Flow from parameters
* @param additionalFieldsFlow Request additional fields not included by default in the response. Supported values: \'definition\'
*/
public async createFlow (flowCreateQuery: FlowCreateQuery, options: { additionalFieldsFlow?: Array<'definition'>, } = {}): Promise<{ response: AxiosResponse; body: PostFlowV2Response; }> {
const localVarPath = this.basePath + '/api/flows';
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
// verify required parameter 'flowCreateQuery' is not null or undefined
if (flowCreateQuery === null || flowCreateQuery === undefined) {
throw new Error('Required parameter flowCreateQuery was null or undefined when calling createFlow.');
}
if (options.additionalFieldsFlow !== undefined) {
localVarQueryParameters['additional-fields[flow]'] = ObjectSerializer.serialize(options.additionalFieldsFlow, "Array<'definition'>");
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'POST',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
data: ObjectSerializer.serialize(flowCreateQuery, "FlowCreateQuery")
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body: PostFlowV2Response; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
body = ObjectSerializer.deserialize(axiosResponse.data, "PostFlowV2Response");
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
/**
* Delete a flow with the given flow ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:write`
* @summary Delete Flow
* @param id ID of the Flow to delete. Ex: XVTP5Q
*/
public async deleteFlow (id: string, ): Promise<{ response: AxiosResponse; body?: any; }> {
const localVarPath = this.basePath + '/api/flows/{id}'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling deleteFlow.');
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'DELETE',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body?: any; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
/**
* Get the flow action for a flow message with the given message ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:read`
* @summary Get Action for Flow Message
* @param id
* @param fieldsFlowAction For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sparse-fieldsets
*/
public async getActionForFlowMessage (id: string, options: { fieldsFlowAction?: Array<'created' | 'definition' | 'definition.data' | 'definition.data.action_output_filter' | 'definition.data.action_output_filter.condition_groups' | 'definition.data.branches' | 'definition.data.current_experiment' | 'definition.data.current_experiment.allocations' | 'definition.data.current_experiment.automatic_winner_selection_settings' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_date' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_statistical_certainty' | 'definition.data.current_experiment.automatic_winner_selection_settings.enabled' | 'definition.data.current_experiment.id' | 'definition.data.current_experiment.name' | 'definition.data.current_experiment.started' | 'definition.data.current_experiment.variations' | 'definition.data.current_experiment.winner_metric' | 'definition.data.delay_until_time' | 'definition.data.delay_until_weekdays' | 'definition.data.experiment_status' | 'definition.data.list_id' | 'definition.data.main_action' | 'definition.data.main_action.data' | 'definition.data.main_action.data.message' | 'definition.data.main_action.data.message.action_buttons' | 'definition.data.main_action.data.message.add_info_link' | 'definition.data.main_action.data.message.add_opt_out_language' | 'definition.data.main_action.data.message.add_org_prefix' | 'definition.data.main_action.data.message.add_tracking_params' | 'definition.data.main_action.data.message.additional_filters' | 'definition.data.main_action.data.message.additional_filters.condition_groups' | 'definition.data.main_action.data.message.android_link' | 'definition.data.main_action.data.message.badge' | 'definition.data.main_action.data.message.badge_options' | 'definition.data.main_action.data.message.badge_options.badge_config' | 'definition.data.main_action.data.message.badge_options.set_from_property' | 'definition.data.main_action.data.message.badge_options.value' | 'definition.data.main_action.data.message.bcc_email' | 'definition.data.main_action.data.message.body' | 'definition.data.main_action.data.message.cc_email' | 'definition.data.main_action.data.message.conversion_metric_id' | 'definition.data.main_action.data.message.custom_tracking_params' | 'definition.data.main_action.data.message.dynamic_image' | 'definition.data.main_action.data.message.from_email' | 'definition.data.main_action.data.message.from_label' | 'definition.data.main_action.data.message.id' | 'definition.data.main_action.data.message.image_id' | 'definition.data.main_action.data.message.include_contact_card' | 'definition.data.main_action.data.message.ios_link' | 'definition.data.main_action.data.message.kv_pairs' | 'definition.data.main_action.data.message.name' | 'definition.data.main_action.data.message.on_open' | 'definition.data.main_action.data.message.preview_text' | 'definition.data.main_action.data.message.push_type' | 'definition.data.main_action.data.message.reply_to_email' | 'definition.data.main_action.data.message.shorten_links' | 'definition.data.main_action.data.message.smart_sending_enabled' | 'definition.data.main_action.data.message.sms_quiet_hours_enabled' | 'definition.data.main_action.data.message.sound' | 'definition.data.main_action.data.message.subject_line' | 'definition.data.main_action.data.message.template_id' | 'definition.data.main_action.data.message.title' | 'definition.data.main_action.data.message.transactional' | 'definition.data.main_action.data.message.video_asset_id' | 'definition.data.main_action.data.status' | 'definition.data.main_action.id' | 'definition.data.main_action.links' | 'definition.data.main_action.links.next' | 'definition.data.main_action.temporary_id' | 'definition.data.main_action.type' | 'definition.data.message' | 'definition.data.message.action_buttons' | 'definition.data.message.add_info_link' | 'definition.data.message.add_opt_out_language' | 'definition.data.message.add_org_prefix' | 'definition.data.message.add_tracking_params' | 'definition.data.message.additional_filters' | 'definition.data.message.additional_filters.condition_groups' | 'definition.data.message.android_link' | 'definition.data.message.badge' | 'definition.data.message.badge_options' | 'definition.data.message.badge_options.badge_config' | 'definition.data.message.badge_options.set_from_property' | 'definition.data.message.badge_options.value' | 'definition.data.message.bcc_email' | 'definition.data.message.body' | 'definition.data.message.cc_email' | 'definition.data.message.conversion_metric_id' | 'definition.data.message.custom_tracking_params' | 'definition.data.message.dynamic_image' | 'definition.data.message.from_email' | 'definition.data.message.from_label' | 'definition.data.message.headers' | 'definition.data.message.id' | 'definition.data.message.image_id' | 'definition.data.message.include_contact_card' | 'definition.data.message.ios_link' | 'definition.data.message.kv_pairs' | 'definition.data.message.name' | 'definition.data.message.on_open' | 'definition.data.message.preview_text' | 'definition.data.message.push_type' | 'definition.data.message.reply_to_email' | 'definition.data.message.shorten_links' | 'definition.data.message.smart_sending_enabled' | 'definition.data.message.sms_quiet_hours_enabled' | 'definition.data.message.sound' | 'definition.data.message.subject_line' | 'definition.data.message.template_id' | 'definition.data.message.title' | 'definition.data.message.to_emails' | 'definition.data.message.transactional' | 'definition.data.message.url' | 'definition.data.message.vendor_id' | 'definition.data.message.video_asset_id' | 'definition.data.name' | 'definition.data.on_execution' | 'definition.data.profile_filter' | 'definition.data.profile_filter.condition_groups' | 'definition.data.profile_operations' | 'definition.data.secondary_value' | 'definition.data.service_configuration' | 'definition.data.service_configuration.event_key' | 'definition.data.service_configuration.event_payload' | 'definition.data.service_configuration.report_id' | 'definition.data.service_configuration.service_method_type' | 'definition.data.service_configuration.tracking_company_id' | 'definition.data.status' | 'definition.data.target_days' | 'definition.data.target_time' | 'definition.data.timezone' | 'definition.data.trigger_filter' | 'definition.data.trigger_filter.condition_groups' | 'definition.data.trigger_id' | 'definition.data.trigger_subtype' | 'definition.data.trigger_type' | 'definition.data.unit' | 'definition.data.value' | 'definition.id' | 'definition.links' | 'definition.links.next' | 'definition.links.next_if_false' | 'definition.links.next_if_true' | 'definition.temporary_id' | 'definition.type' | 'updated'>, } = {}): Promise<{ response: AxiosResponse; body: GetFlowActionEncodedResponse; }> {
const localVarPath = this.basePath + '/api/flow-messages/{id}/flow-action'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getActionForFlowMessage.');
}
if (options.fieldsFlowAction !== undefined) {
localVarQueryParameters['fields[flow-action]'] = ObjectSerializer.serialize(options.fieldsFlowAction, "Array<'created' | 'definition' | 'definition.data' | 'definition.data.action_output_filter' | 'definition.data.action_output_filter.condition_groups' | 'definition.data.branches' | 'definition.data.current_experiment' | 'definition.data.current_experiment.allocations' | 'definition.data.current_experiment.automatic_winner_selection_settings' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_date' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_statistical_certainty' | 'definition.data.current_experiment.automatic_winner_selection_settings.enabled' | 'definition.data.current_experiment.id' | 'definition.data.current_experiment.name' | 'definition.data.current_experiment.started' | 'definition.data.current_experiment.variations' | 'definition.data.current_experiment.winner_metric' | 'definition.data.delay_until_time' | 'definition.data.delay_until_weekdays' | 'definition.data.experiment_status' | 'definition.data.list_id' | 'definition.data.main_action' | 'definition.data.main_action.data' | 'definition.data.main_action.data.message' | 'definition.data.main_action.data.message.action_buttons' | 'definition.data.main_action.data.message.add_info_link' | 'definition.data.main_action.data.message.add_opt_out_language' | 'definition.data.main_action.data.message.add_org_prefix' | 'definition.data.main_action.data.message.add_tracking_params' | 'definition.data.main_action.data.message.additional_filters' | 'definition.data.main_action.data.message.additional_filters.condition_groups' | 'definition.data.main_action.data.message.android_link' | 'definition.data.main_action.data.message.badge' | 'definition.data.main_action.data.message.badge_options' | 'definition.data.main_action.data.message.badge_options.badge_config' | 'definition.data.main_action.data.message.badge_options.set_from_property' | 'definition.data.main_action.data.message.badge_options.value' | 'definition.data.main_action.data.message.bcc_email' | 'definition.data.main_action.data.message.body' | 'definition.data.main_action.data.message.cc_email' | 'definition.data.main_action.data.message.conversion_metric_id' | 'definition.data.main_action.data.message.custom_tracking_params' | 'definition.data.main_action.data.message.dynamic_image' | 'definition.data.main_action.data.message.from_email' | 'definition.data.main_action.data.message.from_label' | 'definition.data.main_action.data.message.id' | 'definition.data.main_action.data.message.image_id' | 'definition.data.main_action.data.message.include_contact_card' | 'definition.data.main_action.data.message.ios_link' | 'definition.data.main_action.data.message.kv_pairs' | 'definition.data.main_action.data.message.name' | 'definition.data.main_action.data.message.on_open' | 'definition.data.main_action.data.message.preview_text' | 'definition.data.main_action.data.message.push_type' | 'definition.data.main_action.data.message.reply_to_email' | 'definition.data.main_action.data.message.shorten_links' | 'definition.data.main_action.data.message.smart_sending_enabled' | 'definition.data.main_action.data.message.sms_quiet_hours_enabled' | 'definition.data.main_action.data.message.sound' | 'definition.data.main_action.data.message.subject_line' | 'definition.data.main_action.data.message.template_id' | 'definition.data.main_action.data.message.title' | 'definition.data.main_action.data.message.transactional' | 'definition.data.main_action.data.message.video_asset_id' | 'definition.data.main_action.data.status' | 'definition.data.main_action.id' | 'definition.data.main_action.links' | 'definition.data.main_action.links.next' | 'definition.data.main_action.temporary_id' | 'definition.data.main_action.type' | 'definition.data.message' | 'definition.data.message.action_buttons' | 'definition.data.message.add_info_link' | 'definition.data.message.add_opt_out_language' | 'definition.data.message.add_org_prefix' | 'definition.data.message.add_tracking_params' | 'definition.data.message.additional_filters' | 'definition.data.message.additional_filters.condition_groups' | 'definition.data.message.android_link' | 'definition.data.message.badge' | 'definition.data.message.badge_options' | 'definition.data.message.badge_options.badge_config' | 'definition.data.message.badge_options.set_from_property' | 'definition.data.message.badge_options.value' | 'definition.data.message.bcc_email' | 'definition.data.message.body' | 'definition.data.message.cc_email' | 'definition.data.message.conversion_metric_id' | 'definition.data.message.custom_tracking_params' | 'definition.data.message.dynamic_image' | 'definition.data.message.from_email' | 'definition.data.message.from_label' | 'definition.data.message.headers' | 'definition.data.message.id' | 'definition.data.message.image_id' | 'definition.data.message.include_contact_card' | 'definition.data.message.ios_link' | 'definition.data.message.kv_pairs' | 'definition.data.message.name' | 'definition.data.message.on_open' | 'definition.data.message.preview_text' | 'definition.data.message.push_type' | 'definition.data.message.reply_to_email' | 'definition.data.message.shorten_links' | 'definition.data.message.smart_sending_enabled' | 'definition.data.message.sms_quiet_hours_enabled' | 'definition.data.message.sound' | 'definition.data.message.subject_line' | 'definition.data.message.template_id' | 'definition.data.message.title' | 'definition.data.message.to_emails' | 'definition.data.message.transactional' | 'definition.data.message.url' | 'definition.data.message.vendor_id' | 'definition.data.message.video_asset_id' | 'definition.data.name' | 'definition.data.on_execution' | 'definition.data.profile_filter' | 'definition.data.profile_filter.condition_groups' | 'definition.data.profile_operations' | 'definition.data.secondary_value' | 'definition.data.service_configuration' | 'definition.data.service_configuration.event_key' | 'definition.data.service_configuration.event_payload' | 'definition.data.service_configuration.report_id' | 'definition.data.service_configuration.service_method_type' | 'definition.data.service_configuration.tracking_company_id' | 'definition.data.status' | 'definition.data.target_days' | 'definition.data.target_time' | 'definition.data.timezone' | 'definition.data.trigger_filter' | 'definition.data.trigger_filter.condition_groups' | 'definition.data.trigger_id' | 'definition.data.trigger_subtype' | 'definition.data.trigger_type' | 'definition.data.unit' | 'definition.data.value' | 'definition.id' | 'definition.links' | 'definition.links.next' | 'definition.links.next_if_false' | 'definition.links.next_if_true' | 'definition.temporary_id' | 'definition.type' | 'updated'>");
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'GET',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body: GetFlowActionEncodedResponse; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
body = ObjectSerializer.deserialize(axiosResponse.data, "GetFlowActionEncodedResponse");
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
/**
* Get the [relationship](https://developers.klaviyo.com/en/reference/api_overview#relationships) for a flow message\'s flow action, given the flow ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:read`
* @summary Get Action ID for Flow Message
* @param id
*/
public async getActionIdForFlowMessage (id: string, ): Promise<{ response: AxiosResponse; body: GetFlowMessageActionRelationshipResponse; }> {
const localVarPath = this.basePath + '/api/flow-messages/{id}/relationships/flow-action'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getActionIdForFlowMessage.');
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'GET',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body: GetFlowMessageActionRelationshipResponse; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
body = ObjectSerializer.deserialize(axiosResponse.data, "GetFlowMessageActionRelationshipResponse");
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
/**
* Get all [relationships](https://developers.klaviyo.com/en/reference/api_overview#relationships) for flow actions associated with the given flow ID. Returns a maximum of 100 flows per request, which can be paginated with cursor-based pagination.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:read`
* @summary Get Action IDs for Flow
* @param id
* @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>`id`: `any`<br>`action_type`: `any`, `equals`<br>`status`: `equals`<br>`created`: `equals`, `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`<br>`updated`: `equals`, `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: 50. Min: 1. Max: 50.* @param sort For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sorting
*/
public async getActionIdsForFlow (id: string, options: { filter?: string, pageCursor?: string, pageSize?: number, sort?: 'action_type' | '-action_type' | 'created' | '-created' | 'id' | '-id' | 'status' | '-status' | 'updated' | '-updated', } = {}): Promise<{ response: AxiosResponse; body: GetFlowFlowActionRelationshipListResponseCollection; }> {
const localVarPath = this.basePath + '/api/flows/{id}/relationships/flow-actions'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getActionIdsForFlow.');
}
if (options.filter !== undefined) {
localVarQueryParameters['filter'] = ObjectSerializer.serialize(options.filter, "string");
}
if (options.pageCursor !== undefined) {
localVarQueryParameters['page[cursor]'] = ObjectSerializer.serialize(options.pageCursor, "string");
}
if (options.pageSize !== undefined) {
localVarQueryParameters['page[size]'] = ObjectSerializer.serialize(options.pageSize, "number");
}
if (options.sort !== undefined) {
localVarQueryParameters['sort'] = ObjectSerializer.serialize(options.sort, "'action_type' | '-action_type' | 'created' | '-created' | 'id' | '-id' | 'status' | '-status' | 'updated' | '-updated'");
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'GET',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body: GetFlowFlowActionRelationshipListResponseCollection; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
body = ObjectSerializer.deserialize(axiosResponse.data, "GetFlowFlowActionRelationshipListResponseCollection");
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
/**
* Get all flow actions associated with the given flow ID. Returns a maximum of 50 flows per request, which can be paginated with cursor-based pagination.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:read`
* @summary Get Actions for Flow
* @param id
* @param fieldsFlowAction 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>`id`: `any`<br>`action_type`: `any`, `equals`<br>`status`: `equals`<br>`created`: `equals`, `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`<br>`updated`: `equals`, `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: 50. Min: 1. Max: 50.* @param sort For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sorting
*/
public async getActionsForFlow (id: string, options: { fieldsFlowAction?: Array<'created' | 'definition' | 'definition.data' | 'definition.data.action_output_filter' | 'definition.data.action_output_filter.condition_groups' | 'definition.data.branches' | 'definition.data.current_experiment' | 'definition.data.current_experiment.allocations' | 'definition.data.current_experiment.automatic_winner_selection_settings' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_date' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_statistical_certainty' | 'definition.data.current_experiment.automatic_winner_selection_settings.enabled' | 'definition.data.current_experiment.id' | 'definition.data.current_experiment.name' | 'definition.data.current_experiment.started' | 'definition.data.current_experiment.variations' | 'definition.data.current_experiment.winner_metric' | 'definition.data.delay_until_time' | 'definition.data.delay_until_weekdays' | 'definition.data.experiment_status' | 'definition.data.list_id' | 'definition.data.main_action' | 'definition.data.main_action.data' | 'definition.data.main_action.data.message' | 'definition.data.main_action.data.message.action_buttons' | 'definition.data.main_action.data.message.add_info_link' | 'definition.data.main_action.data.message.add_opt_out_language' | 'definition.data.main_action.data.message.add_org_prefix' | 'definition.data.main_action.data.message.add_tracking_params' | 'definition.data.main_action.data.message.additional_filters' | 'definition.data.main_action.data.message.additional_filters.condition_groups' | 'definition.data.main_action.data.message.android_link' | 'definition.data.main_action.data.message.badge' | 'definition.data.main_action.data.message.badge_options' | 'definition.data.main_action.data.message.badge_options.badge_config' | 'definition.data.main_action.data.message.badge_options.set_from_property' | 'definition.data.main_action.data.message.badge_options.value' | 'definition.data.main_action.data.message.bcc_email' | 'definition.data.main_action.data.message.body' | 'definition.data.main_action.data.message.cc_email' | 'definition.data.main_action.data.message.conversion_metric_id' | 'definition.data.main_action.data.message.custom_tracking_params' | 'definition.data.main_action.data.message.dynamic_image' | 'definition.data.main_action.data.message.from_email' | 'definition.data.main_action.data.message.from_label' | 'definition.data.main_action.data.message.id' | 'definition.data.main_action.data.message.image_id' | 'definition.data.main_action.data.message.include_contact_card' | 'definition.data.main_action.data.message.ios_link' | 'definition.data.main_action.data.message.kv_pairs' | 'definition.data.main_action.data.message.name' | 'definition.data.main_action.data.message.on_open' | 'definition.data.main_action.data.message.preview_text' | 'definition.data.main_action.data.message.push_type' | 'definition.data.main_action.data.message.reply_to_email' | 'definition.data.main_action.data.message.shorten_links' | 'definition.data.main_action.data.message.smart_sending_enabled' | 'definition.data.main_action.data.message.sms_quiet_hours_enabled' | 'definition.data.main_action.data.message.sound' | 'definition.data.main_action.data.message.subject_line' | 'definition.data.main_action.data.message.template_id' | 'definition.data.main_action.data.message.title' | 'definition.data.main_action.data.message.transactional' | 'definition.data.main_action.data.message.video_asset_id' | 'definition.data.main_action.data.status' | 'definition.data.main_action.id' | 'definition.data.main_action.links' | 'definition.data.main_action.links.next' | 'definition.data.main_action.temporary_id' | 'definition.data.main_action.type' | 'definition.data.message' | 'definition.data.message.action_buttons' | 'definition.data.message.add_info_link' | 'definition.data.message.add_opt_out_language' | 'definition.data.message.add_org_prefix' | 'definition.data.message.add_tracking_params' | 'definition.data.message.additional_filters' | 'definition.data.message.additional_filters.condition_groups' | 'definition.data.message.android_link' | 'definition.data.message.badge' | 'definition.data.message.badge_options' | 'definition.data.message.badge_options.badge_config' | 'definition.data.message.badge_options.set_from_property' | 'definition.data.message.badge_options.value' | 'definition.data.message.bcc_email' | 'definition.data.message.body' | 'definition.data.message.cc_email' | 'definition.data.message.conversion_metric_id' | 'definition.data.message.custom_tracking_params' | 'definition.data.message.dynamic_image' | 'definition.data.message.from_email' | 'definition.data.message.from_label' | 'definition.data.message.headers' | 'definition.data.message.id' | 'definition.data.message.image_id' | 'definition.data.message.include_contact_card' | 'definition.data.message.ios_link' | 'definition.data.message.kv_pairs' | 'definition.data.message.name' | 'definition.data.message.on_open' | 'definition.data.message.preview_text' | 'definition.data.message.push_type' | 'definition.data.message.reply_to_email' | 'definition.data.message.shorten_links' | 'definition.data.message.smart_sending_enabled' | 'definition.data.message.sms_quiet_hours_enabled' | 'definition.data.message.sound' | 'definition.data.message.subject_line' | 'definition.data.message.template_id' | 'definition.data.message.title' | 'definition.data.message.to_emails' | 'definition.data.message.transactional' | 'definition.data.message.url' | 'definition.data.message.vendor_id' | 'definition.data.message.video_asset_id' | 'definition.data.name' | 'definition.data.on_execution' | 'definition.data.profile_filter' | 'definition.data.profile_filter.condition_groups' | 'definition.data.profile_operations' | 'definition.data.secondary_value' | 'definition.data.service_configuration' | 'definition.data.service_configuration.event_key' | 'definition.data.service_configuration.event_payload' | 'definition.data.service_configuration.report_id' | 'definition.data.service_configuration.service_method_type' | 'definition.data.service_configuration.tracking_company_id' | 'definition.data.status' | 'definition.data.target_days' | 'definition.data.target_time' | 'definition.data.timezone' | 'definition.data.trigger_filter' | 'definition.data.trigger_filter.condition_groups' | 'definition.data.trigger_id' | 'definition.data.trigger_subtype' | 'definition.data.trigger_type' | 'definition.data.unit' | 'definition.data.value' | 'definition.id' | 'definition.links' | 'definition.links.next' | 'definition.links.next_if_false' | 'definition.links.next_if_true' | 'definition.temporary_id' | 'definition.type' | 'updated'>, filter?: string, pageCursor?: string, pageSize?: number, sort?: 'action_type' | '-action_type' | 'created' | '-created' | 'id' | '-id' | 'status' | '-status' | 'updated' | '-updated', } = {}): Promise<{ response: AxiosResponse; body: GetFlowActionEncodedResponseCollection; }> {
const localVarPath = this.basePath + '/api/flows/{id}/flow-actions'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getActionsForFlow.');
}
if (options.fieldsFlowAction !== undefined) {
localVarQueryParameters['fields[flow-action]'] = ObjectSerializer.serialize(options.fieldsFlowAction, "Array<'created' | 'definition' | 'definition.data' | 'definition.data.action_output_filter' | 'definition.data.action_output_filter.condition_groups' | 'definition.data.branches' | 'definition.data.current_experiment' | 'definition.data.current_experiment.allocations' | 'definition.data.current_experiment.automatic_winner_selection_settings' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_date' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_statistical_certainty' | 'definition.data.current_experiment.automatic_winner_selection_settings.enabled' | 'definition.data.current_experiment.id' | 'definition.data.current_experiment.name' | 'definition.data.current_experiment.started' | 'definition.data.current_experiment.variations' | 'definition.data.current_experiment.winner_metric' | 'definition.data.delay_until_time' | 'definition.data.delay_until_weekdays' | 'definition.data.experiment_status' | 'definition.data.list_id' | 'definition.data.main_action' | 'definition.data.main_action.data' | 'definition.data.main_action.data.message' | 'definition.data.main_action.data.message.action_buttons' | 'definition.data.main_action.data.message.add_info_link' | 'definition.data.main_action.data.message.add_opt_out_language' | 'definition.data.main_action.data.message.add_org_prefix' | 'definition.data.main_action.data.message.add_tracking_params' | 'definition.data.main_action.data.message.additional_filters' | 'definition.data.main_action.data.message.additional_filters.condition_groups' | 'definition.data.main_action.data.message.android_link' | 'definition.data.main_action.data.message.badge' | 'definition.data.main_action.data.message.badge_options' | 'definition.data.main_action.data.message.badge_options.badge_config' | 'definition.data.main_action.data.message.badge_options.set_from_property' | 'definition.data.main_action.data.message.badge_options.value' | 'definition.data.main_action.data.message.bcc_email' | 'definition.data.main_action.data.message.body' | 'definition.data.main_action.data.message.cc_email' | 'definition.data.main_action.data.message.conversion_metric_id' | 'definition.data.main_action.data.message.custom_tracking_params' | 'definition.data.main_action.data.message.dynamic_image' | 'definition.data.main_action.data.message.from_email' | 'definition.data.main_action.data.message.from_label' | 'definition.data.main_action.data.message.id' | 'definition.data.main_action.data.message.image_id' | 'definition.data.main_action.data.message.include_contact_card' | 'definition.data.main_action.data.message.ios_link' | 'definition.data.main_action.data.message.kv_pairs' | 'definition.data.main_action.data.message.name' | 'definition.data.main_action.data.message.on_open' | 'definition.data.main_action.data.message.preview_text' | 'definition.data.main_action.data.message.push_type' | 'definition.data.main_action.data.message.reply_to_email' | 'definition.data.main_action.data.message.shorten_links' | 'definition.data.main_action.data.message.smart_sending_enabled' | 'definition.data.main_action.data.message.sms_quiet_hours_enabled' | 'definition.data.main_action.data.message.sound' | 'definition.data.main_action.data.message.subject_line' | 'definition.data.main_action.data.message.template_id' | 'definition.data.main_action.data.message.title' | 'definition.data.main_action.data.message.transactional' | 'definition.data.main_action.data.message.video_asset_id' | 'definition.data.main_action.data.status' | 'definition.data.main_action.id' | 'definition.data.main_action.links' | 'definition.data.main_action.links.next' | 'definition.data.main_action.temporary_id' | 'definition.data.main_action.type' | 'definition.data.message' | 'definition.data.message.action_buttons' | 'definition.data.message.add_info_link' | 'definition.data.message.add_opt_out_language' | 'definition.data.message.add_org_prefix' | 'definition.data.message.add_tracking_params' | 'definition.data.message.additional_filters' | 'definition.data.message.additional_filters.condition_groups' | 'definition.data.message.android_link' | 'definition.data.message.badge' | 'definition.data.message.badge_options' | 'definition.data.message.badge_options.badge_config' | 'definition.data.message.badge_options.set_from_property' | 'definition.data.message.badge_options.value' | 'definition.data.message.bcc_email' | 'definition.data.message.body' | 'definition.data.message.cc_email' | 'definition.data.message.conversion_metric_id' | 'definition.data.message.custom_tracking_params' | 'definition.data.message.dynamic_image' | 'definition.data.message.from_email' | 'definition.data.message.from_label' | 'definition.data.message.headers' | 'definition.data.message.id' | 'definition.data.message.image_id' | 'definition.data.message.include_contact_card' | 'definition.data.message.ios_link' | 'definition.data.message.kv_pairs' | 'definition.data.message.name' | 'definition.data.message.on_open' | 'definition.data.message.preview_text' | 'definition.data.message.push_type' | 'definition.data.message.reply_to_email' | 'definition.data.message.shorten_links' | 'definition.data.message.smart_sending_enabled' | 'definition.data.message.sms_quiet_hours_enabled' | 'definition.data.message.sound' | 'definition.data.message.subject_line' | 'definition.data.message.template_id' | 'definition.data.message.title' | 'definition.data.message.to_emails' | 'definition.data.message.transactional' | 'definition.data.message.url' | 'definition.data.message.vendor_id' | 'definition.data.message.video_asset_id' | 'definition.data.name' | 'definition.data.on_execution' | 'definition.data.profile_filter' | 'definition.data.profile_filter.condition_groups' | 'definition.data.profile_operations' | 'definition.data.secondary_value' | 'definition.data.service_configuration' | 'definition.data.service_configuration.event_key' | 'definition.data.service_configuration.event_payload' | 'definition.data.service_configuration.report_id' | 'definition.data.service_configuration.service_method_type' | 'definition.data.service_configuration.tracking_company_id' | 'definition.data.status' | 'definition.data.target_days' | 'definition.data.target_time' | 'definition.data.timezone' | 'definition.data.trigger_filter' | 'definition.data.trigger_filter.condition_groups' | 'definition.data.trigger_id' | 'definition.data.trigger_subtype' | 'definition.data.trigger_type' | 'definition.data.unit' | 'definition.data.value' | 'definition.id' | 'definition.links' | 'definition.links.next' | 'definition.links.next_if_false' | 'definition.links.next_if_true' | 'definition.temporary_id' | 'definition.type' | 'updated'>");
}
if (options.filter !== undefined) {
localVarQueryParameters['filter'] = ObjectSerializer.serialize(options.filter, "string");
}
if (options.pageCursor !== undefined) {
localVarQueryParameters['page[cursor]'] = ObjectSerializer.serialize(options.pageCursor, "string");
}
if (options.pageSize !== undefined) {
localVarQueryParameters['page[size]'] = ObjectSerializer.serialize(options.pageSize, "number");
}
if (options.sort !== undefined) {
localVarQueryParameters['sort'] = ObjectSerializer.serialize(options.sort, "'action_type' | '-action_type' | 'created' | '-created' | 'id' | '-id' | 'status' | '-status' | 'updated' | '-updated'");
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'GET',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body: GetFlowActionEncodedResponseCollection; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
body = ObjectSerializer.deserialize(axiosResponse.data, "GetFlowActionEncodedResponseCollection");
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
/**
* Get a flow with the given flow ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:read`
* @summary Get Flow
* @param id
* @param additionalFieldsFlow Request additional fields not included by default in the response. Supported values: \'definition\'* @param fieldsFlowAction For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sparse-fieldsets* @param fieldsFlow 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
*/
public async getFlow (id: string, options: { additionalFieldsFlow?: Array<'definition'>, fieldsFlowAction?: Array<'created' | 'definition' | 'definition.data' | 'definition.data.action_output_filter' | 'definition.data.action_output_filter.condition_groups' | 'definition.data.branches' | 'definition.data.current_experiment' | 'definition.data.current_experiment.allocations' | 'definition.data.current_experiment.automatic_winner_selection_settings' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_date' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_statistical_certainty' | 'definition.data.current_experiment.automatic_winner_selection_settings.enabled' | 'definition.data.current_experiment.id' | 'definition.data.current_experiment.name' | 'definition.data.current_experiment.started' | 'definition.data.current_experiment.variations' | 'definition.data.current_experiment.winner_metric' | 'definition.data.delay_until_time' | 'definition.data.delay_until_weekdays' | 'definition.data.experiment_status' | 'definition.data.list_id' | 'definition.data.main_action' | 'definition.data.main_action.data' | 'definition.data.main_action.data.message' | 'definition.data.main_action.data.message.action_buttons' | 'definition.data.main_action.data.message.add_info_link' | 'definition.data.main_action.data.message.add_opt_out_language' | 'definition.data.main_action.data.message.add_org_prefix' | 'definition.data.main_action.data.message.add_tracking_params' | 'definition.data.main_action.data.message.additional_filters' | 'definition.data.main_action.data.message.additional_filters.condition_groups' | 'definition.data.main_action.data.message.android_link' | 'definition.data.main_action.data.message.badge' | 'definition.data.main_action.data.message.badge_options' | 'definition.data.main_action.data.message.badge_options.badge_config' | 'definition.data.main_action.data.message.badge_options.set_from_property' | 'definition.data.main_action.data.message.badge_options.value' | 'definition.data.main_action.data.message.bcc_email' | 'definition.data.main_action.data.message.body' | 'definition.data.main_action.data.message.cc_email' | 'definition.data.main_action.data.message.conversion_metric_id' | 'definition.data.main_action.data.message.custom_tracking_params' | 'definition.data.main_action.data.message.dynamic_image' | 'definition.data.main_action.data.message.from_email' | 'definition.data.main_action.data.message.from_label' | 'definition.data.main_action.data.message.id' | 'definition.data.main_action.data.message.image_id' | 'definition.data.main_action.data.message.include_contact_card' | 'definition.data.main_action.data.message.ios_link' | 'definition.data.main_action.data.message.kv_pairs' | 'definition.data.main_action.data.message.name' | 'definition.data.main_action.data.message.on_open' | 'definition.data.main_action.data.message.preview_text' | 'definition.data.main_action.data.message.push_type' | 'definition.data.main_action.data.message.reply_to_email' | 'definition.data.main_action.data.message.shorten_links' | 'definition.data.main_action.data.message.smart_sending_enabled' | 'definition.data.main_action.data.message.sms_quiet_hours_enabled' | 'definition.data.main_action.data.message.sound' | 'definition.data.main_action.data.message.subject_line' | 'definition.data.main_action.data.message.template_id' | 'definition.data.main_action.data.message.title' | 'definition.data.main_action.data.message.transactional' | 'definition.data.main_action.data.message.video_asset_id' | 'definition.data.main_action.data.status' | 'definition.data.main_action.id' | 'definition.data.main_action.links' | 'definition.data.main_action.links.next' | 'definition.data.main_action.temporary_id' | 'definition.data.main_action.type' | 'definition.data.message' | 'definition.data.message.action_buttons' | 'definition.data.message.add_info_link' | 'definition.data.message.add_opt_out_language' | 'definition.data.message.add_org_prefix' | 'definition.data.message.add_tracking_params' | 'definition.data.message.additional_filters' | 'definition.data.message.additional_filters.condition_groups' | 'definition.data.message.android_link' | 'definition.data.message.badge' | 'definition.data.message.badge_options' | 'definition.data.message.badge_options.badge_config' | 'definition.data.message.badge_options.set_from_property' | 'definition.data.message.badge_options.value' | 'definition.data.message.bcc_email' | 'definition.data.message.body' | 'definition.data.message.cc_email' | 'definition.data.message.conversion_metric_id' | 'definition.data.message.custom_tracking_params' | 'definition.data.message.dynamic_image' | 'definition.data.message.from_email' | 'definition.data.message.from_label' | 'definition.data.message.headers' | 'definition.data.message.id' | 'definition.data.message.image_id' | 'definition.data.message.include_contact_card' | 'definition.data.message.ios_link' | 'definition.data.message.kv_pairs' | 'definition.data.message.name' | 'definition.data.message.on_open' | 'definition.data.message.preview_text' | 'definition.data.message.push_type' | 'definition.data.message.reply_to_email' | 'definition.data.message.shorten_links' | 'definition.data.message.smart_sending_enabled' | 'definition.data.message.sms_quiet_hours_enabled' | 'definition.data.message.sound' | 'definition.data.message.subject_line' | 'definition.data.message.template_id' | 'definition.data.message.title' | 'definition.data.message.to_emails' | 'definition.data.message.transactional' | 'definition.data.message.url' | 'definition.data.message.vendor_id' | 'definition.data.message.video_asset_id' | 'definition.data.name' | 'definition.data.on_execution' | 'definition.data.profile_filter' | 'definition.data.profile_filter.condition_groups' | 'definition.data.profile_operations' | 'definition.data.secondary_value' | 'definition.data.service_configuration' | 'definition.data.service_configuration.event_key' | 'definition.data.service_configuration.event_payload' | 'definition.data.service_configuration.report_id' | 'definition.data.service_configuration.service_method_type' | 'definition.data.service_configuration.tracking_company_id' | 'definition.data.status' | 'definition.data.target_days' | 'definition.data.target_time' | 'definition.data.timezone' | 'definition.data.trigger_filter' | 'definition.data.trigger_filter.condition_groups' | 'definition.data.trigger_id' | 'definition.data.trigger_subtype' | 'definition.data.trigger_type' | 'definition.data.unit' | 'definition.data.value' | 'definition.id' | 'definition.links' | 'definition.links.next' | 'definition.links.next_if_false' | 'definition.links.next_if_true' | 'definition.temporary_id' | 'definition.type' | 'updated'>, fieldsFlow?: Array<'archived' | 'created' | 'definition' | 'definition.actions' | 'definition.entry_action_id' | 'definition.profile_filter' | 'definition.profile_filter.condition_groups' | 'definition.reentry_criteria' | 'definition.reentry_criteria.duration' | 'definition.reentry_criteria.unit' | 'definition.triggers' | 'name' | 'status' | 'trigger_type' | 'updated'>, fieldsTag?: Array<'name'>, include?: Array<'flow-actions' | 'tags'>, } = {}): Promise<{ response: AxiosResponse; body: GetFlowV2ResponseCompoundDocument; }> {
const localVarPath = this.basePath + '/api/flows/{id}'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getFlow.');
}
if (options.additionalFieldsFlow !== undefined) {
localVarQueryParameters['additional-fields[flow]'] = ObjectSerializer.serialize(options.additionalFieldsFlow, "Array<'definition'>");
}
if (options.fieldsFlowAction !== undefined) {
localVarQueryParameters['fields[flow-action]'] = ObjectSerializer.serialize(options.fieldsFlowAction, "Array<'created' | 'definition' | 'definition.data' | 'definition.data.action_output_filter' | 'definition.data.action_output_filter.condition_groups' | 'definition.data.branches' | 'definition.data.current_experiment' | 'definition.data.current_experiment.allocations' | 'definition.data.current_experiment.automatic_winner_selection_settings' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_date' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_statistical_certainty' | 'definition.data.current_experiment.automatic_winner_selection_settings.enabled' | 'definition.data.current_experiment.id' | 'definition.data.current_experiment.name' | 'definition.data.current_experiment.started' | 'definition.data.current_experiment.variations' | 'definition.data.current_experiment.winner_metric' | 'definition.data.delay_until_time' | 'definition.data.delay_until_weekdays' | 'definition.data.experiment_status' | 'definition.data.list_id' | 'definition.data.main_action' | 'definition.data.main_action.data' | 'definition.data.main_action.data.message' | 'definition.data.main_action.data.message.action_buttons' | 'definition.data.main_action.data.message.add_info_link' | 'definition.data.main_action.data.message.add_opt_out_language' | 'definition.data.main_action.data.message.add_org_prefix' | 'definition.data.main_action.data.message.add_tracking_params' | 'definition.data.main_action.data.message.additional_filters' | 'definition.data.main_action.data.message.additional_filters.condition_groups' | 'definition.data.main_action.data.message.android_link' | 'definition.data.main_action.data.message.badge' | 'definition.data.main_action.data.message.badge_options' | 'definition.data.main_action.data.message.badge_options.badge_config' | 'definition.data.main_action.data.message.badge_options.set_from_property' | 'definition.data.main_action.data.message.badge_options.value' | 'definition.data.main_action.data.message.bcc_email' | 'definition.data.main_action.data.message.body' | 'definition.data.main_action.data.message.cc_email' | 'definition.data.main_action.data.message.conversion_metric_id' | 'definition.data.main_action.data.message.custom_tracking_params' | 'definition.data.main_action.data.message.dynamic_image' | 'definition.data.main_action.data.message.from_email' | 'definition.data.main_action.data.message.from_label' | 'definition.data.main_action.data.message.id' | 'definition.data.main_action.data.message.image_id' | 'definition.data.main_action.data.message.include_contact_card' | 'definition.data.main_action.data.message.ios_link' | 'definition.data.main_action.data.message.kv_pairs' | 'definition.data.main_action.data.message.name' | 'definition.data.main_action.data.message.on_open' | 'definition.data.main_action.data.message.preview_text' | 'definition.data.main_action.data.message.push_type' | 'definition.data.main_action.data.message.reply_to_email' | 'definition.data.main_action.data.message.shorten_links' | 'definition.data.main_action.data.message.smart_sending_enabled' | 'definition.data.main_action.data.message.sms_quiet_hours_enabled' | 'definition.data.main_action.data.message.sound' | 'definition.data.main_action.data.message.subject_line' | 'definition.data.main_action.data.message.template_id' | 'definition.data.main_action.data.message.title' | 'definition.data.main_action.data.message.transactional' | 'definition.data.main_action.data.message.video_asset_id' | 'definition.data.main_action.data.status' | 'definition.data.main_action.id' | 'definition.data.main_action.links' | 'definition.data.main_action.links.next' | 'definition.data.main_action.temporary_id' | 'definition.data.main_action.type' | 'definition.data.message' | 'definition.data.message.action_buttons' | 'definition.data.message.add_info_link' | 'definition.data.message.add_opt_out_language' | 'definition.data.message.add_org_prefix' | 'definition.data.message.add_tracking_params' | 'definition.data.message.additional_filters' | 'definition.data.message.additional_filters.condition_groups' | 'definition.data.message.android_link' | 'definition.data.message.badge' | 'definition.data.message.badge_options' | 'definition.data.message.badge_options.badge_config' | 'definition.data.message.badge_options.set_from_property' | 'definition.data.message.badge_options.value' | 'definition.data.message.bcc_email' | 'definition.data.message.body' | 'definition.data.message.cc_email' | 'definition.data.message.conversion_metric_id' | 'definition.data.message.custom_tracking_params' | 'definition.data.message.dynamic_image' | 'definition.data.message.from_email' | 'definition.data.message.from_label' | 'definition.data.message.headers' | 'definition.data.message.id' | 'definition.data.message.image_id' | 'definition.data.message.include_contact_card' | 'definition.data.message.ios_link' | 'definition.data.message.kv_pairs' | 'definition.data.message.name' | 'definition.data.message.on_open' | 'definition.data.message.preview_text' | 'definition.data.message.push_type' | 'definition.data.message.reply_to_email' | 'definition.data.message.shorten_links' | 'definition.data.message.smart_sending_enabled' | 'definition.data.message.sms_quiet_hours_enabled' | 'definition.data.message.sound' | 'definition.data.message.subject_line' | 'definition.data.message.template_id' | 'definition.data.message.title' | 'definition.data.message.to_emails' | 'definition.data.message.transactional' | 'definition.data.message.url' | 'definition.data.message.vendor_id' | 'definition.data.message.video_asset_id' | 'definition.data.name' | 'definition.data.on_execution' | 'definition.data.profile_filter' | 'definition.data.profile_filter.condition_groups' | 'definition.data.profile_operations' | 'definition.data.secondary_value' | 'definition.data.service_configuration' | 'definition.data.service_configuration.event_key' | 'definition.data.service_configuration.event_payload' | 'definition.data.service_configuration.report_id' | 'definition.data.service_configuration.service_method_type' | 'definition.data.service_configuration.tracking_company_id' | 'definition.data.status' | 'definition.data.target_days' | 'definition.data.target_time' | 'definition.data.timezone' | 'definition.data.trigger_filter' | 'definition.data.trigger_filter.condition_groups' | 'definition.data.trigger_id' | 'definition.data.trigger_subtype' | 'definition.data.trigger_type' | 'definition.data.unit' | 'definition.data.value' | 'definition.id' | 'definition.links' | 'definition.links.next' | 'definition.links.next_if_false' | 'definition.links.next_if_true' | 'definition.temporary_id' | 'definition.type' | 'updated'>");
}
if (options.fieldsFlow !== undefined) {
localVarQueryParameters['fields[flow]'] = ObjectSerializer.serialize(options.fieldsFlow, "Array<'archived' | 'created' | 'definition' | 'definition.actions' | 'definition.entry_action_id' | 'definition.profile_filter' | 'definition.profile_filter.condition_groups' | 'definition.reentry_criteria' | 'definition.reentry_criteria.duration' | 'definition.reentry_criteria.unit' | 'definition.triggers' | 'name' | 'status' | 'trigger_type' | 'updated'>");
}
if (options.fieldsTag !== undefined) {
localVarQueryParameters['fields[tag]'] = ObjectSerializer.serialize(options.fieldsTag, "Array<'name'>");
}
if (options.include !== undefined) {
localVarQueryParameters['include'] = ObjectSerializer.serialize(options.include, "Array<'flow-actions' | 'tags'>");
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'GET',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body: GetFlowV2ResponseCompoundDocument; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
body = ObjectSerializer.deserialize(axiosResponse.data, "GetFlowV2ResponseCompoundDocument");
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
/**
* Get a flow action from a flow with the given flow action ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:read`
* @summary Get Flow Action
* @param id
* @param fieldsFlowAction For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sparse-fieldsets* @param fieldsFlowMessage For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sparse-fieldsets* @param fieldsFlow 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
*/
public async getFlowAction (id: string, options: { fieldsFlowAction?: Array<'created' | 'definition' | 'definition.data' | 'definition.data.action_output_filter' | 'definition.data.action_output_filter.condition_groups' | 'definition.data.branches' | 'definition.data.current_experiment' | 'definition.data.current_experiment.allocations' | 'definition.data.current_experiment.automatic_winner_selection_settings' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_date' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_statistical_certainty' | 'definition.data.current_experiment.automatic_winner_selection_settings.enabled' | 'definition.data.current_experiment.id' | 'definition.data.current_experiment.name' | 'definition.data.current_experiment.started' | 'definition.data.current_experiment.variations' | 'definition.data.current_experiment.winner_metric' | 'definition.data.delay_until_time' | 'definition.data.delay_until_weekdays' | 'definition.data.experiment_status' | 'definition.data.list_id' | 'definition.data.main_action' | 'definition.data.main_action.data' | 'definition.data.main_action.data.message' | 'definition.data.main_action.data.message.action_buttons' | 'definition.data.main_action.data.message.add_info_link' | 'definition.data.main_action.data.message.add_opt_out_language' | 'definition.data.main_action.data.message.add_org_prefix' | 'definition.data.main_action.data.message.add_tracking_params' | 'definition.data.main_action.data.message.additional_filters' | 'definition.data.main_action.data.message.additional_filters.condition_groups' | 'definition.data.main_action.data.message.android_link' | 'definition.data.main_action.data.message.badge' | 'definition.data.main_action.data.message.badge_options' | 'definition.data.main_action.data.message.badge_options.badge_config' | 'definition.data.main_action.data.message.badge_options.set_from_property' | 'definition.data.main_action.data.message.badge_options.value' | 'definition.data.main_action.data.message.bcc_email' | 'definition.data.main_action.data.message.body' | 'definition.data.main_action.data.message.cc_email' | 'definition.data.main_action.data.message.conversion_metric_id' | 'definition.data.main_action.data.message.custom_tracking_params' | 'definition.data.main_action.data.message.dynamic_image' | 'definition.data.main_action.data.message.from_email' | 'definition.data.main_action.data.message.from_label' | 'definition.data.main_action.data.message.id' | 'definition.data.main_action.data.message.image_id' | 'definition.data.main_action.data.message.include_contact_card' | 'definition.data.main_action.data.message.ios_link' | 'definition.data.main_action.data.message.kv_pairs' | 'definition.data.main_action.data.message.name' | 'definition.data.main_action.data.message.on_open' | 'definition.data.main_action.data.message.preview_text' | 'definition.data.main_action.data.message.push_type' | 'definition.data.main_action.data.message.reply_to_email' | 'definition.data.main_action.data.message.shorten_links' | 'definition.data.main_action.data.message.smart_sending_enabled' | 'definition.data.main_action.data.message.sms_quiet_hours_enabled' | 'definition.data.main_action.data.message.sound' | 'definition.data.main_action.data.message.subject_line' | 'definition.data.main_action.data.message.template_id' | 'definition.data.main_action.data.message.title' | 'definition.data.main_action.data.message.transactional' | 'definition.data.main_action.data.message.video_asset_id' | 'definition.data.main_action.data.status' | 'definition.data.main_action.id' | 'definition.data.main_action.links' | 'definition.data.main_action.links.next' | 'definition.data.main_action.temporary_id' | 'definition.data.main_action.type' | 'definition.data.message' | 'definition.data.message.action_buttons' | 'definition.data.message.add_info_link' | 'definition.data.message.add_opt_out_language' | 'definition.data.message.add_org_prefix' | 'definition.data.message.add_tracking_params' | 'definition.data.message.additional_filters' | 'definition.data.message.additional_filters.condition_groups' | 'definition.data.message.android_link' | 'definition.data.message.badge' | 'definition.data.message.badge_options' | 'definition.data.message.badge_options.badge_config' | 'definition.data.message.badge_options.set_from_property' | 'definition.data.message.badge_options.value' | 'definition.data.message.bcc_email' | 'definition.data.message.body' | 'definition.data.message.cc_email' | 'definition.data.message.conversion_metric_id' | 'definition.data.message.custom_tracking_params' | 'definition.data.message.dynamic_image' | 'definition.data.message.from_email' | 'definition.data.message.from_label' | 'definition.data.message.headers' | 'definition.data.message.id' | 'definition.data.message.image_id' | 'definition.data.message.include_contact_card' | 'definition.data.message.ios_link' | 'definition.data.message.kv_pairs' | 'definition.data.message.name' | 'definition.data.message.on_open' | 'definition.data.message.preview_text' | 'definition.data.message.push_type' | 'definition.data.message.reply_to_email' | 'definition.data.message.shorten_links' | 'definition.data.message.smart_sending_enabled' | 'definition.data.message.sms_quiet_hours_enabled' | 'definition.data.message.sound' | 'definition.data.message.subject_line' | 'definition.data.message.template_id' | 'definition.data.message.title' | 'definition.data.message.to_emails' | 'definition.data.message.transactional' | 'definition.data.message.url' | 'definition.data.message.vendor_id' | 'definition.data.message.video_asset_id' | 'definition.data.name' | 'definition.data.on_execution' | 'definition.data.profile_filter' | 'definition.data.profile_filter.condition_groups' | 'definition.data.profile_operations' | 'definition.data.secondary_value' | 'definition.data.service_configuration' | 'definition.data.service_configuration.event_key' | 'definition.data.service_configuration.event_payload' | 'definition.data.service_configuration.report_id' | 'definition.data.service_configuration.service_method_type' | 'definition.data.service_configuration.tracking_company_id' | 'definition.data.status' | 'definition.data.target_days' | 'definition.data.target_time' | 'definition.data.timezone' | 'definition.data.trigger_filter' | 'definition.data.trigger_filter.condition_groups' | 'definition.data.trigger_id' | 'definition.data.trigger_subtype' | 'definition.data.trigger_type' | 'definition.data.unit' | 'definition.data.value' | 'definition.id' | 'definition.links' | 'definition.links.next' | 'definition.links.next_if_false' | 'definition.links.next_if_true' | 'definition.temporary_id' | 'definition.type' | 'updated'>, fieldsFlowMessage?: Array<'channel' | 'created' | 'definition' | 'definition.action_buttons' | 'definition.add_info_link' | 'definition.add_opt_out_language' | 'definition.add_org_prefix' | 'definition.add_tracking_params' | 'definition.additional_filters' | 'definition.additional_filters.condition_groups' | 'definition.android_link' | 'definition.badge' | 'definition.badge_options' | 'definition.badge_options.badge_config' | 'definition.badge_options.set_from_property' | 'definition.badge_options.value' | 'definition.bcc_email' | 'definition.body' | 'definition.cc_email' | 'definition.conversion_metric_id' | 'definition.custom_tracking_params' | 'definition.dynamic_image' | 'definition.from_email' | 'definition.from_label' | 'definition.headers' | 'definition.id' | 'definition.image_id' | 'definition.include_contact_card' | 'definition.ios_link' | 'definition.kv_pairs' | 'definition.name' | 'definition.on_open' | 'definition.preview_text' | 'definition.push_type' | 'definition.reply_to_email' | 'definition.shorten_links' | 'definition.smart_sending_enabled' | 'definition.sms_quiet_hours_enabled' | 'definition.sound' | 'definition.subject_line' | 'definition.template_id' | 'definition.title' | 'definition.to_emails' | 'definition.transactional' | 'definition.url' | 'definition.vendor_id' | 'definition.video_asset_id' | 'updated'>, fieldsFlow?: Array<'archived' | 'created' | 'name' | 'status' | 'trigger_type' | 'updated'>, include?: Array<'flow' | 'flow-messages'>, } = {}): Promise<{ response: AxiosResponse; body: GetFlowActionEncodedResponseCompoundDocument; }> {
const localVarPath = this.basePath + '/api/flow-actions/{id}'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getFlowAction.');
}
if (options.fieldsFlowAction !== undefined) {
localVarQueryParameters['fields[flow-action]'] = ObjectSerializer.serialize(options.fieldsFlowAction, "Array<'created' | 'definition' | 'definition.data' | 'definition.data.action_output_filter' | 'definition.data.action_output_filter.condition_groups' | 'definition.data.branches' | 'definition.data.current_experiment' | 'definition.data.current_experiment.allocations' | 'definition.data.current_experiment.automatic_winner_selection_settings' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_date' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_statistical_certainty' | 'definition.data.current_experiment.automatic_winner_selection_settings.enabled' | 'definition.data.current_experiment.id' | 'definition.data.current_experiment.name' | 'definition.data.current_experiment.started' | 'definition.data.current_experiment.variations' | 'definition.data.current_experiment.winner_metric' | 'definition.data.delay_until_time' | 'definition.data.delay_until_weekdays' | 'definition.data.experiment_status' | 'definition.data.list_id' | 'definition.data.main_action' | 'definition.data.main_action.data' | 'definition.data.main_action.data.message' | 'definition.data.main_action.data.message.action_buttons' | 'definition.data.main_action.data.message.add_info_link' | 'definition.data.main_action.data.message.add_opt_out_language' | 'definition.data.main_action.data.message.add_org_prefix' | 'definition.data.main_action.data.message.add_tracking_params' | 'definition.data.main_action.data.message.additional_filters' | 'definition.data.main_action.data.message.additional_filters.condition_groups' | 'definition.data.main_action.data.message.android_link' | 'definition.data.main_action.data.message.badge' | 'definition.data.main_action.data.message.badge_options' | 'definition.data.main_action.data.message.badge_options.badge_config' | 'definition.data.main_action.data.message.badge_options.set_from_property' | 'definition.data.main_action.data.message.badge_options.value' | 'definition.data.main_action.data.message.bcc_email' | 'definition.data.main_action.data.message.body' | 'definition.data.main_action.data.message.cc_email' | 'definition.data.main_action.data.message.conversion_metric_id' | 'definition.data.main_action.data.message.custom_tracking_params' | 'definition.data.main_action.data.message.dynamic_image' | 'definition.data.main_action.data.message.from_email' | 'definition.data.main_action.data.message.from_label' | 'definition.data.main_action.data.message.id' | 'definition.data.main_action.data.message.image_id' | 'definition.data.main_action.data.message.include_contact_card' | 'definition.data.main_action.data.message.ios_link' | 'definition.data.main_action.data.message.kv_pairs' | 'definition.data.main_action.data.message.name' | 'definition.data.main_action.data.message.on_open' | 'definition.data.main_action.data.message.preview_text' | 'definition.data.main_action.data.message.push_type' | 'definition.data.main_action.data.message.reply_to_email' | 'definition.data.main_action.data.message.shorten_links' | 'definition.data.main_action.data.message.smart_sending_enabled' | 'definition.data.main_action.data.message.sms_quiet_hours_enabled' | 'definition.data.main_action.data.message.sound' | 'definition.data.main_action.data.message.subject_line' | 'definition.data.main_action.data.message.template_id' | 'definition.data.main_action.data.message.title' | 'definition.data.main_action.data.message.transactional' | 'definition.data.main_action.data.message.video_asset_id' | 'definition.data.main_action.data.status' | 'definition.data.main_action.id' | 'definition.data.main_action.links' | 'definition.data.main_action.links.next' | 'definition.data.main_action.temporary_id' | 'definition.data.main_action.type' | 'definition.data.message' | 'definition.data.message.action_buttons' | 'definition.data.message.add_info_link' | 'definition.data.message.add_opt_out_language' | 'definition.data.message.add_org_prefix' | 'definition.data.message.add_tracking_params' | 'definition.data.message.additional_filters' | 'definition.data.message.additional_filters.condition_groups' | 'definition.data.message.android_link' | 'definition.data.message.badge' | 'definition.data.message.badge_options' | 'definition.data.message.badge_options.badge_config' | 'definition.data.message.badge_options.set_from_property' | 'definition.data.message.badge_options.value' | 'definition.data.message.bcc_email' | 'definition.data.message.body' | 'definition.data.message.cc_email' | 'definition.data.message.conversion_metric_id' | 'definition.data.message.custom_tracking_params' | 'definition.data.message.dynamic_image' | 'definition.data.message.from_email' | 'definition.data.message.from_label' | 'definition.data.message.headers' | 'definition.data.message.id' | 'definition.data.message.image_id' | 'definition.data.message.include_contact_card' | 'definition.data.message.ios_link' | 'definition.data.message.kv_pairs' | 'definition.data.message.name' | 'definition.data.message.on_open' | 'definition.data.message.preview_text' | 'definition.data.message.push_type' | 'definition.data.message.reply_to_email' | 'definition.data.message.shorten_links' | 'definition.data.message.smart_sending_enabled' | 'definition.data.message.sms_quiet_hours_enabled' | 'definition.data.message.sound' | 'definition.data.message.subject_line' | 'definition.data.message.template_id' | 'definition.data.message.title' | 'definition.data.message.to_emails' | 'definition.data.message.transactional' | 'definition.data.message.url' | 'definition.data.message.vendor_id' | 'definition.data.message.video_asset_id' | 'definition.data.name' | 'definition.data.on_execution' | 'definition.data.profile_filter' | 'definition.data.profile_filter.condition_groups' | 'definition.data.profile_operations' | 'definition.data.secondary_value' | 'definition.data.service_configuration' | 'definition.data.service_configuration.event_key' | 'definition.data.service_configuration.event_payload' | 'definition.data.service_configuration.report_id' | 'definition.data.service_configuration.service_method_type' | 'definition.data.service_configuration.tracking_company_id' | 'definition.data.status' | 'definition.data.target_days' | 'definition.data.target_time' | 'definition.data.timezone' | 'definition.data.trigger_filter' | 'definition.data.trigger_filter.condition_groups' | 'definition.data.trigger_id' | 'definition.data.trigger_subtype' | 'definition.data.trigger_type' | 'definition.data.unit' | 'definition.data.value' | 'definition.id' | 'definition.links' | 'definition.links.next' | 'definition.links.next_if_false' | 'definition.links.next_if_true' | 'definition.temporary_id' | 'definition.type' | 'updated'>");
}
if (options.fieldsFlowMessage !== undefined) {
localVarQueryParameters['fields[flow-message]'] = ObjectSerializer.serialize(options.fieldsFlowMessage, "Array<'channel' | 'created' | 'definition' | 'definition.action_buttons' | 'definition.add_info_link' | 'definition.add_opt_out_language' | 'definition.add_org_prefix' | 'definition.add_tracking_params' | 'definition.additional_filters' | 'definition.additional_filters.condition_groups' | 'definition.android_link' | 'definition.badge' | 'definition.badge_options' | 'definition.badge_options.badge_config' | 'definition.badge_options.set_from_property' | 'definition.badge_options.value' | 'definition.bcc_email' | 'definition.body' | 'definition.cc_email' | 'definition.conversion_metric_id' | 'definition.custom_tracking_params' | 'definition.dynamic_image' | 'definition.from_email' | 'definition.from_label' | 'definition.headers' | 'definition.id' | 'definition.image_id' | 'definition.include_contact_card' | 'definition.ios_link' | 'definition.kv_pairs' | 'definition.name' | 'definition.on_open' | 'definition.preview_text' | 'definition.push_type' | 'definition.reply_to_email' | 'definition.shorten_links' | 'definition.smart_sending_enabled' | 'definition.sms_quiet_hours_enabled' | 'definition.sound' | 'definition.subject_line' | 'definition.template_id' | 'definition.title' | 'definition.to_emails' | 'definition.transactional' | 'definition.url' | 'definition.vendor_id' | 'definition.video_asset_id' | 'updated'>");
}
if (options.fieldsFlow !== undefined) {
localVarQueryParameters['fields[flow]'] = ObjectSerializer.serialize(options.fieldsFlow, "Array<'archived' | 'created' | 'name' | 'status' | 'trigger_type' | 'updated'>");
}
if (options.include !== undefined) {
localVarQueryParameters['include'] = ObjectSerializer.serialize(options.include, "Array<'flow' | 'flow-messages'>");
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'GET',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body: GetFlowActionEncodedResponseCompoundDocument; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
body = ObjectSerializer.deserialize(axiosResponse.data, "GetFlowActionEncodedResponseCompoundDocument");
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
/**
* Get all flow messages associated with the given flow action ID. Returns a maximum of 50 flow message relationships per request, which can be paginated with cursor-based pagination.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:read`
* @summary Get Messages For Flow Action
* @param id
* @param fieldsFlowMessage 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>`id`: `any`<br>`name`: `contains`, `ends-with`, `equals`, `starts-with`<br>`created`: `equals`, `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`<br>`updated`: `equals`, `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: 50. Min: 1. Max: 50.* @param sort For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sorting
*/
public async getFlowActionMessages (id: string, options: { fieldsFlowMessage?: Array<'channel' | 'created' | 'definition' | 'definition.action_buttons' | 'definition.add_info_link' | 'definition.add_opt_out_language' | 'definition.add_org_prefix' | 'definition.add_tracking_params' | 'definition.additional_filters' | 'definition.additional_filters.condition_groups' | 'definition.android_link' | 'definition.badge' | 'definition.badge_options' | 'definition.badge_options.badge_config' | 'definition.badge_options.set_from_property' | 'definition.badge_options.value' | 'definition.bcc_email' | 'definition.body' | 'definition.cc_email' | 'definition.conversion_metric_id' | 'definition.custom_tracking_params' | 'definition.dynamic_image' | 'definition.from_email' | 'definition.from_label' | 'definition.headers' | 'definition.id' | 'definition.image_id' | 'definition.include_contact_card' | 'definition.ios_link' | 'definition.kv_pairs' | 'definition.name' | 'definition.on_open' | 'definition.preview_text' | 'definition.push_type' | 'definition.reply_to_email' | 'definition.shorten_links' | 'definition.smart_sending_enabled' | 'definition.sms_quiet_hours_enabled' | 'definition.sound' | 'definition.subject_line' | 'definition.template_id' | 'definition.title' | 'definition.to_emails' | 'definition.transactional' | 'definition.url' | 'definition.vendor_id' | 'definition.video_asset_id' | 'updated'>, filter?: string, pageCursor?: string, pageSize?: number, sort?: 'created' | '-created' | 'id' | '-id' | 'name' | '-name' | 'updated' | '-updated', } = {}): Promise<{ response: AxiosResponse; body: GetFlowMessageEncodedResponseCollection; }> {
const localVarPath = this.basePath + '/api/flow-actions/{id}/flow-messages'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getFlowActionMessages.');
}
if (options.fieldsFlowMessage !== undefined) {
localVarQueryParameters['fields[flow-message]'] = ObjectSerializer.serialize(options.fieldsFlowMessage, "Array<'channel' | 'created' | 'definition' | 'definition.action_buttons' | 'definition.add_info_link' | 'definition.add_opt_out_language' | 'definition.add_org_prefix' | 'definition.add_tracking_params' | 'definition.additional_filters' | 'definition.additional_filters.condition_groups' | 'definition.android_link' | 'definition.badge' | 'definition.badge_options' | 'definition.badge_options.badge_config' | 'definition.badge_options.set_from_property' | 'definition.badge_options.value' | 'definition.bcc_email' | 'definition.body' | 'definition.cc_email' | 'definition.conversion_metric_id' | 'definition.custom_tracking_params' | 'definition.dynamic_image' | 'definition.from_email' | 'definition.from_label' | 'definition.headers' | 'definition.id' | 'definition.image_id' | 'definition.include_contact_card' | 'definition.ios_link' | 'definition.kv_pairs' | 'definition.name' | 'definition.on_open' | 'definition.preview_text' | 'definition.push_type' | 'definition.reply_to_email' | 'definition.shorten_links' | 'definition.smart_sending_enabled' | 'definition.sms_quiet_hours_enabled' | 'definition.sound' | 'definition.subject_line' | 'definition.template_id' | 'definition.title' | 'definition.to_emails' | 'definition.transactional' | 'definition.url' | 'definition.vendor_id' | 'definition.video_asset_id' | 'updated'>");
}
if (options.filter !== undefined) {
localVarQueryParameters['filter'] = ObjectSerializer.serialize(options.filter, "string");
}
if (options.pageCursor !== undefined) {
localVarQueryParameters['page[cursor]'] = ObjectSerializer.serialize(options.pageCursor, "string");
}
if (options.pageSize !== undefined) {
localVarQueryParameters['page[size]'] = ObjectSerializer.serialize(options.pageSize, "number");
}
if (options.sort !== undefined) {
localVarQueryParameters['sort'] = ObjectSerializer.serialize(options.sort, "'created' | '-created' | 'id' | '-id' | 'name' | '-name' | 'updated' | '-updated'");
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'GET',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body: GetFlowMessageEncodedResponseCollection; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
body = ObjectSerializer.deserialize(axiosResponse.data, "GetFlowMessageEncodedResponseCollection");
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
/**
* Get the flow associated with the given action ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:read`
* @summary Get Flow for Flow Action
* @param id
* @param fieldsFlow For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sparse-fieldsets
*/
public async getFlowForFlowAction (id: string, options: { fieldsFlow?: Array<'archived' | 'created' | 'name' | 'status' | 'trigger_type' | 'updated'>, } = {}): Promise<{ response: AxiosResponse; body: GetFlowResponse; }> {
const localVarPath = this.basePath + '/api/flow-actions/{id}/flow'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getFlowForFlowAction.');
}
if (options.fieldsFlow !== undefined) {
localVarQueryParameters['fields[flow]'] = ObjectSerializer.serialize(options.fieldsFlow, "Array<'archived' | 'created' | 'name' | 'status' | 'trigger_type' | 'updated'>");
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'GET',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body: GetFlowResponse; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
body = ObjectSerializer.deserialize(axiosResponse.data, "GetFlowResponse");
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
/**
* Get the flow associated with the given action ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:read`
* @summary Get Flow ID for Flow Action
* @param id
*/
public async getFlowIdForFlowAction (id: string, ): Promise<{ response: AxiosResponse; body: GetFlowActionFlowRelationshipResponse; }> {
const localVarPath = this.basePath + '/api/flow-actions/{id}/relationships/flow'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getFlowIdForFlowAction.');
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'GET',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body: GetFlowActionFlowRelationshipResponse; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
body = ObjectSerializer.deserialize(axiosResponse.data, "GetFlowActionFlowRelationshipResponse");
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
/**
* Get a flow message from a flow with the given flow message ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:read`
* @summary Get Flow Message
* @param id
* @param fieldsFlowAction For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sparse-fieldsets* @param fieldsFlowMessage For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sparse-fieldsets* @param fieldsTemplate 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
*/
public async getFlowMessage (id: string, options: { fieldsFlowAction?: Array<'created' | 'definition' | 'definition.data' | 'definition.data.action_output_filter' | 'definition.data.action_output_filter.condition_groups' | 'definition.data.branches' | 'definition.data.current_experiment' | 'definition.data.current_experiment.allocations' | 'definition.data.current_experiment.automatic_winner_selection_settings' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_date' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_statistical_certainty' | 'definition.data.current_experiment.automatic_winner_selection_settings.enabled' | 'definition.data.current_experiment.id' | 'definition.data.current_experiment.name' | 'definition.data.current_experiment.started' | 'definition.data.current_experiment.variations' | 'definition.data.current_experiment.winner_metric' | 'definition.data.delay_until_time' | 'definition.data.delay_until_weekdays' | 'definition.data.experiment_status' | 'definition.data.list_id' | 'definition.data.main_action' | 'definition.data.main_action.data' | 'definition.data.main_action.data.message' | 'definition.data.main_action.data.message.action_buttons' | 'definition.data.main_action.data.message.add_info_link' | 'definition.data.main_action.data.message.add_opt_out_language' | 'definition.data.main_action.data.message.add_org_prefix' | 'definition.data.main_action.data.message.add_tracking_params' | 'definition.data.main_action.data.message.additional_filters' | 'definition.data.main_action.data.message.additional_filters.condition_groups' | 'definition.data.main_action.data.message.android_link' | 'definition.data.main_action.data.message.badge' | 'definition.data.main_action.data.message.badge_options' | 'definition.data.main_action.data.message.badge_options.badge_config' | 'definition.data.main_action.data.message.badge_options.set_from_property' | 'definition.data.main_action.data.message.badge_options.value' | 'definition.data.main_action.data.message.bcc_email' | 'definition.data.main_action.data.message.body' | 'definition.data.main_action.data.message.cc_email' | 'definition.data.main_action.data.message.conversion_metric_id' | 'definition.data.main_action.data.message.custom_tracking_params' | 'definition.data.main_action.data.message.dynamic_image' | 'definition.data.main_action.data.message.from_email' | 'definition.data.main_action.data.message.from_label' | 'definition.data.main_action.data.message.id' | 'definition.data.main_action.data.message.image_id' | 'definition.data.main_action.data.message.include_contact_card' | 'definition.data.main_action.data.message.ios_link' | 'definition.data.main_action.data.message.kv_pairs' | 'definition.data.main_action.data.message.name' | 'definition.data.main_action.data.message.on_open' | 'definition.data.main_action.data.message.preview_text' | 'definition.data.main_action.data.message.push_type' | 'definition.data.main_action.data.message.reply_to_email' | 'definition.data.main_action.data.message.shorten_links' | 'definition.data.main_action.data.message.smart_sending_enabled' | 'definition.data.main_action.data.message.sms_quiet_hours_enabled' | 'definition.data.main_action.data.message.sound' | 'definition.data.main_action.data.message.subject_line' | 'definition.data.main_action.data.message.template_id' | 'definition.data.main_action.data.message.title' | 'definition.data.main_action.data.message.transactional' | 'definition.data.main_action.data.message.video_asset_id' | 'definition.data.main_action.data.status' | 'definition.data.main_action.id' | 'definition.data.main_action.links' | 'definition.data.main_action.links.next' | 'definition.data.main_action.temporary_id' | 'definition.data.main_action.type' | 'definition.data.message' | 'definition.data.message.action_buttons' | 'definition.data.message.add_info_link' | 'definition.data.message.add_opt_out_language' | 'definition.data.message.add_org_prefix' | 'definition.data.message.add_tracking_params' | 'definition.data.message.additional_filters' | 'definition.data.message.additional_filters.condition_groups' | 'definition.data.message.android_link' | 'definition.data.message.badge' | 'definition.data.message.badge_options' | 'definition.data.message.badge_options.badge_config' | 'definition.data.message.badge_options.set_from_property' | 'definition.data.message.badge_options.value' | 'definition.data.message.bcc_email' | 'definition.data.message.body' | 'definition.data.message.cc_email' | 'definition.data.message.conversion_metric_id' | 'definition.data.message.custom_tracking_params' | 'definition.data.message.dynamic_image' | 'definition.data.message.from_email' | 'definition.data.message.from_label' | 'definition.data.message.headers' | 'definition.data.message.id' | 'definition.data.message.image_id' | 'definition.data.message.include_contact_card' | 'definition.data.message.ios_link' | 'definition.data.message.kv_pairs' | 'definition.data.message.name' | 'definition.data.message.on_open' | 'definition.data.message.preview_text' | 'definition.data.message.push_type' | 'definition.data.message.reply_to_email' | 'definition.data.message.shorten_links' | 'definition.data.message.smart_sending_enabled' | 'definition.data.message.sms_quiet_hours_enabled' | 'definition.data.message.sound' | 'definition.data.message.subject_line' | 'definition.data.message.template_id' | 'definition.data.message.title' | 'definition.data.message.to_emails' | 'definition.data.message.transactional' | 'definition.data.message.url' | 'definition.data.message.vendor_id' | 'definition.data.message.video_asset_id' | 'definition.data.name' | 'definition.data.on_execution' | 'definition.data.profile_filter' | 'definition.data.profile_filter.condition_groups' | 'definition.data.profile_operations' | 'definition.data.secondary_value' | 'definition.data.service_configuration' | 'definition.data.service_configuration.event_key' | 'definition.data.service_configuration.event_payload' | 'definition.data.service_configuration.report_id' | 'definition.data.service_configuration.service_method_type' | 'definition.data.service_configuration.tracking_company_id' | 'definition.data.status' | 'definition.data.target_days' | 'definition.data.target_time' | 'definition.data.timezone' | 'definition.data.trigger_filter' | 'definition.data.trigger_filter.condition_groups' | 'definition.data.trigger_id' | 'definition.data.trigger_subtype' | 'definition.data.trigger_type' | 'definition.data.unit' | 'definition.data.value' | 'definition.id' | 'definition.links' | 'definition.links.next' | 'definition.links.next_if_false' | 'definition.links.next_if_true' | 'definition.temporary_id' | 'definition.type' | 'updated'>, fieldsFlowMessage?: Array<'channel' | 'created' | 'definition' | 'definition.action_buttons' | 'definition.add_info_link' | 'definition.add_opt_out_language' | 'definition.add_org_prefix' | 'definition.add_tracking_params' | 'definition.additional_filters' | 'definition.additional_filters.condition_groups' | 'definition.android_link' | 'definition.badge' | 'definition.badge_options' | 'definition.badge_options.badge_config' | 'definition.badge_options.set_from_property' | 'definition.badge_options.value' | 'definition.bcc_email' | 'definition.body' | 'definition.cc_email' | 'definition.conversion_metric_id' | 'definition.custom_tracking_params' | 'definition.dynamic_image' | 'definition.from_email' | 'definition.from_label' | 'definition.headers' | 'definition.id' | 'definition.image_id' | 'definition.include_contact_card' | 'definition.ios_link' | 'definition.kv_pairs' | 'definition.name' | 'definition.on_open' | 'definition.preview_text' | 'definition.push_type' | 'definition.reply_to_email' | 'definition.shorten_links' | 'definition.smart_sending_enabled' | 'definition.sms_quiet_hours_enabled' | 'definition.sound' | 'definition.subject_line' | 'definition.template_id' | 'definition.title' | 'definition.to_emails' | 'definition.transactional' | 'definition.url' | 'definition.vendor_id' | 'definition.video_asset_id' | 'updated'>, fieldsTemplate?: Array<'amp' | 'created' | 'editor_type' | 'html' | 'name' | 'text' | 'updated'>, include?: Array<'flow-action' | 'template'>, } = {}): Promise<{ response: AxiosResponse; body: GetFlowMessageEncodedResponseCompoundDocument; }> {
const localVarPath = this.basePath + '/api/flow-messages/{id}'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getFlowMessage.');
}
if (options.fieldsFlowAction !== undefined) {
localVarQueryParameters['fields[flow-action]'] = ObjectSerializer.serialize(options.fieldsFlowAction, "Array<'created' | 'definition' | 'definition.data' | 'definition.data.action_output_filter' | 'definition.data.action_output_filter.condition_groups' | 'definition.data.branches' | 'definition.data.current_experiment' | 'definition.data.current_experiment.allocations' | 'definition.data.current_experiment.automatic_winner_selection_settings' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_date' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_statistical_certainty' | 'definition.data.current_experiment.automatic_winner_selection_settings.enabled' | 'definition.data.current_experiment.id' | 'definition.data.current_experiment.name' | 'definition.data.current_experiment.started' | 'definition.data.current_experiment.variations' | 'definition.data.current_experiment.winner_metric' | 'definition.data.delay_until_time' | 'definition.data.delay_until_weekdays' | 'definition.data.experiment_status' | 'definition.data.list_id' | 'definition.data.main_action' | 'definition.data.main_action.data' | 'definition.data.main_action.data.message' | 'definition.data.main_action.data.message.action_buttons' | 'definition.data.main_action.data.message.add_info_link' | 'definition.data.main_action.data.message.add_opt_out_language' | 'definition.data.main_action.data.message.add_org_prefix' | 'definition.data.main_action.data.message.add_tracking_params' | 'definition.data.main_action.data.message.additional_filters' | 'definition.data.main_action.data.message.additional_filters.condition_groups' | 'definition.data.main_action.data.message.android_link' | 'definition.data.main_action.data.message.badge' | 'definition.data.main_action.data.message.badge_options' | 'definition.data.main_action.data.message.badge_options.badge_config' | 'definition.data.main_action.data.message.badge_options.set_from_property' | 'definition.data.main_action.data.message.badge_options.value' | 'definition.data.main_action.data.message.bcc_email' | 'definition.data.main_action.data.message.body' | 'definition.data.main_action.data.message.cc_email' | 'definition.data.main_action.data.message.conversion_metric_id' | 'definition.data.main_action.data.message.custom_tracking_params' | 'definition.data.main_action.data.message.dynamic_image' | 'definition.data.main_action.data.message.from_email' | 'definition.data.main_action.data.message.from_label' | 'definition.data.main_action.data.message.id' | 'definition.data.main_action.data.message.image_id' | 'definition.data.main_action.data.message.include_contact_card' | 'definition.data.main_action.data.message.ios_link' | 'definition.data.main_action.data.message.kv_pairs' | 'definition.data.main_action.data.message.name' | 'definition.data.main_action.data.message.on_open' | 'definition.data.main_action.data.message.preview_text' | 'definition.data.main_action.data.message.push_type' | 'definition.data.main_action.data.message.reply_to_email' | 'definition.data.main_action.data.message.shorten_links' | 'definition.data.main_action.data.message.smart_sending_enabled' | 'definition.data.main_action.data.message.sms_quiet_hours_enabled' | 'definition.data.main_action.data.message.sound' | 'definition.data.main_action.data.message.subject_line' | 'definition.data.main_action.data.message.template_id' | 'definition.data.main_action.data.message.title' | 'definition.data.main_action.data.message.transactional' | 'definition.data.main_action.data.message.video_asset_id' | 'definition.data.main_action.data.status' | 'definition.data.main_action.id' | 'definition.data.main_action.links' | 'definition.data.main_action.links.next' | 'definition.data.main_action.temporary_id' | 'definition.data.main_action.type' | 'definition.data.message' | 'definition.data.message.action_buttons' | 'definition.data.message.add_info_link' | 'definition.data.message.add_opt_out_language' | 'definition.data.message.add_org_prefix' | 'definition.data.message.add_tracking_params' | 'definition.data.message.additional_filters' | 'definition.data.message.additional_filters.condition_groups' | 'definition.data.message.android_link' | 'definition.data.message.badge' | 'definition.data.message.badge_options' | 'definition.data.message.badge_options.badge_config' | 'definition.data.message.badge_options.set_from_property' | 'definition.data.message.badge_options.value' | 'definition.data.message.bcc_email' | 'definition.data.message.body' | 'definition.data.message.cc_email' | 'definition.data.message.conversion_metric_id' | 'definition.data.message.custom_tracking_params' | 'definition.data.message.dynamic_image' | 'definition.data.message.from_email' | 'definition.data.message.from_label' | 'definition.data.message.headers' | 'definition.data.message.id' | 'definition.data.message.image_id' | 'definition.data.message.include_contact_card' | 'definition.data.message.ios_link' | 'definition.data.message.kv_pairs' | 'definition.data.message.name' | 'definition.data.message.on_open' | 'definition.data.message.preview_text' | 'definition.data.message.push_type' | 'definition.data.message.reply_to_email' | 'definition.data.message.shorten_links' | 'definition.data.message.smart_sending_enabled' | 'definition.data.message.sms_quiet_hours_enabled' | 'definition.data.message.sound' | 'definition.data.message.subject_line' | 'definition.data.message.template_id' | 'definition.data.message.title' | 'definition.data.message.to_emails' | 'definition.data.message.transactional' | 'definition.data.message.url' | 'definition.data.message.vendor_id' | 'definition.data.message.video_asset_id' | 'definition.data.name' | 'definition.data.on_execution' | 'definition.data.profile_filter' | 'definition.data.profile_filter.condition_groups' | 'definition.data.profile_operations' | 'definition.data.secondary_value' | 'definition.data.service_configuration' | 'definition.data.service_configuration.event_key' | 'definition.data.service_configuration.event_payload' | 'definition.data.service_configuration.report_id' | 'definition.data.service_configuration.service_method_type' | 'definition.data.service_configuration.tracking_company_id' | 'definition.data.status' | 'definition.data.target_days' | 'definition.data.target_time' | 'definition.data.timezone' | 'definition.data.trigger_filter' | 'definition.data.trigger_filter.condition_groups' | 'definition.data.trigger_id' | 'definition.data.trigger_subtype' | 'definition.data.trigger_type' | 'definition.data.unit' | 'definition.data.value' | 'definition.id' | 'definition.links' | 'definition.links.next' | 'definition.links.next_if_false' | 'definition.links.next_if_true' | 'definition.temporary_id' | 'definition.type' | 'updated'>");
}
if (options.fieldsFlowMessage !== undefined) {
localVarQueryParameters['fields[flow-message]'] = ObjectSerializer.serialize(options.fieldsFlowMessage, "Array<'channel' | 'created' | 'definition' | 'definition.action_buttons' | 'definition.add_info_link' | 'definition.add_opt_out_language' | 'definition.add_org_prefix' | 'definition.add_tracking_params' | 'definition.additional_filters' | 'definition.additional_filters.condition_groups' | 'definition.android_link' | 'definition.badge' | 'definition.badge_options' | 'definition.badge_options.badge_config' | 'definition.badge_options.set_from_property' | 'definition.badge_options.value' | 'definition.bcc_email' | 'definition.body' | 'definition.cc_email' | 'definition.conversion_metric_id' | 'definition.custom_tracking_params' | 'definition.dynamic_image' | 'definition.from_email' | 'definition.from_label' | 'definition.headers' | 'definition.id' | 'definition.image_id' | 'definition.include_contact_card' | 'definition.ios_link' | 'definition.kv_pairs' | 'definition.name' | 'definition.on_open' | 'definition.preview_text' | 'definition.push_type' | 'definition.reply_to_email' | 'definition.shorten_links' | 'definition.smart_sending_enabled' | 'definition.sms_quiet_hours_enabled' | 'definition.sound' | 'definition.subject_line' | 'definition.template_id' | 'definition.title' | 'definition.to_emails' | 'definition.transactional' | 'definition.url' | 'definition.vendor_id' | 'definition.video_asset_id' | 'updated'>");
}
if (options.fieldsTemplate !== undefined) {
localVarQueryParameters['fields[template]'] = ObjectSerializer.serialize(options.fieldsTemplate, "Array<'amp' | 'created' | 'editor_type' | 'html' | 'name' | 'text' | 'updated'>");
}
if (options.include !== undefined) {
localVarQueryParameters['include'] = ObjectSerializer.serialize(options.include, "Array<'flow-action' | 'template'>");
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'GET',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body: GetFlowMessageEncodedResponseCompoundDocument; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
body = ObjectSerializer.deserialize(axiosResponse.data, "GetFlowMessageEncodedResponseCompoundDocument");
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
/**
* Get all flows in an account. Returns a maximum of 50 flows per request, which can be paginated with cursor-based pagination.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:read`
* @summary Get Flows
* @param fieldsFlowAction For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sparse-fieldsets* @param fieldsFlow 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>`id`: `any`<br>`name`: `contains`, `ends-with`, `equals`, `starts-with`<br>`status`: `equals`<br>`archived`: `equals`<br>`created`: `equals`, `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`<br>`updated`: `equals`, `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`<br>`trigger_type`: `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 pageSize Default: 50. Min: 1. Max: 50.* @param sort For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sorting
*/
public async getFlows (options: { fieldsFlowAction?: Array<'created' | 'definition' | 'definition.data' | 'definition.data.action_output_filter' | 'definition.data.action_output_filter.condition_groups' | 'definition.data.branches' | 'definition.data.current_experiment' | 'definition.data.current_experiment.allocations' | 'definition.data.current_experiment.automatic_winner_selection_settings' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_date' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_statistical_certainty' | 'definition.data.current_experiment.automatic_winner_selection_settings.enabled' | 'definition.data.current_experiment.id' | 'definition.data.current_experiment.name' | 'definition.data.current_experiment.started' | 'definition.data.current_experiment.variations' | 'definition.data.current_experiment.winner_metric' | 'definition.data.delay_until_time' | 'definition.data.delay_until_weekdays' | 'definition.data.experiment_status' | 'definition.data.list_id' | 'definition.data.main_action' | 'definition.data.main_action.data' | 'definition.data.main_action.data.message' | 'definition.data.main_action.data.message.action_buttons' | 'definition.data.main_action.data.message.add_info_link' | 'definition.data.main_action.data.message.add_opt_out_language' | 'definition.data.main_action.data.message.add_org_prefix' | 'definition.data.main_action.data.message.add_tracking_params' | 'definition.data.main_action.data.message.additional_filters' | 'definition.data.main_action.data.message.additional_filters.condition_groups' | 'definition.data.main_action.data.message.android_link' | 'definition.data.main_action.data.message.badge' | 'definition.data.main_action.data.message.badge_options' | 'definition.data.main_action.data.message.badge_options.badge_config' | 'definition.data.main_action.data.message.badge_options.set_from_property' | 'definition.data.main_action.data.message.badge_options.value' | 'definition.data.main_action.data.message.bcc_email' | 'definition.data.main_action.data.message.body' | 'definition.data.main_action.data.message.cc_email' | 'definition.data.main_action.data.message.conversion_metric_id' | 'definition.data.main_action.data.message.custom_tracking_params' | 'definition.data.main_action.data.message.dynamic_image' | 'definition.data.main_action.data.message.from_email' | 'definition.data.main_action.data.message.from_label' | 'definition.data.main_action.data.message.id' | 'definition.data.main_action.data.message.image_id' | 'definition.data.main_action.data.message.include_contact_card' | 'definition.data.main_action.data.message.ios_link' | 'definition.data.main_action.data.message.kv_pairs' | 'definition.data.main_action.data.message.name' | 'definition.data.main_action.data.message.on_open' | 'definition.data.main_action.data.message.preview_text' | 'definition.data.main_action.data.message.push_type' | 'definition.data.main_action.data.message.reply_to_email' | 'definition.data.main_action.data.message.shorten_links' | 'definition.data.main_action.data.message.smart_sending_enabled' | 'definition.data.main_action.data.message.sms_quiet_hours_enabled' | 'definition.data.main_action.data.message.sound' | 'definition.data.main_action.data.message.subject_line' | 'definition.data.main_action.data.message.template_id' | 'definition.data.main_action.data.message.title' | 'definition.data.main_action.data.message.transactional' | 'definition.data.main_action.data.message.video_asset_id' | 'definition.data.main_action.data.status' | 'definition.data.main_action.id' | 'definition.data.main_action.links' | 'definition.data.main_action.links.next' | 'definition.data.main_action.temporary_id' | 'definition.data.main_action.type' | 'definition.data.message' | 'definition.data.message.action_buttons' | 'definition.data.message.add_info_link' | 'definition.data.message.add_opt_out_language' | 'definition.data.message.add_org_prefix' | 'definition.data.message.add_tracking_params' | 'definition.data.message.additional_filters' | 'definition.data.message.additional_filters.condition_groups' | 'definition.data.message.android_link' | 'definition.data.message.badge' | 'definition.data.message.badge_options' | 'definition.data.message.badge_options.badge_config' | 'definition.data.message.badge_options.set_from_property' | 'definition.data.message.badge_options.value' | 'definition.data.message.bcc_email' | 'definition.data.message.body' | 'definition.data.message.cc_email' | 'definition.data.message.conversion_metric_id' | 'definition.data.message.custom_tracking_params' | 'definition.data.message.dynamic_image' | 'definition.data.message.from_email' | 'definition.data.message.from_label' | 'definition.data.message.headers' | 'definition.data.message.id' | 'definition.data.message.image_id' | 'definition.data.message.include_contact_card' | 'definition.data.message.ios_link' | 'definition.data.message.kv_pairs' | 'definition.data.message.name' | 'definition.data.message.on_open' | 'definition.data.message.preview_text' | 'definition.data.message.push_type' | 'definition.data.message.reply_to_email' | 'definition.data.message.shorten_links' | 'definition.data.message.smart_sending_enabled' | 'definition.data.message.sms_quiet_hours_enabled' | 'definition.data.message.sound' | 'definition.data.message.subject_line' | 'definition.data.message.template_id' | 'definition.data.message.title' | 'definition.data.message.to_emails' | 'definition.data.message.transactional' | 'definition.data.message.url' | 'definition.data.message.vendor_id' | 'definition.data.message.video_asset_id' | 'definition.data.name' | 'definition.data.on_execution' | 'definition.data.profile_filter' | 'definition.data.profile_filter.condition_groups' | 'definition.data.profile_operations' | 'definition.data.secondary_value' | 'definition.data.service_configuration' | 'definition.data.service_configuration.event_key' | 'definition.data.service_configuration.event_payload' | 'definition.data.service_configuration.report_id' | 'definition.data.service_configuration.service_method_type' | 'definition.data.service_configuration.tracking_company_id' | 'definition.data.status' | 'definition.data.target_days' | 'definition.data.target_time' | 'definition.data.timezone' | 'definition.data.trigger_filter' | 'definition.data.trigger_filter.condition_groups' | 'definition.data.trigger_id' | 'definition.data.trigger_subtype' | 'definition.data.trigger_type' | 'definition.data.unit' | 'definition.data.value' | 'definition.id' | 'definition.links' | 'definition.links.next' | 'definition.links.next_if_false' | 'definition.links.next_if_true' | 'definition.temporary_id' | 'definition.type' | 'updated'>, fieldsFlow?: Array<'archived' | 'created' | 'name' | 'status' | 'trigger_type' | 'updated'>, fieldsTag?: Array<'name'>, filter?: string, include?: Array<'flow-actions' | 'tags'>, pageCursor?: string, pageSize?: number, sort?: 'created' | '-created' | 'id' | '-id' | 'name' | '-name' | 'status' | '-status' | 'trigger_type' | '-trigger_type' | 'updated' | '-updated', } = {}): Promise<{ response: AxiosResponse; body: GetFlowResponseCollectionCompoundDocument; }> {
const localVarPath = this.basePath + '/api/flows';
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
if (options.fieldsFlowAction !== undefined) {
localVarQueryParameters['fields[flow-action]'] = ObjectSerializer.serialize(options.fieldsFlowAction, "Array<'created' | 'definition' | 'definition.data' | 'definition.data.action_output_filter' | 'definition.data.action_output_filter.condition_groups' | 'definition.data.branches' | 'definition.data.current_experiment' | 'definition.data.current_experiment.allocations' | 'definition.data.current_experiment.automatic_winner_selection_settings' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_date' | 'definition.data.current_experiment.automatic_winner_selection_settings.automatic_end_statistical_certainty' | 'definition.data.current_experiment.automatic_winner_selection_settings.enabled' | 'definition.data.current_experiment.id' | 'definition.data.current_experiment.name' | 'definition.data.current_experiment.started' | 'definition.data.current_experiment.variations' | 'definition.data.current_experiment.winner_metric' | 'definition.data.delay_until_time' | 'definition.data.delay_until_weekdays' | 'definition.data.experiment_status' | 'definition.data.list_id' | 'definition.data.main_action' | 'definition.data.main_action.data' | 'definition.data.main_action.data.message' | 'definition.data.main_action.data.message.action_buttons' | 'definition.data.main_action.data.message.add_info_link' | 'definition.data.main_action.data.message.add_opt_out_language' | 'definition.data.main_action.data.message.add_org_prefix' | 'definition.data.main_action.data.message.add_tracking_params' | 'definition.data.main_action.data.message.additional_filters' | 'definition.data.main_action.data.message.additional_filters.condition_groups' | 'definition.data.main_action.data.message.android_link' | 'definition.data.main_action.data.message.badge' | 'definition.data.main_action.data.message.badge_options' | 'definition.data.main_action.data.message.badge_options.badge_config' | 'definition.data.main_action.data.message.badge_options.set_from_property' | 'definition.data.main_action.data.message.badge_options.value' | 'definition.data.main_action.data.message.bcc_email' | 'definition.data.main_action.data.message.body' | 'definition.data.main_action.data.message.cc_email' | 'definition.data.main_action.data.message.conversion_metric_id' | 'definition.data.main_action.data.message.custom_tracking_params' | 'definition.data.main_action.data.message.dynamic_image' | 'definition.data.main_action.data.message.from_email' | 'definition.data.main_action.data.message.from_label' | 'definition.data.main_action.data.message.id' | 'definition.data.main_action.data.message.image_id' | 'definition.data.main_action.data.message.include_contact_card' | 'definition.data.main_action.data.message.ios_link' | 'definition.data.main_action.data.message.kv_pairs' | 'definition.data.main_action.data.message.name' | 'definition.data.main_action.data.message.on_open' | 'definition.data.main_action.data.message.preview_text' | 'definition.data.main_action.data.message.push_type' | 'definition.data.main_action.data.message.reply_to_email' | 'definition.data.main_action.data.message.shorten_links' | 'definition.data.main_action.data.message.smart_sending_enabled' | 'definition.data.main_action.data.message.sms_quiet_hours_enabled' | 'definition.data.main_action.data.message.sound' | 'definition.data.main_action.data.message.subject_line' | 'definition.data.main_action.data.message.template_id' | 'definition.data.main_action.data.message.title' | 'definition.data.main_action.data.message.transactional' | 'definition.data.main_action.data.message.video_asset_id' | 'definition.data.main_action.data.status' | 'definition.data.main_action.id' | 'definition.data.main_action.links' | 'definition.data.main_action.links.next' | 'definition.data.main_action.temporary_id' | 'definition.data.main_action.type' | 'definition.data.message' | 'definition.data.message.action_buttons' | 'definition.data.message.add_info_link' | 'definition.data.message.add_opt_out_language' | 'definition.data.message.add_org_prefix' | 'definition.data.message.add_tracking_params' | 'definition.data.message.additional_filters' | 'definition.data.message.additional_filters.condition_groups' | 'definition.data.message.android_link' | 'definition.data.message.badge' | 'definition.data.message.badge_options' | 'definition.data.message.badge_options.badge_config' | 'definition.data.message.badge_options.set_from_property' | 'definition.data.message.badge_options.value' | 'definition.data.message.bcc_email' | 'definition.data.message.body' | 'definition.data.message.cc_email' | 'definition.data.message.conversion_metric_id' | 'definition.data.message.custom_tracking_params' | 'definition.data.message.dynamic_image' | 'definition.data.message.from_email' | 'definition.data.message.from_label' | 'definition.data.message.headers' | 'definition.data.message.id' | 'definition.data.message.image_id' | 'definition.data.message.include_contact_card' | 'definition.data.message.ios_link' | 'definition.data.message.kv_pairs' | 'definition.data.message.name' | 'definition.data.message.on_open' | 'definition.data.message.preview_text' | 'definition.data.message.push_type' | 'definition.data.message.reply_to_email' | 'definition.data.message.shorten_links' | 'definition.data.message.smart_sending_enabled' | 'definition.data.message.sms_quiet_hours_enabled' | 'definition.data.message.sound' | 'definition.data.message.subject_line' | 'definition.data.message.template_id' | 'definition.data.message.title' | 'definition.data.message.to_emails' | 'definition.data.message.transactional' | 'definition.data.message.url' | 'definition.data.message.vendor_id' | 'definition.data.message.video_asset_id' | 'definition.data.name' | 'definition.data.on_execution' | 'definition.data.profile_filter' | 'definition.data.profile_filter.condition_groups' | 'definition.data.profile_operations' | 'definition.data.secondary_value' | 'definition.data.service_configuration' | 'definition.data.service_configuration.event_key' | 'definition.data.service_configuration.event_payload' | 'definition.data.service_configuration.report_id' | 'definition.data.service_configuration.service_method_type' | 'definition.data.service_configuration.tracking_company_id' | 'definition.data.status' | 'definition.data.target_days' | 'definition.data.target_time' | 'definition.data.timezone' | 'definition.data.trigger_filter' | 'definition.data.trigger_filter.condition_groups' | 'definition.data.trigger_id' | 'definition.data.trigger_subtype' | 'definition.data.trigger_type' | 'definition.data.unit' | 'definition.data.value' | 'definition.id' | 'definition.links' | 'definition.links.next' | 'definition.links.next_if_false' | 'definition.links.next_if_true' | 'definition.temporary_id' | 'definition.type' | 'updated'>");
}
if (options.fieldsFlow !== undefined) {
localVarQueryParameters['fields[flow]'] = ObjectSerializer.serialize(options.fieldsFlow, "Array<'archived' | 'created' | 'name' | 'status' | 'trigger_type' | 'updated'>");
}
if (options.fieldsTag !== undefined) {
localVarQueryParameters['fields[tag]'] = ObjectSerializer.serialize(options.fieldsTag, "Array<'name'>");
}
if (options.filter !== undefined) {
localVarQueryParameters['filter'] = ObjectSerializer.serialize(options.filter, "string");
}
if (options.include !== undefined) {
localVarQueryParameters['include'] = ObjectSerializer.serialize(options.include, "Array<'flow-actions' | 'tags'>");
}
if (options.pageCursor !== undefined) {
localVarQueryParameters['page[cursor]'] = ObjectSerializer.serialize(options.pageCursor, "string");
}
if (options.pageSize !== undefined) {
localVarQueryParameters['page[size]'] = ObjectSerializer.serialize(options.pageSize, "number");
}
if (options.sort !== undefined) {
localVarQueryParameters['sort'] = ObjectSerializer.serialize(options.sort, "'created' | '-created' | 'id' | '-id' | 'name' | '-name' | 'status' | '-status' | 'trigger_type' | '-trigger_type' | 'updated' | '-updated'");
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'GET',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body: GetFlowResponseCollectionCompoundDocument; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
body = ObjectSerializer.deserialize(axiosResponse.data, "GetFlowResponseCollectionCompoundDocument");
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
/**
* Get all relationships for flow messages associated with the given flow action ID. Returns a maximum of 50 flow message relationships per request, which can be paginated with cursor-based pagination.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:read`
* @summary Get Message IDs for Flow Action
* @param id
* @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`: `contains`, `ends-with`, `equals`, `starts-with`<br>`created`: `equals`, `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`<br>`updated`: `equals`, `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: 50. Min: 1. Max: 50.* @param sort For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sorting
*/
public async getMessageIdsForFlowAction (id: string, options: { filter?: string, pageCursor?: string, pageSize?: number, sort?: 'created' | '-created' | 'id' | '-id' | 'name' | '-name' | 'updated' | '-updated', } = {}): Promise<{ response: AxiosResponse; body: GetFlowActionFlowMessageRelationshipResponseCollection; }> {
const localVarPath = this.basePath + '/api/flow-actions/{id}/relationships/flow-messages'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getMessageIdsForFlowAction.');
}
if (options.filter !== undefined) {
localVarQueryParameters['filter'] = ObjectSerializer.serialize(options.filter, "string");
}
if (options.pageCursor !== undefined) {
localVarQueryParameters['page[cursor]'] = ObjectSerializer.serialize(options.pageCursor, "string");
}
if (options.pageSize !== undefined) {
localVarQueryParameters['page[size]'] = ObjectSerializer.serialize(options.pageSize, "number");
}
if (options.sort !== undefined) {
localVarQueryParameters['sort'] = ObjectSerializer.serialize(options.sort, "'created' | '-created' | 'id' | '-id' | 'name' | '-name' | 'updated' | '-updated'");
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'GET',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body: GetFlowActionFlowMessageRelationshipResponseCollection; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
body = ObjectSerializer.deserialize(axiosResponse.data, "GetFlowActionFlowMessageRelationshipResponseCollection");
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
/**
* Return the tag IDs of all tags associated with the given flow.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:read` `tags:read`
* @summary Get Tag IDs for Flow
* @param id
*/
public async getTagIdsForFlow (id: string, ): Promise<{ response: AxiosResponse; body: GetFlowTagsRelationshipsResponseCollection; }> {
const localVarPath = this.basePath + '/api/flows/{id}/relationships/tags'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getTagIdsForFlow.');
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'GET',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body: GetFlowTagsRelationshipsResponseCollection; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
body = ObjectSerializer.deserialize(axiosResponse.data, "GetFlowTagsRelationshipsResponseCollection");
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
/**
* Return all tags associated with the given flow ID.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:read` `tags:read`
* @summary Get Tags for Flow
* @param id
* @param fieldsTag For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sparse-fieldsets
*/
public async getTagsForFlow (id: string, options: { fieldsTag?: Array<'name'>, } = {}): Promise<{ response: AxiosResponse; body: GetTagResponseCollection; }> {
const localVarPath = this.basePath + '/api/flows/{id}/tags'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getTagsForFlow.');
}
if (options.fieldsTag !== undefined) {
localVarQueryParameters['fields[tag]'] = ObjectSerializer.serialize(options.fieldsTag, "Array<'name'>");
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'GET',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body: GetTagResponseCollection; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
body = ObjectSerializer.deserialize(axiosResponse.data, "GetTagResponseCollection");
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
/**
* Return the related template
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `templates:read`
* @summary Get Template for Flow Message
* @param id
* @param fieldsTemplate For more information please visit https://developers.klaviyo.com/en/v2026-04-15/reference/api-overview#sparse-fieldsets
*/
public async getTemplateForFlowMessage (id: string, options: { fieldsTemplate?: Array<'amp' | 'created' | 'editor_type' | 'html' | 'name' | 'text' | 'updated'>, } = {}): Promise<{ response: AxiosResponse; body: GetTemplateResponse; }> {
const localVarPath = this.basePath + '/api/flow-messages/{id}/template'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getTemplateForFlowMessage.');
}
if (options.fieldsTemplate !== undefined) {
localVarQueryParameters['fields[template]'] = ObjectSerializer.serialize(options.fieldsTemplate, "Array<'amp' | 'created' | 'editor_type' | 'html' | 'name' | 'text' | 'updated'>");
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'GET',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body: GetTemplateResponse; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
body = ObjectSerializer.deserialize(axiosResponse.data, "GetTemplateResponse");
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
/**
* Returns the ID of the related template
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `templates:read`
* @summary Get Template ID for Flow Message
* @param id
*/
public async getTemplateIdForFlowMessage (id: string, ): Promise<{ response: AxiosResponse; body: GetFlowMessageTemplateRelationshipResponse; }> {
const localVarPath = this.basePath + '/api/flow-messages/{id}/relationships/template'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getTemplateIdForFlowMessage.');
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'GET',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body: GetFlowMessageTemplateRelationshipResponse; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
body = ObjectSerializer.deserialize(axiosResponse.data, "GetFlowMessageTemplateRelationshipResponse");
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
/**
* Update the status of a flow with the given flow ID, and all actions in that flow.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:write`
* @summary Update Flow Status
* @param id ID of the Flow to update. Ex: XVTP5Q* @param flowUpdateQuery
*/
public async updateFlow (id: string, flowUpdateQuery: FlowUpdateQuery, ): Promise<{ response: AxiosResponse; body: PatchFlowResponse; }> {
const localVarPath = this.basePath + '/api/flows/{id}'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling updateFlow.');
}
// verify required parameter 'flowUpdateQuery' is not null or undefined
if (flowUpdateQuery === null || flowUpdateQuery === undefined) {
throw new Error('Required parameter flowUpdateQuery was null or undefined when calling updateFlow.');
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'PATCH',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
data: ObjectSerializer.serialize(flowUpdateQuery, "FlowUpdateQuery")
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body: PatchFlowResponse; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
body = ObjectSerializer.deserialize(axiosResponse.data, "PatchFlowResponse");
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
/**
* Update a flow action.
*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `flows:write`
* @summary Update Flow Action
* @param id * @param flowActionUpdateQuery
*/
public async updateFlowAction (id: string, flowActionUpdateQuery: FlowActionUpdateQuery, ): Promise<{ response: AxiosResponse; body: PatchFlowActionEncodedResponse; }> {
const localVarPath = this.basePath + '/api/flow-actions/{id}'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders);
const produces = ['application/vnd.api+json'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling updateFlowAction.');
}
// verify required parameter 'flowActionUpdateQuery' is not null or undefined
if (flowActionUpdateQuery === null || flowActionUpdateQuery === undefined) {
throw new Error('Required parameter flowActionUpdateQuery was null or undefined when calling updateFlowAction.');
}
queryParamPreProcessor(localVarQueryParameters)
let config: AxiosRequestConfig = {
method: 'PATCH',
url: localVarPath,
headers: localVarHeaderParams,
params: localVarQueryParameters,
data: ObjectSerializer.serialize(flowActionUpdateQuery, "FlowActionUpdateQuery")
}
await this.session.applyToRequest(config)
const request = async (config: AxiosRequestConfig, retried = false): Promise<{ response: AxiosResponse; body: PatchFlowActionEncodedResponse; }> => {
try {
const axiosResponse = await this.session.requestWithRetry(config)
let body;
body = ObjectSerializer.deserialize(axiosResponse.data, "PatchFlowActionEncodedResponse");
return ({response: axiosResponse, body: body});
} catch (error) {
if (await this.session.refreshAndRetry(error, retried)) {
await this.session.applyToRequest(config)
return request(config, true)
}
throw error
}
}
return request(config)
}
}
export interface FlowsApi {
/**
* Alias of {@link FlowsApi.getActionForFlowMessage}
*
* @deprecated Use {@link FlowsApi.getActionForFlowMessage} instead
*/
getFlowMessageAction: typeof FlowsApi.prototype.getActionForFlowMessage;
}
FlowsApi.prototype.getFlowMessageAction = FlowsApi.prototype.getActionForFlowMessage
export interface FlowsApi {
/**
* Alias of {@link FlowsApi.getActionIdForFlowMessage}
*
* @deprecated Use {@link FlowsApi.getActionIdForFlowMessage} instead
*/
getFlowMessageRelationshipsAction: typeof FlowsApi.prototype.getActionIdForFlowMessage;
}
FlowsApi.prototype.getFlowMessageRelationshipsAction = FlowsApi.prototype.getActionIdForFlowMessage
export interface FlowsApi {
/**
* Alias of {@link FlowsApi.getActionIdsForFlow}
*
* @deprecated Use {@link FlowsApi.getActionIdsForFlow} instead
*/
getFlowRelationshipsFlowActions: typeof FlowsApi.prototype.getActionIdsForFlow;
}
FlowsApi.prototype.getFlowRelationshipsFlowActions = FlowsApi.prototype.getActionIdsForFlow
export interface FlowsApi {
/**
* Alias of {@link FlowsApi.getActionIdsForFlow}
*
* @deprecated Use {@link FlowsApi.getActionIdsForFlow} instead
*/
getFlowRelationshipsActions: typeof FlowsApi.prototype.getActionIdsForFlow;
}
FlowsApi.prototype.getFlowRelationshipsActions = FlowsApi.prototype.getActionIdsForFlow
export interface FlowsApi {
/**
* Alias of {@link FlowsApi.getActionsForFlow}
*
* @deprecated Use {@link FlowsApi.getActionsForFlow} instead
*/
getFlowFlowActions: typeof FlowsApi.prototype.getActionsForFlow;
}
FlowsApi.prototype.getFlowFlowActions = FlowsApi.prototype.getActionsForFlow
export interface FlowsApi {
/**
* Alias of {@link FlowsApi.getActionsForFlow}
*
* @deprecated Use {@link FlowsApi.getActionsForFlow} instead
*/
getFlowActions: typeof FlowsApi.prototype.getActionsForFlow;
}
FlowsApi.prototype.getFlowActions = FlowsApi.prototype.getActionsForFlow
export interface FlowsApi {
/**
* Alias of {@link FlowsApi.getFlowActionMessages}
*
* @deprecated Use {@link FlowsApi.getFlowActionMessages} instead
*/
getMessagesForFlowAction: typeof FlowsApi.prototype.getFlowActionMessages;
}
FlowsApi.prototype.getMessagesForFlowAction = FlowsApi.prototype.getFlowActionMessages
export interface FlowsApi {
/**
* Alias of {@link FlowsApi.getFlowForFlowAction}
*
* @deprecated Use {@link FlowsApi.getFlowForFlowAction} instead
*/
getFlowActionFlow: typeof FlowsApi.prototype.getFlowForFlowAction;
}
FlowsApi.prototype.getFlowActionFlow = FlowsApi.prototype.getFlowForFlowAction
export interface FlowsApi {
/**
* Alias of {@link FlowsApi.getFlowIdForFlowAction}
*
* @deprecated Use {@link FlowsApi.getFlowIdForFlowAction} instead
*/
getFlowActionRelationshipsFlow: typeof FlowsApi.prototype.getFlowIdForFlowAction;
}
FlowsApi.prototype.getFlowActionRelationshipsFlow = FlowsApi.prototype.getFlowIdForFlowAction
export interface FlowsApi {
/**
* Alias of {@link FlowsApi.getMessageIdsForFlowAction}
*
* @deprecated Use {@link FlowsApi.getMessageIdsForFlowAction} instead
*/
getFlowActionRelationshipsMessages: typeof FlowsApi.prototype.getMessageIdsForFlowAction;
}
FlowsApi.prototype.getFlowActionRelationshipsMessages = FlowsApi.prototype.getMessageIdsForFlowAction
export interface FlowsApi {
/**
* Alias of {@link FlowsApi.getTagIdsForFlow}
*
* @deprecated Use {@link FlowsApi.getTagIdsForFlow} instead
*/
getFlowRelationshipsTags: typeof FlowsApi.prototype.getTagIdsForFlow;
}
FlowsApi.prototype.getFlowRelationshipsTags = FlowsApi.prototype.getTagIdsForFlow
export interface FlowsApi {
/**
* Alias of {@link FlowsApi.getTagsForFlow}
*
* @deprecated Use {@link FlowsApi.getTagsForFlow} instead
*/
getFlowTags: typeof FlowsApi.prototype.getTagsForFlow;
}
FlowsApi.prototype.getFlowTags = FlowsApi.prototype.getTagsForFlow
export interface FlowsApi {
/**
* Alias of {@link FlowsApi.getTemplateForFlowMessage}
*
* @deprecated Use {@link FlowsApi.getTemplateForFlowMessage} instead
*/
getFlowMessageTemplate: typeof FlowsApi.prototype.getTemplateForFlowMessage;
}
FlowsApi.prototype.getFlowMessageTemplate = FlowsApi.prototype.getTemplateForFlowMessage
export interface FlowsApi {
/**
* Alias of {@link FlowsApi.getTemplateIdForFlowMessage}
*
* @deprecated Use {@link FlowsApi.getTemplateIdForFlowMessage} instead
*/
getFlowMessageRelationshipsTemplate: typeof FlowsApi.prototype.getTemplateIdForFlowMessage;
}
FlowsApi.prototype.getFlowMessageRelationshipsTemplate = FlowsApi.prototype.getTemplateIdForFlowMessage