customerio-node
Version:
A node client for the Customer.io event API. http://customer.io
2,047 lines • 95.6 kB
TypeScript
import type { BearerAuth, RequestData, RequestDefaults, RetryOptions } from './request';
import Request from './request';
import { Region } from './regions';
import { SendEmailRequest, SendPushRequest, SendSMSRequest, SendWhatsAppRequest, SendInboxMessageRequest, SendInAppRequest } from './api/requests';
import type { Filter, ObjectFilter } from './types';
import { IdentifierType } from './types';
/** Which identifier kind the values in an object endpoint refer to. */
export type ObjectIdType = 'object_id' | 'cio_object_id';
/** Cursor pagination shared by most App API list endpoints. */
export type PaginationOptions = {
/** Pagination cursor returned as `next` by a previous page. */
start?: string;
/** Maximum number of results to return in the page. */
limit?: number;
};
/** Options for {@link APIClient.getCustomerActivities}. */
export type CustomerActivitiesOptions = PaginationOptions & {
/** Which identifier kind `customerId` is. Defaults to the API's default (`id`). */
idType?: IdentifierType;
/** Filter to a single activity type (e.g. `attribute_change`, `event`). */
type?: string;
/** Filter to activities with this name (e.g. the event name). */
name?: string;
};
/** Options for {@link APIClient.getCustomerMessages}. */
export type CustomerMessagesOptions = PaginationOptions & {
idType?: IdentifierType;
/** Only include messages after this Unix timestamp (seconds). */
start_ts?: number;
/** Only include messages before this Unix timestamp (seconds). */
end_ts?: number;
};
/** Options for {@link APIClient.getCustomerSubscriptionPreferences}. */
export type CustomerSubscriptionPreferencesOptions = {
idType?: IdentifierType;
/** IETF language tag used to localize topic names in the response. */
language?: string;
};
/** Options for {@link APIClient.getObjectRelationships}. */
export type ObjectRelationshipsOptions = PaginationOptions & {
/** Which identifier kind `objectId` is. Defaults to the API's default (`object_id`). */
idType?: ObjectIdType;
};
/** Options for {@link APIClient.listActivities}. */
export type ListActivitiesOptions = PaginationOptions & {
/** Filter to a single activity type. */
type?: string;
/** Filter to activities with this name. */
name?: string;
/** Include activities from deleted people. */
deleted?: boolean;
/** Scope to a single person's activities. */
customerId?: string | number;
/** Which identifier kind `customerId` is. */
idType?: IdentifierType;
};
/** The definition for a new manual segment created via {@link APIClient.createSegment}. */
export type SegmentInput = {
/** The segment's display name. */
name: string;
/** An optional description. */
description?: string;
};
/** Time unit for metric reports. */
export type MetricsPeriod = 'hours' | 'days' | 'weeks' | 'months';
/** Options for {@link APIClient.getTransactionalMessageMetrics}. */
export type TransactionalMetricsOptions = {
/** The time unit each step represents. */
period?: MetricsPeriod;
/** The number of periods to report over. */
steps?: number;
};
/** Options for {@link APIClient.getTransactionalMessageLinkMetrics}. */
export type TransactionalLinkMetricsOptions = TransactionalMetricsOptions & {
/** When `true`, count unique clicks per link rather than total clicks. */
unique?: boolean;
};
/** Options for {@link APIClient.getTransactionalMessageDeliveries}. */
export type TransactionalDeliveriesOptions = PaginationOptions & {
/** Filter to deliveries with this metric (e.g. `delivered`, `opened`, `bounced`). */
metric?: string;
/** Only include deliveries after this Unix timestamp (seconds). */
start_ts?: number;
/** Only include deliveries before this Unix timestamp (seconds). */
end_ts?: number;
/** When `true`, include tracked responses (reply/click data) on each delivery. */
get_tracked_responses?: boolean;
};
/** Message channel a metric/message query can be scoped to. */
export type MetricType = 'email' | 'webhook' | 'twilio' | 'whatsapp' | 'slack' | 'push' | 'in_app';
/** Resolution (bucket size) for time-series metric reports. */
export type MetricResolution = 'hours' | 'hourly' | 'days' | 'daily' | 'weeks' | 'weekly' | 'months' | 'monthly';
/** Metrics API version for campaign metric reports. */
export type CampaignMetricsVersion = '1' | '2';
/** Reporting window shared by all metric reports. */
export type MetricsWindowOptions = {
/** The time unit each step represents. */
period?: MetricsPeriod;
/** The number of periods to report over. */
steps?: number;
};
/** Options for channel-scoped metric reports (e.g. broadcast/campaign resource metrics). */
export type MetricsOptions = MetricsWindowOptions & {
/** Scope the report to a single channel. */
type?: MetricType;
};
/** Options for link (click) metric reports. */
export type LinkMetricsOptions = MetricsWindowOptions & {
/** When `true`, count unique clicks per link rather than total clicks. */
unique?: boolean;
};
/** Options for campaign resource metric reports. */
export type CampaignMetricsOptions = MetricsWindowOptions & {
/** Metrics API version (`"1"` or `"2"`). Optional; the API defaults it. */
version?: CampaignMetricsVersion;
/** Scope the report to a single channel. */
type?: MetricType;
/** Resolution (bucket size) of the report. */
res?: MetricResolution;
/** IANA timezone for bucket boundaries (e.g. `America/New_York`). */
tz?: string;
/** Inclusive start of the window, as a Unix timestamp (seconds). */
start?: number;
/** Inclusive end of the window, as a Unix timestamp (seconds). */
end?: number;
};
/**
* Options for campaign action metric reports. Like {@link CampaignMetricsOptions}
* but without `type` — action metrics are always aggregated across all channels.
*/
export type CampaignActionMetricsOptions = MetricsWindowOptions & {
/** Metrics API version (`"1"` or `"2"`). Optional; the API defaults it. */
version?: CampaignMetricsVersion;
/** Resolution (bucket size) of the report. */
res?: MetricResolution;
/** IANA timezone for bucket boundaries (e.g. `America/New_York`). */
tz?: string;
/** Inclusive start of the window, as a Unix timestamp (seconds). */
start?: number;
/** Inclusive end of the window, as a Unix timestamp (seconds). */
end?: number;
};
/** Required options for {@link APIClient.getCampaignJourneyMetrics}. */
export type JourneyMetricsOptions = {
/** Inclusive start of the window, as a Unix timestamp (seconds). */
start: number;
/** Inclusive end of the window, as a Unix timestamp (seconds). */
end: number;
/** Resolution (bucket size) of the report. */
res: MetricResolution;
};
/** Options for {@link APIClient.getCampaignMessages}. */
export type CampaignMessagesOptions = PaginationOptions & {
/** Scope to a single channel. */
type?: MetricType;
/** Filter to deliveries with this metric (e.g. `delivered`, `opened`, `bounced`). */
metric?: string;
/** Include drafted (unsent) messages. */
drafts?: boolean;
/** Only include deliveries after this Unix timestamp (seconds). */
start_ts?: number;
/** Only include deliveries before this Unix timestamp (seconds). */
end_ts?: number;
/** When `true`, include tracked responses on each delivery. */
get_tracked_responses?: boolean;
};
/** Options for {@link APIClient.getBroadcastMessages}. */
export type BroadcastMessagesOptions = PaginationOptions & {
/** Filter to deliveries with this metric (e.g. `delivered`, `opened`, `bounced`). */
metric?: string;
/** Scope to a single channel. */
type?: MetricType;
/** Only include deliveries after this Unix timestamp (seconds). */
start_ts?: number;
/** Only include deliveries before this Unix timestamp (seconds). */
end_ts?: number;
/** When `true`, include tracked responses on each delivery. */
get_tracked_responses?: boolean;
};
/** Sort direction for list endpoints that support it. */
export type SortDirection = 'asc' | 'desc';
/** Options for {@link APIClient.listNewsletters}. */
export type ListNewslettersOptions = PaginationOptions & {
/** Sort order by creation time. */
sort?: SortDirection;
};
/**
* Message channel a newsletter can be scoped to. Newsletters support a slightly
* different channel set than campaigns/broadcasts (notably `inbox`, and no
* `whatsapp`/`slack`).
*/
export type NewsletterChannelType = 'email' | 'webhook' | 'twilio' | 'push' | 'in_app' | 'inbox';
/**
* Options for newsletter metric reports (newsletter + content level).
*
* Note: newsletter metrics are always aggregated across all channels — the API
* does not accept a channel `type` filter here (unlike campaigns/broadcasts).
*/
export type NewsletterMetricsOptions = {
period?: MetricsPeriod;
steps?: number;
};
/** Options for {@link APIClient.getNewsletterMessages}. */
export type NewsletterMessagesOptions = PaginationOptions & {
/** Filter to deliveries with this metric (e.g. `delivered`, `opened`, `bounced`). */
metric?: string;
/** Scope to a single channel. */
type?: NewsletterChannelType;
/** Only include deliveries after this Unix timestamp (seconds). */
start_ts?: number;
/** Only include deliveries before this Unix timestamp (seconds). */
end_ts?: number;
/** When `true`, include tracked responses on each delivery. */
get_tracked_responses?: boolean;
};
/** Sort field for Design Studio list endpoints. */
export type DesignStudioSortBy = 'created' | 'updated' | 'name';
/** Filters, sorting, and pagination shared by the Design Studio list endpoints (page-based, not cursor-based). */
export type DesignStudioListOptions = {
/** Only list nodes directly within this folder (omit for the root). */
parentFolderId?: string;
/** When `true`, return only direct children rather than the whole subtree. */
directDescendantsOnly?: boolean;
/** Field to sort by. Defaults to `created`. */
sortBy?: DesignStudioSortBy;
/** Sort direction. Defaults to `asc`. */
sortOrder?: SortDirection;
/** Only nodes created before this Unix timestamp (seconds). */
createdBefore?: number;
/** Only nodes created after this Unix timestamp (seconds). */
createdAfter?: number;
/** Only nodes updated before this Unix timestamp (seconds). */
updatedBefore?: number;
/** Only nodes updated after this Unix timestamp (seconds). */
updatedAfter?: number;
/** 1-based page number. Defaults to 1. */
page?: number;
/** Page size, 1–10000. Defaults to 1000. */
limit?: number;
};
/** Tri-state filter for {@link ListDesignStudioEmailsOptions}: `'true'`/`'false'` to filter, or `'any'` for no filter. */
export type DesignStudioEmailFilter = 'true' | 'false' | 'any';
/** Options for {@link APIClient.listDesignStudioEmails}. */
export type ListDesignStudioEmailsOptions = DesignStudioListOptions & {
/** Filter by the template flag, or `'any'`. */
isTemplate?: DesignStudioEmailFilter;
/** Filter by the presence of translations, or `'any'`. */
hasTranslations?: DesignStudioEmailFilter;
/** Filter by linked-to-a-message status, or `'any'`. */
isLinked?: DesignStudioEmailFilter;
};
/** The `content` block of a Design Studio email. */
export type DesignStudioEmailContent = {
subject?: string;
preheader_text?: string;
html?: string;
amp?: string;
text?: string;
};
/** The `envelope` block of a Design Studio email. */
export type DesignStudioEmailEnvelope = {
from_id?: number;
reply_to_id?: number;
recipient?: string;
bcc?: string;
fake_bcc?: boolean;
cc?: string;
headers?: Array<Record<string, any>>;
};
/** Definition for creating a Design Studio email via {@link APIClient.createDesignStudioEmail}. */
export type DesignStudioEmailInput = {
/** The email's display name (required). */
name: string;
/** Parent folder UUID. Omit or pass `null` for the root. */
parent_folder_id?: string | null;
/** Whether the email is a reusable template. */
is_template?: boolean;
content?: DesignStudioEmailContent;
envelope?: DesignStudioEmailEnvelope;
/** Content transformers (e.g. `url_parameters`, `css_inliner`, `accessibility`). */
transformers?: Record<string, any>;
};
/**
* Fields for updating a Design Studio email via {@link APIClient.updateDesignStudioEmail}.
* At least one must be provided. `parent_folder_id` is tri-state: omit to keep the current
* parent, `null` to move to the root, or a UUID to move into that folder.
*/
export type DesignStudioEmailUpdate = {
name?: string;
parent_folder_id?: string | null;
is_template?: boolean;
content?: DesignStudioEmailContent;
envelope?: DesignStudioEmailEnvelope;
transformers?: Record<string, any>;
};
/** Definition for creating a Design Studio folder via {@link APIClient.createDesignStudioFolder}. */
export type DesignStudioFolderInput = {
/** The folder's display name (required). */
name: string;
/** Parent folder UUID. Omit or pass `null` for the root. */
parent_folder_id?: string | null;
};
/**
* Fields for updating a Design Studio folder via {@link APIClient.updateDesignStudioFolder}.
* At least one must be provided. `parent_folder_id` is tri-state: omit to keep the current
* parent, `null` to move to the root, or a UUID to move into that folder.
*/
export type DesignStudioFolderUpdate = {
name?: string;
parent_folder_id?: string | null;
};
/** Definition for creating a Design Studio email translation via {@link APIClient.createDesignStudioEmailLanguage}. */
export type DesignStudioEmailTranslationInput = {
/** IETF language tag for the translation (required). */
language: string;
/** Content overrides. Omitted blocks are inherited from the default-language email. */
content?: DesignStudioEmailContent;
envelope?: DesignStudioEmailEnvelope;
transformers?: Record<string, any>;
};
/**
* Fields for updating a Design Studio email translation via {@link APIClient.updateDesignStudioEmailLanguage}.
* At least one must be provided. The language itself is immutable (taken from the path).
*/
export type DesignStudioEmailTranslationUpdate = {
content?: DesignStudioEmailContent;
envelope?: DesignStudioEmailEnvelope;
transformers?: Record<string, any>;
};
/** Options for {@link APIClient.listDesignStudioComponents}. */
export type ListDesignStudioComponentsOptions = DesignStudioListOptions & {
/** Only list components with this tag. */
tag?: string;
};
/** Definition for creating a Design Studio component via {@link APIClient.createDesignStudioComponent}. */
export type DesignStudioComponentInput = {
/** The component's display name (required). */
name: string;
/** The component's tag — unique per workspace (required). */
tag: string;
/** Parent folder UUID. Omit or pass `null` for the root. */
parent_folder_id?: string | null;
/** The component's HTML content. */
content?: string;
};
/**
* Fields for updating a Design Studio component via {@link APIClient.updateDesignStudioComponent}.
* At least one must be provided. `parent_folder_id` is tri-state: omit to keep the current parent,
* `null` to move to the root, or a UUID to move into that folder.
*/
export type DesignStudioComponentUpdate = {
name?: string;
tag?: string;
parent_folder_id?: string | null;
content?: string;
};
/** Filters and pagination shared by the asset list endpoints (page-based). */
export type AssetListOptions = {
/** Only list assets directly within this folder id (omit for all/root). */
parentFolderId?: number;
/** When `true`, return only direct children rather than the whole subtree. */
directDescendantsOnly?: boolean;
/** 1-based page number. Defaults to 1. */
page?: number;
/** Page size, 1–10000. Defaults to 1000. */
limit?: number;
};
/**
* Definition for uploading a file via {@link APIClient.createAsset}.
*
* The API accepts images (`image/bmp`, `image/jpeg`, `image/jpg`, `image/png`,
* `image/gif`) and `application/pdf`, up to 2 MB (images max 4096px per side).
*/
export type CreateAssetInput = {
/** File contents. A `Uint8Array` (a `Buffer`, e.g. from `fs.readFileSync`, is one), `ArrayBuffer`, `Blob`, or `string`. */
data: Uint8Array | ArrayBuffer | Blob | string;
/** Filename — also the multipart filename, the default asset `name`, and (when `contentType` is omitted) the source for the derived content type. */
filename: string;
/**
* MIME type of the upload. When omitted, the SDK derives it from the `filename` extension
* for the accepted image/PDF types (`.bmp`, `.jpg`/`.jpeg`, `.png`, `.gif`, `.pdf`).
*/
contentType?: string;
/** Asset name. Defaults to `filename`. */
name?: string;
/** Parent folder id. Omit for the root. */
parentFolderId?: number;
};
/**
* Fields for updating an asset via {@link APIClient.updateAsset}. At least one must be provided;
* file bytes cannot be changed. `parent_folder_id` is tri-state: omit to keep the current parent,
* `null` to move to the root, or a folder id to move it into that folder.
*/
export type AssetUpdate = {
name?: string;
parent_folder_id?: number | null;
};
/** Definition for creating an asset folder via {@link APIClient.createAssetFolder}. */
export type AssetFolderInput = {
/** The folder's display name (required). */
name: string;
/** Parent folder id. Omit for the root. */
parent_folder_id?: number;
};
/**
* Fields for updating an asset folder via {@link APIClient.updateAssetFolder}. At least one must
* be provided. `parent_folder_id` is tri-state: omit to keep the current parent, `null` to move to
* the root, or a folder id to move it into that folder.
*/
export type AssetFolderUpdate = {
name?: string;
parent_folder_id?: number | null;
};
/** A single row of collection data — an arbitrary flat object. */
export type CollectionRow = Record<string, any>;
/**
* Definition for creating a collection via {@link APIClient.createCollection}.
* Provide inline `data` **or** a source `url`, not both.
*/
export type CollectionInput = {
/** The collection's name (required). */
name: string;
/** Inline row data. Mutually exclusive with `url`. */
data?: CollectionRow[];
/** Source URL to import rows from (CSV/JSON/Google Sheet). Mutually exclusive with `data`. */
url?: string;
};
/**
* Fields for updating a collection via {@link APIClient.updateCollection}. Any subset may be
* provided; `data` and `url` are mutually exclusive.
*/
export type CollectionUpdate = {
name?: string;
data?: CollectionRow[];
url?: string;
};
/** An email-suppression category for the ESP (deliverability) endpoints. */
export type SuppressionType = 'blocks' | 'bounces' | 'spam_reports' | 'invalid_emails';
/** Options for {@link APIClient.getSuppressions} (offset-based). */
export type SuppressionsOptions = {
/** Page size, 1–1000. Defaults to 100. */
limit?: number;
/** Number of records to skip. Defaults to 0. */
offset?: number;
/** Filter to a single email address. */
email?: string;
/** Filter to a single sending domain. */
domain?: string;
};
/** Options for {@link APIClient.getDomainSuppressions} (cursor-based). */
export type DomainSuppressionsOptions = {
/** Page size, 1–1000. Defaults to 100. */
limit?: number;
/** Filter to a single email address. */
email?: string;
/** Pagination cursor returned as `next` by a previous page. */
start?: string;
};
/** Definition for creating a reporting webhook via {@link APIClient.createReportingWebhook}. */
export type ReportingWebhookInput = {
/** The destination URL that events are POSTed to (required). */
endpoint: string;
/** The event types to send (e.g. `drafted`, `sent`, `delivered`, `opened`, `clicked`, `bounced`). */
events: string[];
/** Display name (≤190 characters). */
name?: string;
/** When `true`, send an event for every occurrence rather than de-duplicating. */
full_resolution?: boolean;
/** When `true`, include message content in the event payloads. */
with_content?: boolean;
/** When `true`, create the webhook in a disabled state. */
disabled?: boolean;
};
/** Fields for updating a reporting webhook via {@link APIClient.updateReportingWebhook}. Any subset may be provided. */
export type ReportingWebhookUpdate = {
endpoint?: string;
events?: string[];
name?: string;
full_resolution?: boolean;
with_content?: boolean;
disabled?: boolean;
};
/** A snippet definition for {@link APIClient.createSnippet} / {@link APIClient.updateSnippet}. */
export type SnippetInput = {
/** The snippet's unique name/key. */
name: string;
/** The snippet's value (may contain Liquid). */
value: string;
};
/** Options for {@link APIClient.getSenderIdentities}. */
export type SenderIdentitiesOptions = PaginationOptions & {
/** Sort direction. Defaults to `asc`. */
sort?: SortDirection;
/** Filter by hidden status. Omit to return all; `true`/`false` to filter. */
hidden?: boolean;
};
/** Options for {@link APIClient.getMessages}. */
export type MessagesOptions = PaginationOptions & {
/** Return only drafts (`true`) or exclude them (default). */
drafts?: boolean;
/** Filter to deliveries with this metric (e.g. `delivered`, `opened`, `bounced`). */
metric?: string;
/** Scope to a single channel. */
type?: MetricType;
/** Scope to a single campaign. */
campaign_id?: string | number;
/** Scope to a single campaign action. */
action_id?: string | number;
/** Scope to a single newsletter. */
newsletter_id?: string | number;
/** Scope to a single transactional message. */
transactional_id?: string | number;
/** Scope to a single broadcast trigger (requires `campaign_id`). */
trigger_id?: string | number;
/** Scope to a single template. */
template_id?: string | number;
/** Scope to a single content id. */
content_id?: string | number;
/** Only include deliveries after this Unix timestamp (seconds). */
start_ts?: number;
/** Only include deliveries before this Unix timestamp (seconds). */
end_ts?: number;
/** Include the related campaigns/actions/newsletters/contents in the response. */
associations?: boolean;
/** Include tracked responses on each delivery. */
get_tracked_responses?: boolean;
};
/** Options for {@link APIClient.getMessage}. */
export type MessageOptions = {
/** Include the archived message content (rate-limited). */
archived_message?: boolean;
/** Include the related campaign/action/newsletter/content in the response. */
associations?: boolean;
/** Include tracked responses on the delivery. */
get_tracked_responses?: boolean;
};
/** What a CSV import loads. */
export type ImportType = 'people' | 'event' | 'object' | 'relationship';
/** Which records an import processes. */
export type ImportProcessScope = 'all' | 'only_existing' | 'only_new';
/** Definition for creating a CSV import via {@link APIClient.createImport}. */
export type ImportInput = {
/** URL of the CSV file to import (required). */
data_file_url: string;
/** What the CSV loads (required). */
type: ImportType;
/** Which identifier the CSV keys rows by. `id`/`email` for people & events; `id`/`email`/`cio_id` for relationships. */
identifier?: 'id' | 'email' | 'cio_id';
/** Object type id — required when `type` is `object`. */
object_type_id?: string | number;
/** Display name (defaults to the filename). */
name?: string;
/** Description of the import. */
description?: string;
/** For people imports: which profiles to process. Mutually exclusive with `data_to_process`. */
people_to_process?: ImportProcessScope;
/** For object/relationship imports: which records to process. Mutually exclusive with `people_to_process`. */
data_to_process?: ImportProcessScope;
};
/** A single attribute-metadata update for {@link APIClient.batchUpdateAttributes}. */
export type DataIndexAttribute = {
/** The attribute name (required). */
name: string;
/** A human-readable description. */
description?: string;
/** Scope the attribute to an object type. */
object_type_id?: number;
/** Whether the attribute is a relationship attribute. */
is_relationship?: boolean;
/** Scope the attribute to an event. */
event_name?: string;
/** Privacy level (requires the sensitive-attributes feature). */
privacy_level?: number;
};
/** A single event-metadata update for {@link APIClient.batchUpdateEvents}. */
export type DataIndexEvent = {
/** The event name (required). */
name: string;
/** A human-readable description. */
description?: string;
};
type APIDefaults = RequestDefaults & {
region: Region;
url?: string;
retry?: Partial<RetryOptions>;
};
type Recipients = Record<string, unknown>;
/**
* Metric to scope a delivery export to. Pass via the `options.metric` field
* of {@link APIClient.createDeliveriesExport}.
*/
export declare enum DeliveryExportMetric {
Created = "created",
Attempted = "attempted",
Sent = "sent",
Delivered = "delivered",
Opened = "opened",
Clicked = "clicked",
Converted = "converted",
Bounced = "bounced",
Spammed = "spammed",
Unsubscribed = "unsubscribed",
Dropped = "dropped",
Failed = "failed",
Undeliverable = "undeliverable"
}
/**
* Optional filters for {@link APIClient.createDeliveriesExport}.
*/
export type DeliveryExportRequestOptions = {
/** Inclusive start of the window, as a Unix timestamp (seconds). */
start?: number;
/** Inclusive end of the window, as a Unix timestamp (seconds). */
end?: number;
/** Specific delivery attributes to include in the export. */
attributes?: string[];
/** Filter to a single delivery metric. See {@link DeliveryExportMetric}. */
metric?: DeliveryExportMetric;
/** When `true`, include draft messages. Defaults to `false`. */
drafts?: boolean;
};
/**
* Client for the Customer.io App API.
*
* Authenticates with a bearer App API key. Use this client to send
* transactional messages, trigger broadcasts, look up customers, and
* manage exports.
*
* Every method rejects with a {@link CustomerIORequestError} when the API
* returns a non-2xx status.
*
* @example
* ```ts
* import { APIClient, RegionUS, SendEmailRequest } from 'customerio-node';
*
* const api = new APIClient(appKey, { region: RegionUS });
* await api.sendEmail(new SendEmailRequest({
* to: 'a@example.com',
* identifiers: { email: 'a@example.com' },
* transactional_message_id: 'welcome',
* }));
* ```
*/
export declare class APIClient {
appKey: BearerAuth;
defaults: APIDefaults;
request: Request;
apiRoot: string;
/**
* @param appKey Your Customer.io App API bearer token.
* @param defaults Optional overrides. Use `region` to select {@link RegionUS} or {@link RegionEU},
* `url` to point at a custom host, `timeout` (ms, default `10000`), or any other fetch
* {@link RequestDefaults} field — notably `dispatcher` (an undici `Agent` / `ProxyAgent`) for
* proxies, custom TLS, or connection keep-alive.
* @throws If `region` is provided and is not a {@link Region} instance.
*/
constructor(appKey: BearerAuth, defaults?: Partial<APIDefaults>);
/**
* Send a transactional email.
*
* @param req A constructed {@link SendEmailRequest} instance.
* @returns The parsed JSON response body (includes delivery id).
* @throws {Error} If `req` is not a {@link SendEmailRequest} instance.
*/
sendEmail(req: SendEmailRequest): Promise<Record<string, any>>;
/**
* Send a transactional push notification.
*
* @param req A constructed {@link SendPushRequest} instance.
* @returns The parsed JSON response body.
* @throws {Error} If `req` is not a {@link SendPushRequest} instance.
*/
sendPush(req: SendPushRequest): Promise<Record<string, any>>;
/**
* Send a transactional SMS.
*
* @param req A constructed {@link SendSMSRequest} instance.
* @returns The parsed JSON response body.
* @throws {Error} If `req` is not a {@link SendSMSRequest} instance.
*/
sendSMS(req: SendSMSRequest): Promise<Record<string, any>>;
/**
* Send a transactional WhatsApp message.
*
* @param req A constructed {@link SendWhatsAppRequest} instance.
* @returns The parsed JSON response body.
* @throws {Error} If `req` is not a {@link SendWhatsAppRequest} instance.
*/
sendWhatsApp(req: SendWhatsAppRequest): Promise<Record<string, any>>;
/**
* Send a transactional inbox message.
*
* @param req A constructed {@link SendInboxMessageRequest} instance.
* @returns The parsed JSON response body.
* @throws {Error} If `req` is not a {@link SendInboxMessageRequest} instance.
*/
sendInboxMessage(req: SendInboxMessageRequest): Promise<Record<string, any>>;
/**
* Send a transactional in-app message.
*
* @param req A constructed {@link SendInAppRequest} instance.
* @returns The parsed JSON response body.
* @throws {Error} If `req` is not a {@link SendInAppRequest} instance.
*/
sendInApp(req: SendInAppRequest): Promise<Record<string, any>>;
/**
* Look up all people in your workspace with a matching email address.
*
* @param email Full email address. Will be URL-encoded.
* @returns The parsed JSON response body (`{ results: [...] }`).
* @throws {Error} If `email` is not a non-empty string.
*/
getCustomersByEmail(email: string): Promise<Record<string, any>>;
/**
* Trigger an API-triggered broadcast (campaign).
*
* `recipients` may contain one of the special fields `ids`, `emails`,
* `per_user_data`, or `data_file_url` (with associated `*_ignore_missing` /
* `email_add_duplicates` flags); when present, that field's allowed
* companions are forwarded and any other recipients fields are ignored.
* Otherwise the entire `recipients` object is forwarded verbatim alongside
* `data` (use this for segment-based recipients).
*
* Both `data` and `recipients` are optional; omitting `recipients` sends the
* broadcast to its configured recipients.
*
* Note that the parameters are positional: to pass `recipients` without
* `data`, pass `undefined` for `data` — e.g.
* `triggerBroadcast(1, undefined, { emails: ['user@example.com'] })`.
* Passing the recipient selector as the second argument would send it as
* liquid `data` and trigger the broadcast's configured recipients instead.
*
* @param broadcastId The broadcast (campaign) id.
* @param data Liquid `data` payload made available to the broadcast template.
* @param recipients Recipient selector. See above.
* @returns The parsed JSON response body.
*/
triggerBroadcast(broadcastId: string | number, data?: RequestData, recipients?: Recipients): Promise<Record<string, any>>;
/**
* List all exports in your workspace.
*
* @returns The parsed JSON response body (`{ exports: [...] }`).
*/
listExports(): Promise<Record<string, any>>;
/**
* Get metadata for a specific export, including its status.
*
* @param id The export id.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `id` is empty.
*/
getExport(id: string | number): Promise<Record<string, any>>;
/**
* Get a time-limited download URL for an export.
*
* Only meaningful once {@link APIClient.getExport} reports the export as ready.
*
* @param id The export id.
* @returns The parsed JSON response body (`{ url: "..." }`).
* @throws {MissingParamError} If `id` is empty.
*/
downloadExport(id: string | number): Promise<Record<string, any>>;
/**
* Start an export of people matching a filter.
*
* @param filters Filter expression (segment / attribute / and / or / not).
* @returns The parsed JSON response body, including the new export's id.
* @throws {MissingParamError} If `filters` is `null` or `undefined`.
*/
createCustomersExport(filters: Filter): Promise<Record<string, any>>;
/**
* Start an export of delivery telemetry for a given newsletter.
*
* @param newsletterId The newsletter id whose deliveries should be exported.
* @param options Optional filters — see {@link DeliveryExportRequestOptions}.
* @returns The parsed JSON response body, including the new export's id.
* @throws {MissingParamError} If `newsletterId` is empty.
*/
createDeliveriesExport(newsletterId: number, options?: DeliveryExportRequestOptions): Promise<Record<string, any>>;
/**
* Get a person's attributes by identifier.
*
* @param id The person's identifier value.
* @param idType Which identifier kind to look up by. Defaults to {@link IdentifierType.Id}.
* @returns The parsed JSON response body (`{ customer: {...} }`).
* @throws {MissingParamError} If `id` is empty.
* @throws {Error} If `idType` is not a valid {@link IdentifierType}.
*/
getAttributes(id: string | number, idType?: IdentifierType): Promise<Record<string, any>>;
/**
* Look up a person's activities (events, attribute changes, message activity, …).
*
* @param customerId The person's identifier value.
* @param options Optional filters/pagination. See {@link CustomerActivitiesOptions}.
* @returns The parsed JSON response body (`{ activities: [...], next }`).
* @throws {MissingParamError} If `customerId` is empty.
* @throws {Error} If `options.idType` is provided and is not a valid {@link IdentifierType}.
*/
getCustomerActivities(customerId: string | number, options?: CustomerActivitiesOptions): Promise<Record<string, any>>;
/**
* Look up messages sent to a person.
*
* @param customerId The person's identifier value.
* @param options Optional filters/pagination. See {@link CustomerMessagesOptions}.
* @returns The parsed JSON response body (`{ messages: [...], next }`).
* @throws {MissingParamError} If `customerId` is empty.
* @throws {Error} If `options.idType` is provided and is not a valid {@link IdentifierType}.
*/
getCustomerMessages(customerId: string | number, options?: CustomerMessagesOptions): Promise<Record<string, any>>;
/**
* Look up a person's relationships to objects.
*
* @param customerId The person's identifier value.
* @param options Optional pagination. See {@link PaginationOptions}.
* @returns The parsed JSON response body (`{ identifiers: [...], relationships: [...], next }`).
* @throws {MissingParamError} If `customerId` is empty.
*/
getCustomerRelationships(customerId: string | number, options?: PaginationOptions): Promise<Record<string, any>>;
/**
* Look up the segments a person belongs to.
*
* @param customerId The person's identifier value.
* @param idType Which identifier kind `customerId` is. Defaults to {@link IdentifierType.Id}.
* @returns The parsed JSON response body (`{ segments: [...] }`).
* @throws {MissingParamError} If `customerId` is empty.
* @throws {Error} If `idType` is not a valid {@link IdentifierType}.
*/
getCustomerSegments(customerId: string | number, idType?: IdentifierType): Promise<Record<string, any>>;
/**
* Look up a person's subscription (topic) preferences.
*
* @param customerId The person's identifier value.
* @param options Optional identifier kind and localization. See {@link CustomerSubscriptionPreferencesOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `customerId` is empty.
* @throws {Error} If `options.idType` is provided and is not a valid {@link IdentifierType}.
*/
getCustomerSubscriptionPreferences(customerId: string | number, options?: CustomerSubscriptionPreferencesOptions): Promise<Record<string, any>>;
/**
* Search for people matching a filter.
*
* @param filter A segment/attribute filter expression (and/or/not). See {@link Filter}.
* @param options Optional pagination. See {@link PaginationOptions}.
* @returns The parsed JSON response body (`{ identifiers: [...], ids: [...], next }`).
* @throws {MissingParamError} If `filter` is `null` or `undefined`.
*/
searchCustomers(filter: Filter, options?: PaginationOptions): Promise<Record<string, any>>;
/**
* Look up attributes and devices for a set of people in one request.
*
* @param ids The identifiers of the people to look up (non-empty).
* @returns The parsed JSON response body (`{ customers: [...] }`).
* @throws {MissingParamError} If `ids` is not a non-empty array.
*/
getCustomersAttributes(ids: Array<string | number>): Promise<Record<string, any>>;
/**
* Get an object's attributes.
*
* @param objectTypeId The object type's numeric id.
* @param objectId The object's identifier value.
* @param idType Which identifier kind `objectId` is (`object_id` or `cio_object_id`).
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `objectTypeId` or `objectId` is empty.
*/
getObjectAttributes(objectTypeId: string | number, objectId: string | number, idType?: ObjectIdType): Promise<Record<string, any>>;
/**
* Get an object's relationships to people.
*
* @param objectTypeId The object type's numeric id.
* @param objectId The object's identifier value.
* @param options Optional identifier kind and pagination. See {@link ObjectRelationshipsOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `objectTypeId` or `objectId` is empty.
*/
getObjectRelationships(objectTypeId: string | number, objectId: string | number, options?: ObjectRelationshipsOptions): Promise<Record<string, any>>;
/**
* Find objects of a given type matching a filter.
*
* @param objectTypeId The object type's numeric id.
* @param filter An {@link ObjectFilter} expression — `object_attribute` leaf
* conditions composed with `and` / `or` / `not`.
* @param options Optional pagination. See {@link PaginationOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `objectTypeId` is empty or `filter` is `null`/`undefined`.
*/
findObjects(objectTypeId: string | number, filter: ObjectFilter, options?: PaginationOptions): Promise<Record<string, any>>;
/**
* List the object types defined in your workspace.
*
* @returns The parsed JSON response body (`{ types: [...] }`).
*/
listObjectTypes(): Promise<Record<string, any>>;
/**
* List activities across your workspace.
*
* @param options Optional filters/pagination. See {@link ListActivitiesOptions}.
* @returns The parsed JSON response body (`{ activities: [...], next }`).
* @throws {Error} If `options.idType` is provided and is not a valid {@link IdentifierType}.
*/
listActivities(options?: ListActivitiesOptions): Promise<Record<string, any>>;
/**
* List the segments in your workspace.
*
* @returns The parsed JSON response body (`{ segments: [...] }`).
*/
listSegments(): Promise<Record<string, any>>;
/**
* Create a manual segment.
*
* @param segment The segment definition. `name` is required. See {@link SegmentInput}.
* @returns The parsed JSON response body (`{ segment: {...} }`).
* @throws {MissingParamError} If `segment` is missing/not an object, or `segment.name` is empty.
*/
createSegment(segment: SegmentInput): Promise<Record<string, any>>;
/**
* Get a single segment's metadata.
*
* @param segmentId The segment's numeric id.
* @returns The parsed JSON response body (`{ segment: {...} }`).
* @throws {MissingParamError} If `segmentId` is empty.
*/
getSegment(segmentId: string | number): Promise<Record<string, any>>;
/**
* Delete a manual segment.
*
* @param segmentId The segment's numeric id.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `segmentId` is empty.
*/
deleteSegment(segmentId: string | number): Promise<Record<string, any>>;
/**
* Get the number of people in a segment.
*
* @param segmentId The segment's numeric id.
* @returns The parsed JSON response body (`{ count, ... }`).
* @throws {MissingParamError} If `segmentId` is empty.
*/
getSegmentCustomerCount(segmentId: string | number): Promise<Record<string, any>>;
/**
* List the people who belong to a segment.
*
* @param segmentId The segment's numeric id.
* @param options Optional pagination. See {@link PaginationOptions}.
* @returns The parsed JSON response body (`{ ids: [...], identifiers: [...], next }`).
* @throws {MissingParamError} If `segmentId` is empty.
*/
getSegmentMembership(segmentId: string | number, options?: PaginationOptions): Promise<Record<string, any>>;
/**
* Get the campaigns, newsletters, and other resources that use a segment.
*
* @param segmentId The segment's numeric id.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `segmentId` is empty.
*/
getSegmentUsedBy(segmentId: string | number): Promise<Record<string, any>>;
/**
* List the subscription topics defined in your workspace.
*
* @returns The parsed JSON response body (`{ topics: [...] }`).
*/
listSubscriptionTopics(): Promise<Record<string, any>>;
/**
* List the subscription channels configured in your workspace.
*
* @returns The parsed JSON response body.
*/
listSubscriptionChannels(): Promise<Record<string, any>>;
/**
* Generate a subscription center token for a person. The token authenticates
* a hosted subscription-center link so the person can manage their preferences.
*
* @param customerId The person's identifier value.
* @returns The parsed JSON response body (`{ token }`).
* @throws {MissingParamError} If `customerId` is empty.
*/
getSubscriptionCenterToken(customerId: string | number): Promise<Record<string, any>>;
/**
* List the transactional messages in your workspace.
*
* @returns The parsed JSON response body.
*/
listTransactionalMessages(): Promise<Record<string, any>>;
/**
* Get a single transactional message's metadata.
*
* @param transactionalId The transactional message's numeric id.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `transactionalId` is empty.
*/
getTransactionalMessage(transactionalId: string | number): Promise<Record<string, any>>;
/**
* List all content variants of a transactional message.
*
* @param transactionalId The transactional message's numeric id.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `transactionalId` is empty.
*/
getTransactionalMessageContents(transactionalId: string | number): Promise<Record<string, any>>;
/**
* Get a single-language translation of a transactional message.
*
* @param transactionalId The transactional message's numeric id.
* @param language The IETF language tag of the translation.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `transactionalId` or `language` is empty.
*/
getTransactionalMessageLanguage(transactionalId: string | number, language: string): Promise<Record<string, any>>;
/**
* Update a single-language translation of a transactional message.
*
* @param transactionalId The transactional message's numeric id.
* @param language The IETF language tag of the translation.
* @param data The translation fields to update.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `transactionalId` or `language` is empty.
*/
updateTransactionalMessageLanguage(transactionalId: string | number, language: string, data?: RequestData): Promise<Record<string, any>>;
/**
* Get the individual deliveries (sends) of a transactional message.
*
* @param transactionalId The transactional message's numeric id.
* @param options Optional filters/pagination. See {@link TransactionalDeliveriesOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `transactionalId` is empty.
*/
getTransactionalMessageDeliveries(transactionalId: string | number, options?: TransactionalDeliveriesOptions): Promise<Record<string, any>>;
/**
* Get delivery metrics for a transactional message over time.
*
* @param transactionalId The transactional message's numeric id.
* @param options Optional reporting window. See {@link TransactionalMetricsOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `transactionalId` is empty.
*/
getTransactionalMessageMetrics(transactionalId: string | number, options?: TransactionalMetricsOptions): Promise<Record<string, any>>;
/**
* Get link (click) metrics for a transactional message over time.
*
* @param transactionalId The transactional message's numeric id.
* @param options Optional reporting window. See {@link TransactionalLinkMetricsOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `transactionalId` is empty.
*/
getTransactionalMessageLinkMetrics(transactionalId: string | number, options?: TransactionalLinkMetricsOptions): Promise<Record<string, any>>;
/**
* Update a transactional message's content variant.
*
* @param transactionalId The transactional message's numeric id.
* @param contentId The content variant's numeric id.
* @param data The content fields to update.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `transactionalId` or `contentId` is empty.
*/
updateTransactionalMessageContent(transactionalId: string | number, contentId: string | number, data?: RequestData): Promise<Record<string, any>>;
/**
* Build the base URL for a campaign/broadcast resource. Shared by the
* campaign and broadcast methods, which have identical sub-resource paths.
*/
private resourceBase;
/**
* List the campaigns in your workspace.
*
* @returns The parsed JSON response body (`{ campaigns: [...] }`).
*/
listCampaigns(): Promise<Record<string, any>>;
/**
* Get a single campaign's metadata.
*
* @param campaignId The campaign's numeric id.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `campaignId` is empty.
*/
getCampaign(campaignId: string | number): Promise<Record<string, any>>;
/**
* List a campaign's actions.
*
* @param campaignId The campaign's numeric id.
* @param options Optional pagination cursor (`start`).
* @returns The parsed JSON response body (`{ actions: [...], next }`).
* @throws {MissingParamError} If `campaignId` is empty.
*/
getCampaignActions(campaignId: string | number, options?: {
start?: string;
}): Promise<Record<string, any>>;
/**
* Get a single action of a campaign.
*
* @param campaignId The campaign's numeric id.
* @param actionId The action's numeric id.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `campaignId` or `actionId` is empty.
*/
getCampaignAction(campaignId: string | number, actionId: string | number): Promise<Record<string, any>>;
/**
* Update an action of a campaign (e.g. its message content).
*
* @param campaignId The campaign's numeric id.
* @param actionId The action's numeric id.
* @param data The action fields to update.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `campaignId` or `actionId` is empty.
*/
updateCampaignAction(campaignId: string | number, actionId: string | number, data?: RequestData): Promise<Record<string, any>>;
/**
* Get a single-language translation of a campaign action.
*
* @param campaignId The campaign's numeric id.
* @param actionId The action's numeric id.
* @param language The IETF language tag.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `campaignId`, `actionId`, or `language` is empty.
*/
getCampaignActionLanguage(campaignId: string | number, actionId: string | number, language: string): Promise<Record<string, any>>;
/**
* Update a single-language translation of a campaign action.
*
* @param campaignId The campaign's numeric id.
* @param actionId The action's numeric id.
* @param language The IETF language tag.
* @param data The translation fields to update.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `campaignId`, `actionId`, or `language` is empty.
*/
updateCampaignActionLanguage(campaignId: string | number, actionId: string | number, language: string, data?: RequestData): Promise<Record<string, any>>;
/**
* Get metrics for a single campaign action over time. Aggregated across all
* channels (the API does not accept a `type` filter here).
*
* @param campaignId The campaign's numeric id.
* @param actionId The action's numeric id.
* @param options Optional reporting window/version. See {@link CampaignActionMetricsOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `campaignId` or `actionId` is empty.
*/
getCampaignActionMetrics(campaignId: string | number, actionId: string | number, options?: CampaignActionMetricsOptions): Promise<Record<string, any>>;
/**
* Get link (click) metrics for a single campaign action over time.
*
* @param campaignId The campaign's numeric id.
* @param actionId The action's numeric id.
* @param options Optional reporting window. See {@link LinkMetricsOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `campaignId` or `actionId` is empty.
*/
getCampaignActionMetricsLinks(campaignId: string | number, actionId: string | number, options?: LinkMetricsOptions): Promise<Record<string, any>>;
/**
* Get delivery metrics for a campaign over time.
*
* @param campaignId The campaign's numeric id.
* @param options Optional reporting window/filters. See {@link CampaignMetricsOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `campaignId` is empty.
*/
getCampaignMetrics(campaignId: string | number, options?: CampaignMetricsOptions): Promise<Record<string, any>>;
/**
* Get link (click) metrics for a campaign over time.
*
* @param campaignId The campaign's numeric id.
* @param options Optional reporting window. See {@link LinkMetricsOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `campaignId` is empty.
*/
getCampaignMetricsLinks(campaignId: string | number, options?: LinkMetricsOptions): Promise<Record<string, any>>;
/**
* Get a campaign's journey metrics (per-step conversion funnel) over a window.
*
* @param campaignId The campaign's numeric id.
* @param options Required window and resolution. See {@link JourneyMetricsOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `campaignId`, `options.start`, `options.end`, or `options.res` is empty.
*/
getCampaignJourneyMetrics(campaignId: string | number, options: JourneyMetricsOptions): Promise<Record<string, any>>;
/**
* Get the individual messages (deliveries) sent by a campaign.
*
* @param campaignId The campaign's numeric id.
* @param options Optional filters/pagination. See {@link CampaignMessagesOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `campaignId` is empty.
*/
getCampaignMessages(campaignId: string | number, options?: CampaignMessagesOptions): Promise<Record<string, any>>;
/**
* Get the status of an API-triggered broadcast run. Pairs with {@link APIClient.triggerBroadcast}.
*
* @param broadcastId The broadcast (campaign) id.
* @param triggerId The trigger id returned by `triggerBroadcast`.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `broadcastId` or `triggerId` is empty.
*/
getBroadcastTriggerStatus(broadcastId: string | number, triggerId: string | number): Promise<Record<string, any>>;
/**
* Get the per-recipient errors for an API-triggered broadcast run.
*
* @param broadcastId The broadcast (campaign) id.
* @param triggerId The trigger id returned by `triggerBroadcast`.
* @param options Optional pagination. See {@link PaginationOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `broadcastId` or `triggerId` is empty.
*/
getBroadcastTriggerErrors(broadcastId: string | number, triggerId: string | number, options?: PaginationOptions): Promise<Record<string, any>>;
/**
* List the broadcasts in your workspace.
*
* @returns The parsed JSON response body (`{ broadcasts: [...] }`).
*/
listBroadcasts(): Promise<Record<string, any>>;
/**
* Get a single broadcast's metadata.
*
* @param broadcastId The broadcast's numeric id.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `broadcastId` is empty.
*/
getBroadcast(broadcastId: string | number): Promise<Record<string, any>>;
/**
* List a broadcast's actions.
*
* @param broadcastId The broadcast's numeric id.
* @returns The parsed JSON response body (`{ actions: [...] }`).
* @throws {MissingParamError} If `broadcastId` is empty.
*/
getBroadcastActions(broadcastId: string | number): Promise<Record<string, any>>;
/**
* Get a single action of a broadcast.
*
* @param broadcastId The broadcast's numeric id.
* @param actionId The action's numeric id.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `broadcastId` or `actionId` is empty.
*/
getBroadcastAction(broadcastId: string | number, actionId: string | number): Promise<Record<string, any>>;
/**
* Update an action of a broadcast (e.g. its message content).
*
* @param broadcastId The broadcast's numeric id.
* @param actionId The action's numeric id.
* @param data The action fields to update.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `broadcastId` or `actionId` is empty.
*/
updateBroadcastAction(broadcastId: string | number, actionId: string | number, data?: RequestData): Promise<Record<string, any>>;
/**
* Get a single-language translation of a broadcast action.
*
* @param broadcastId The broadcast's numeric id.
* @param actionId The action's numeric id.
* @param language The IETF language tag.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `broadcastId`, `actionId`, or `language` is empty.
*/
getBroadcastActionLanguage(broadcastId: string | number, actionId: string | number, language: string): Promise<Record<string, any>>;
/**
* Update a single-language translation of a broadcast action.
*
* @param broadcastId The broadcast's numeric id.
* @param actionId The action's numeric id.
* @param language The IETF language tag.
* @param data The translation fields to update.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `broadcastId`, `actionId`, or `language` is empty.
*/
updateBroadcastActionLanguage(broadcastId: string | number, actionId: string | number, language: string, data?: RequestData): Promise<Record<string, any>>;
/**
* Get metrics for a single broadcast action over time. Aggregated across all
* channels (the API does not accept a `type` filter here).
*
* @param broadcastId The broadcast's numeric id.
* @param actionId The action's numeric id.
* @param options Optional reporting window. See {@link MetricsWindowOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `broadcastId` or `actionId` is empty.
*/
getBroadcastActionMetrics(broadcastId: string | number, actionId: string | number, options?: MetricsWindowOptions): Promise<Record<string, any>>;
/**
* Get link (click) metrics for a single broadcast action over time.
*
* @param broadcastId The broadcast's numeric id.
* @param actionId The action's numeric id.
* @param options Optional reporting window. See {@link LinkMetricsOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `broadcastId` or `actionId` is empty.
*/
getBroadcastActionMetricsLinks(broadcastId: string | number, actionId: string | number, options?: LinkMetricsOptions): Promise<Record<string, any>>;
/**
* Get delivery metrics for a broadcast over time.
*
* @param broadcastId The broadcast's numeric id.
* @param options Optional reporting window/filters. See {@link MetricsOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `broadcastId` is empty.
*/
getBroadcastMetrics(broadcastId: string | number, options?: MetricsOptions): Promise<Record<string, any>>;
/**
* Get link (click) metrics for a broadcast over time.
*
* @param broadcastId The broadcast's numeric id.
* @param options Optional reporting window. See {@link LinkMetricsOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `broadcastId` is empty.
*/
getBroadcastMetricsLinks(broadcastId: string | number, options?: LinkMetricsOptions): Promise<Record<string, any>>;
/**
* Get the individual messages (deliveries) sent by a broadcast.
*
* @param broadcastId The broadcast's numeric id.
* @param options Optional filters/pagination. See {@link BroadcastMessagesOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `broadcastId` is empty.
*/
getBroadcastMessages(broadcastId: string | number, options?: BroadcastMessagesOptions): Promise<Record<string, any>>;
/**
* List the API triggers fired for a broadcast.
*
* @param broadcastId The broadcast's numeric id.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `broadcastId` is empty.
*/
getBroadcastTriggers(broadcastId: string | number): Promise<Record<string, any>>;
/**
* List the newsletters in your workspace.
*
* @param options Optional pagination and sort. See {@link ListNewslettersOptions}.
* @returns The parsed JSON response body (`{ newsletters: [...], next }`).
*/
listNewsletters(options?: ListNewslettersOptions): Promise<Record<string, any>>;
/**
* Create a newsletter.
*
* @param data The newsletter definition.
* @returns The parsed JSON response body.
*/
createNewsletter(data?: RequestData): Promise<Record<string, any>>;
/**
* Get a single newsletter's metadata.
*
* @param newsletterId The newsletter's numeric id.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId` is empty.
*/
getNewsletter(newsletterId: string | number): Promise<Record<string, any>>;
/**
* Delete a newsletter.
*
* @param newsletterId The newsletter's numeric id.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId` is empty.
*/
deleteNewsletter(newsletterId: string | number): Promise<Record<string, any>>;
/**
* List all content variants of a newsletter.
*
* @param newsletterId The newsletter's numeric id.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId` is empty.
*/
getNewsletterContents(newsletterId: string | number): Promise<Record<string, any>>;
/**
* Get a single content variant of a newsletter.
*
* @param newsletterId The newsletter's numeric id.
* @param contentId The content variant's numeric id.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId` or `contentId` is empty.
*/
getNewsletterContent(newsletterId: string | number, contentId: string | number): Promise<Record<string, any>>;
/**
* Update a content variant of a newsletter.
*
* @param newsletterId The newsletter's numeric id.
* @param contentId The content variant's numeric id.
* @param data The content fields to update.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId` or `contentId` is empty.
*/
updateNewsletterContent(newsletterId: string | number, contentId: string | number, data?: RequestData): Promise<Record<string, any>>;
/**
* Get metrics for a single newsletter content variant over time.
*
* @param newsletterId The newsletter's numeric id.
* @param contentId The content variant's numeric id.
* @param options Optional reporting window/filters. See {@link NewsletterMetricsOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId` or `contentId` is empty.
*/
getNewsletterContentMetrics(newsletterId: string | number, contentId: string | number, options?: NewsletterMetricsOptions): Promise<Record<string, any>>;
/**
* Get link (click) metrics for a single newsletter content variant over time.
*
* @param newsletterId The newsletter's numeric id.
* @param contentId The content variant's numeric id.
* @param options Optional reporting window. See {@link LinkMetricsOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId` or `contentId` is empty.
*/
getNewsletterContentMetricsLinks(newsletterId: string | number, contentId: string | number, options?: LinkMetricsOptions): Promise<Record<string, any>>;
/**
* Get delivery metrics for a newsletter over time.
*
* @param newsletterId The newsletter's numeric id.
* @param options Optional reporting window/filters. See {@link NewsletterMetricsOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId` is empty.
*/
getNewsletterMetrics(newsletterId: string | number, options?: NewsletterMetricsOptions): Promise<Record<string, any>>;
/**
* Get link (click) metrics for a newsletter over time.
*
* @param newsletterId The newsletter's numeric id.
* @param options Optional reporting window. See {@link LinkMetricsOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId` is empty.
*/
getNewsletterMetricsLinks(newsletterId: string | number, options?: LinkMetricsOptions): Promise<Record<string, any>>;
/**
* Get the individual messages (deliveries) sent by a newsletter.
*
* @param newsletterId The newsletter's numeric id.
* @param options Optional filters/pagination. See {@link NewsletterMessagesOptions}.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId` is empty.
*/
getNewsletterMessages(newsletterId: string | number, options?: NewsletterMessagesOptions): Promise<Record<string, any>>;
/**
* Send a newsletter.
*
* @param newsletterId The newsletter's numeric id.
* @param data Optional send settings — e.g. `rate_limit_email_rate`,
* `rate_limit_time_period`, `rate_limit_spread`.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId` is empty.
*/
sendNewsletter(newsletterId: string | number, data?: RequestData): Promise<Record<string, any>>;
/**
* Schedule a newsletter to send later.
*
* @param newsletterId The newsletter's numeric id.
* @param data The schedule settings.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId` is empty.
*/
scheduleNewsletter(newsletterId: string | number, data?: RequestData): Promise<Record<string, any>>;
/**
* Add a language (translation) to a newsletter.
*
* @param newsletterId The newsletter's numeric id.
* @param data The translation content, including its `language` tag.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId` is empty.
*/
createNewsletterLanguage(newsletterId: string | number, data?: RequestData): Promise<Record<string, any>>;
/**
* Get a single-language translation of a newsletter.
*
* @param newsletterId The newsletter's numeric id.
* @param language The IETF language tag.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId` or `language` is empty.
*/
getNewsletterLanguage(newsletterId: string | number, language: string): Promise<Record<string, any>>;
/**
* Update a single-language translation of a newsletter.
*
* @param newsletterId The newsletter's numeric id.
* @param language The IETF language tag.
* @param data The translation fields to update.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId` or `language` is empty.
*/
updateNewsletterLanguage(newsletterId: string | number, language: string, data?: RequestData): Promise<Record<string, any>>;
/**
* Delete a single-language translation of a newsletter.
*
* @param newsletterId The newsletter's numeric id.
* @param language The IETF language tag.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId` or `language` is empty.
*/
deleteNewsletterLanguage(newsletterId: string | number, language: string): Promise<Record<string, any>>;
/**
* List a newsletter's A/B test groups.
*
* @param newsletterId The newsletter's numeric id.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId` is empty.
*/
getNewsletterTestGroups(newsletterId: string | number): Promise<Record<string, any>>;
/**
* Create an A/B test group on a newsletter. The API takes no request body —
* a new empty test group is created and returned.
*
* @param newsletterId The newsletter's numeric id.
* @returns The parsed JSON response body (the updated newsletter).
* @throws {MissingParamError} If `newsletterId` is empty.
*/
createNewsletterTestGroup(newsletterId: string | number): Promise<Record<string, any>>;
/**
* Add a language (translation) to a newsletter test group.
*
* @param newsletterId The newsletter's numeric id.
* @param testGroupId The test group's id.
* @param data The translation content, including its `language` tag.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId` or `testGroupId` is empty.
*/
createNewsletterTestGroupLanguage(newsletterId: string | number, testGroupId: string | number, data?: RequestData): Promise<Record<string, any>>;
/**
* Get a single-language translation of a newsletter test group.
*
* @param newsletterId The newsletter's numeric id.
* @param testGroupId The test group's id.
* @param language The IETF language tag.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId`, `testGroupId`, or `language` is empty.
*/
getNewsletterTestGroupLanguage(newsletterId: string | number, testGroupId: string | number, language: string): Promise<Record<string, any>>;
/**
* Update a single-language translation of a newsletter test group.
*
* @param newsletterId The newsletter's numeric id.
* @param testGroupId The test group's id.
* @param language The IETF language tag.
* @param data The translation fields to update.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId`, `testGroupId`, or `language` is empty.
*/
updateNewsletterTestGroupLanguage(newsletterId: string | number, testGroupId: string | number, language: string, data?: RequestData): Promise<Record<string, any>>;
/**
* Delete a single-language translation of a newsletter test group.
*
* @param newsletterId The newsletter's numeric id.
* @param testGroupId The test group's id.
* @param language The IETF language tag.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `newsletterId`, `testGroupId`, or `language` is empty.
*/
deleteNewsletterTestGroupLanguage(newsletterId: string | number, testGroupId: string | number, language: string): Promise<Record<string, any>>;
/**
* List Design Studio folders.
*
* @param options Optional filters, sorting, and pagination. See {@link DesignStudioListOptions}.
* @returns The parsed JSON response body (`{ folders: [...], meta }`).
*/
listDesignStudioFolders(options?: DesignStudioListOptions): Promise<Record<string, any>>;
/**
* Create a Design Studio folder.
*
* @param folder The folder definition. `name` is required. See {@link DesignStudioFolderInput}.
* @returns The parsed JSON response body (`{ folder: {...} }`).
* @throws {MissingParamError} If `folder` is missing/not an object, or `folder.name` is empty.
*/
createDesignStudioFolder(folder: DesignStudioFolderInput): Promise<Record<string, any>>;
/**
* Get a single Design Studio folder.
*
* @param folderId The folder's UUID.
* @returns The parsed JSON response body (`{ folder: {...} }`).
* @throws {MissingParamError} If `folderId` is empty.
*/
getDesignStudioFolder(folderId: string): Promise<Record<string, any>>;
/**
* Update a Design Studio folder. At least one field must be provided.
*
* @param folderId The folder's UUID.
* @param updates The fields to change. See {@link DesignStudioFolderUpdate}.
* @returns The parsed JSON response body (empty on success — the API returns 204).
* @throws {MissingParamError} If `folderId` is empty or `updates` is missing/not an object.
*/
updateDesignStudioFolder(folderId: string, updates: DesignStudioFolderUpdate): Promise<Record<string, any>>;
/**
* Delete a Design Studio folder.
*
* @param folderId The folder's UUID.
* @returns The parsed JSON response body (empty on success — the API returns 204).
* @throws {MissingParamError} If `folderId` is empty.
*/
deleteDesignStudioFolder(folderId: string): Promise<Record<string, any>>;
/**
* List Design Studio emails.
*
* @param options Optional filters, sorting, and pagination. See {@link ListDesignStudioEmailsOptions}.
* @returns The parsed JSON response body (`{ emails: [...], folders: [...], meta }`).
*/
listDesignStudioEmails(options?: ListDesignStudioEmailsOptions): Promise<Record<string, any>>;
/**
* Create a Design Studio email.
*
* @param email The email definition. `name` is required. See {@link DesignStudioEmailInput}.
* @returns The parsed JSON response body (`{ email: {...} }`).
* @throws {MissingParamError} If `email` is missing/not an object, or `email.name` is empty.
*/
createDesignStudioEmail(email: DesignStudioEmailInput): Promise<Record<string, any>>;
/**
* Get a single Design Studio email.
*
* @param emailId The email's UUID.
* @returns The parsed JSON response body (`{ email: {...} }`).
* @throws {MissingParamError} If `emailId` is empty.
*/
getDesignStudioEmail(emailId: string): Promise<Record<string, any>>;
/**
* Update a Design Studio email. At least one field must be provided.
*
* @param emailId The email's UUID.
* @param updates The fields to change. See {@link DesignStudioEmailUpdate}.
* @returns The parsed JSON response body (empty on success — the API returns 204).
* @throws {MissingParamError} If `emailId` is empty or `updates` is missing/not an object.
*/
updateDesignStudioEmail(emailId: string, updates: DesignStudioEmailUpdate): Promise<Record<string, any>>;
/**
* Delete a Design Studio email.
*
* @param emailId The email's UUID.
* @returns The parsed JSON response body (empty on success — the API returns 204).
* @throws {MissingParamError} If `emailId` is empty.
*/
deleteDesignStudioEmail(emailId: string): Promise<Record<string, any>>;
/**
* List the translations (languages) of a Design Studio email.
*
* @param emailId The email's UUID.
* @returns The parsed JSON response body (`{ email_translations: [...] }`).
* @throws {MissingParamError} If `emailId` is empty.
*/
listDesignStudioEmailLanguages(emailId: string): Promise<Record<string, any>>;
/**
* Create a translation of a Design Studio email. Content blocks you omit are
* inherited from the default-language email.
*
* @param emailId The email's UUID.
* @param translation The translation definition. `language` is required. See {@link DesignStudioEmailTranslationInput}.
* @returns The parsed JSON response body (`{ email_translation: {...} }`).
* @throws {MissingParamError} If `emailId` is empty, `translation` is missing/not an object, or `translation.language` is empty.
*/
createDesignStudioEmailLanguage(emailId: string, translation: DesignStudioEmailTranslationInput): Promise<Record<string, any>>;
/**
* Get a single-language translation of a Design Studio email.
*
* @param emailId The email's UUID.
* @param language The IETF language tag.
* @returns The parsed JSON response body (`{ email_translation: {...} }`).
* @throws {MissingParamError} If `emailId` or `language` is empty.
*/
getDesignStudioEmailLanguage(emailId: string, language: string): Promise<Record<string, any>>;
/**
* Update a single-language translation of a Design Studio email. At least one field must be provided.
*
* @param emailId The email's UUID.
* @param language The IETF language tag.
* @param updates The fields to change. See {@link DesignStudioEmailTranslationUpdate}.
* @returns The parsed JSON response body (empty on success — the API returns 204).
* @throws {MissingParamError} If `emailId` or `language` is empty, or `updates` is missing/not an object.
*/
updateDesignStudioEmailLanguage(emailId: string, language: string, updates: DesignStudioEmailTranslationUpdate): Promise<Record<string, any>>;
/**
* Delete a single-language translation of a Design Studio email.
*
* @param emailId The email's UUID.
* @param language The IETF language tag.
* @returns The parsed JSON response body (empty on success — the API returns 204).
* @throws {MissingParamError} If `emailId` or `language` is empty.
*/
deleteDesignStudioEmailLanguage(emailId: string, language: string): Promise<Record<string, any>>;
/**
* List Design Studio components.
*
* @param options Optional filters, sorting, and pagination. See {@link ListDesignStudioComponentsOptions}.
* @returns The parsed JSON response body (`{ components: [...], folders: [...], meta }`).
*/
listDesignStudioComponents(options?: ListDesignStudioComponentsOptions): Promise<Record<string, any>>;
/**
* Create a Design Studio component.
*
* @param component The component definition. `name` and `tag` are required. See {@link DesignStudioComponentInput}.
* @returns The parsed JSON response body (`{ component: {...} }`).
* @throws {MissingParamError} If `component` is missing/not an object, or `component.name`/`component.tag` is empty.
*/
createDesignStudioComponent(component: DesignStudioComponentInput): Promise<Record<string, any>>;
/**
* Get a single Design Studio component.
*
* @param componentId The component's UUID.
* @returns The parsed JSON response body (`{ component: {...} }`).
* @throws {MissingParamError} If `componentId` is empty.
*/
getDesignStudioComponent(componentId: string): Promise<Record<string, any>>;
/**
* Update a Design Studio component. At least one field must be provided.
*
* @param componentId The component's UUID.
* @param updates The fields to change. See {@link DesignStudioComponentUpdate}.
* @returns The parsed JSON response body (empty on success — the API returns 204).
* @throws {MissingParamError} If `componentId` is empty or `updates` is missing/not an object.
*/
updateDesignStudioComponent(componentId: string, updates: DesignStudioComponentUpdate): Promise<Record<string, any>>;
/**
* Delete a Design Studio component.
*
* @param componentId The component's UUID.
* @returns The parsed JSON response body (empty on success — the API returns 204).
* @throws {MissingParamError} If `componentId` is empty.
*/
deleteDesignStudioComponent(componentId: string): Promise<Record<string, any>>;
/**
* List uploaded assets (files).
*
* @param options Optional folder filter and pagination. See {@link AssetListOptions}.
* @returns The parsed JSON response body (`{ assets: [...], meta }`).
*/
listAssets(options?: AssetListOptions): Promise<Record<string, any>>;
/**
* Upload a file asset (`multipart/form-data`).
*
* @param file The file to upload. `data` and `filename` are required. See {@link CreateAssetInput}.
* @returns The parsed JSON response body (`{ asset: {...} }`).
* @throws {MissingParamError} If `file` is missing/not an object, or `file.data`/`file.filename` is missing.
*/
createAsset(file: CreateAssetInput): Promise<Record<string, any>>;
/**
* Get a single asset (file).
*
* @param assetId The asset's numeric id.
* @returns The parsed JSON response body (`{ asset: {...} }`).
* @throws {MissingParamError} If `assetId` is empty.
*/
getAsset(assetId: string | number): Promise<Record<string, any>>;
/**
* Update an asset's name and/or parent folder. At least one field must be provided;
* the file bytes cannot be changed.
*
* @param assetId The asset's numeric id.
* @param updates The fields to change. See {@link AssetUpdate}.
* @returns The parsed JSON response body (empty on success — the API returns 204).
* @throws {MissingParamError} If `assetId` is empty or `updates` is missing/not an object.
*/
updateAsset(assetId: string | number, updates: AssetUpdate): Promise<Record<string, any>>;
/**
* Delete an asset (file).
*
* @param assetId The asset's numeric id.
* @returns The parsed JSON response body (empty on success — the API returns 204).
* @throws {MissingParamError} If `assetId` is empty.
*/
deleteAsset(assetId: string | number): Promise<Record<string, any>>;
/**
* List asset folders.
*
* @param options Optional folder filter and pagination. See {@link AssetListOptions}.
* @returns The parsed JSON response body (`{ folders: [...], meta }`).
*/
listAssetFolders(options?: AssetListOptions): Promise<Record<string, any>>;
/**
* Create an asset folder.
*
* @param folder The folder definition. `name` is required. See {@link AssetFolderInput}.
* @returns The parsed JSON response body (`{ folder: {...} }`).
* @throws {MissingParamError} If `folder` is missing/not an object, or `folder.name` is empty.
*/
createAssetFolder(folder: AssetFolderInput): Promise<Record<string, any>>;
/**
* Get a single asset folder.
*
* @param folderId The folder's numeric id.
* @returns The parsed JSON response body (`{ folder: {...} }`).
* @throws {MissingParamError} If `folderId` is empty.
*/
getAssetFolder(folderId: string | number): Promise<Record<string, any>>;
/**
* Update an asset folder. At least one field must be provided.
*
* @param folderId The folder's numeric id.
* @param updates The fields to change. See {@link AssetFolderUpdate}.
* @returns The parsed JSON response body (empty on success — the API returns 204).
* @throws {MissingParamError} If `folderId` is empty or `updates` is missing/not an object.
*/
updateAssetFolder(folderId: string | number, updates: AssetFolderUpdate): Promise<Record<string, any>>;
/**
* Delete an asset folder. The folder must be empty.
*
* @param folderId The folder's numeric id.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `folderId` is empty.
*/
deleteAssetFolder(folderId: string | number): Promise<Record<string, any>>;
/**
* List the collections in your workspace.
*
* @returns The parsed JSON response body (`{ collections: [...] }`).
*/
listCollections(): Promise<Record<string, any>>;
/**
* Create a collection. Provide inline `data` or a source `url`, not both.
*
* @param collection The collection definition. `name` is required. See {@link CollectionInput}.
* @returns The parsed JSON response body (`{ collection: {...} }`).
* @throws {MissingParamError} If `collection` is missing/not an object, or `collection.name` is empty.
*/
createCollection(collection: CollectionInput): Promise<Record<string, any>>;
/**
* Get a single collection's metadata (name, schema, row count, size).
*
* @param collectionId The collection's numeric id.
* @returns The parsed JSON response body (`{ collection: {...} }`).
* @throws {MissingParamError} If `collectionId` is empty.
*/
getCollection(collectionId: string | number): Promise<Record<string, any>>;
/**
* Update a collection. Any subset of fields may be provided; `data` and `url` are mutually exclusive.
*
* @param collectionId The collection's numeric id.
* @param updates The fields to change. See {@link CollectionUpdate}.
* @returns The parsed JSON response body (`{ collection: {...} }`).
* @throws {MissingParamError} If `collectionId` is empty or `updates` is missing/not an object.
*/
updateCollection(collectionId: string | number, updates: CollectionUpdate): Promise<Record<string, any>>;
/**
* Delete a collection. Fails if the collection is still referenced by a campaign.
*
* @param collectionId The collection's numeric id.
* @returns The parsed JSON response body (empty on success — the API returns 204).
* @throws {MissingParamError} If `collectionId` is empty.
*/
deleteCollection(collectionId: string | number): Promise<Record<string, any>>;
/**
* Get a collection's content — the full array of data rows.
*
* @param collectionId The collection's numeric id.
* @returns The parsed JSON response body: an array of row objects.
* @throws {MissingParamError} If `collectionId` is empty.
*/
getCollectionContent(collectionId: string | number): Promise<Record<string, any>>;
/**
* Replace a collection's content with a new array of data rows.
*
* @param collectionId The collection's numeric id.
* @param content The full array of row objects to store.
* @returns The parsed JSON response body (`{ collection: {...} }`).
* @throws {MissingParamError} If `collectionId` is empty or `content` is not an array.
*/
updateCollectionContent(collectionId: string | number, content: CollectionRow[]): Promise<Record<string, any>>;
/**
* Search every suppression category for an email address.
*
* @param email The email address to search for.
* @returns The parsed JSON response body (`{ category, suppressions: [...] }`).
* @throws {MissingParamError} If `email` is empty.
*/
searchSuppression(email: string): Promise<Record<string, any>>;
/**
* List suppressions in a category (offset-based pagination).
*
* @param suppressionType One of `blocks`, `bounces`, `spam_reports`, `invalid_emails`.
* @param options Optional filters and pagination. See {@link SuppressionsOptions}.
* @returns The parsed JSON response body (`{ category, suppressions: [...] }`).
* @throws {MissingParamError} If `suppressionType` is empty.
*/
getSuppressions(suppressionType: SuppressionType, options?: SuppressionsOptions): Promise<Record<string, any>>;
/**
* List suppressions in a category for a single sending domain (cursor-based pagination).
*
* @param domainName The sending domain.
* @param suppressionType One of `blocks`, `bounces`, `spam_reports`, `invalid_emails`.
* @param options Optional filter and pagination. See {@link DomainSuppressionsOptions}.
* @returns The parsed JSON response body (`{ category, suppressions: [...], next }`).
* @throws {MissingParamError} If `domainName` or `suppressionType` is empty.
*/
getDomainSuppressions(domainName: string, suppressionType: SuppressionType, options?: DomainSuppressionsOptions): Promise<Record<string, any>>;
/**
* Add an email address to a suppression category.
*
* @param suppressionType One of `blocks`, `bounces`, `spam_reports`, `invalid_emails`.
* @param email The email address to suppress.
* @returns The parsed JSON response body.
* @throws {MissingParamError} If `suppressionType` or `email` is empty.
*/
createSuppression(suppressionType: SuppressionType, email: string): Promise<Record<string, any>>;
/**
* Remove an email address from a suppression category.
*
* @param suppressionType One of `blocks`, `bounces`, `spam_reports`, `invalid_emails`.
* @param email The email address to unsuppress.
* @returns The parsed JSON response body (empty on success — the API returns 204).
* @throws {MissingParamError} If `suppressionType` or `email` is empty.
*/
deleteSuppression(suppressionType: SuppressionType, email: string): Promise<Record<string, any>>;
/**
* List the reporting webhooks in your workspace.
*
* @returns The parsed JSON response body (`{ reporting_webhooks: [...] }`).
*/
listReportingWebhooks(): Promise<Record<string, any>>;
/**
* Create a reporting webhook.
*
* @param webhook The webhook definition. `endpoint` is required. See {@link ReportingWebhookInput}.
* @returns The parsed JSON response body (the created webhook).
* @throws {MissingParamError} If `webhook` is missing/not an object, or `webhook.endpoint` is empty.
*/
createReportingWebhook(webhook: ReportingWebhookInput): Promise<Record<string, any>>;
/**
* Get a single reporting webhook.
*
* @param webhookId The webhook's numeric id.
* @returns The parsed JSON response body (the webhook).
* @throws {MissingParamError} If `webhookId` is empty.
*/
getReportingWebhook(webhookId: string | number): Promise<Record<string, any>>;
/**
* Update a reporting webhook. Any subset of fields may be provided.
*
* @param webhookId The webhook's numeric id.
* @param updates The fields to change. See {@link ReportingWebhookUpdate}.
* @returns The parsed JSON response body (the updated webhook).
* @throws {MissingParamError} If `webhookId` is empty or `updates` is missing/not an object.
*/
updateReportingWebhook(webhookId: string | number, updates: ReportingWebhookUpdate): Promise<Record<string, any>>;
/**
* Delete a reporting webhook.
*
* @param webhookId The webhook's numeric id.
* @returns The parsed JSON response body (empty on success — the API returns 204).
* @throws {MissingParamError} If `webhookId` is empty.
*/
deleteReportingWebhook(webhookId: string | number): Promise<Record<string, any>>;
/**
* List the snippets in your workspace.
*
* @returns The parsed JSON response body (`{ snippets: [...] }`).
*/
getSnippets(): Promise<Record<string, any>>;
/**
* Create a snippet.
*
* @param snippet The snippet definition. `name` and `value` are required. See {@link SnippetInput}.
* @returns The parsed JSON response body (`{ snippet: {...} }`).
* @throws {MissingParamError} If `snippet` is missing/not an object, or `snippet.name`/`snippet.value` is empty.
*/
createSnippet(snippet: SnippetInput): Promise<Record<string, any>>;
/**
* Create or update a snippet (upsert by name).
*
* @param snippet The snippet definition. `name` and `value` are required. See {@link SnippetInput}.
* @returns The parsed JSON response body (`{ snippet: {...} }`).
* @throws {MissingParamError} If `snippet` is missing/not an object, or `snippet.name`/`snippet.value` is empty.
*/
updateSnippet(snippet: SnippetInput): Promise<Record<string, any>>;
/**
* Delete a snippet by name. Fails if the snippet is still in use.
*
* @param name The snippet's name.
* @returns The parsed JSON response body (empty on success — the API returns 204).
* @throws {MissingParamError} If `name` is empty.
*/
deleteSnippet(name: string): Promise<Record<string, any>>;
/**
* List the sender identities in your workspace.
*
* @param options Optional sort, pagination, and hidden filter. See {@link SenderIdentitiesOptions}.
* @returns The parsed JSON response body (`{ sender_identities: [...], next }`).
*/
getSenderIdentities(options?: SenderIdentitiesOptions): Promise<Record<string, any>>;
/**
* Get a single sender identity.
*
* @param senderId The sender identity's numeric id.
* @returns The parsed JSON response body (`{ sender_identity: {...} }`).
* @throws {MissingParamError} If `senderId` is empty.
*/
getSenderIdentity(senderId: string | number): Promise<Record<string, any>>;
/**
* List the campaigns and newsletters that use a sender identity.
*
* @param senderId The sender identity's numeric id.
* @returns The parsed JSON response body (`{ campaigns, sent_newsletters, draft_newsletters }`).
* @throws {MissingParamError} If `senderId` is empty.
*/
getSenderIdentityUsedBy(senderId: string | number): Promise<Record<string, any>>;
/**
* List sent messages (deliveries) across your workspace.
*
* @param options Optional filters and pagination. See {@link MessagesOptions}.
* @returns The parsed JSON response body (`{ messages: [...], next, ... }`).
*/
getMessages(options?: MessagesOptions): Promise<Record<string, any>>;
/**
* Get a single sent message (delivery).
*
* @param messageId The delivery id (`CIO-Delivery-ID`).
* @param options Optional response expansions. See {@link MessageOptions}.
* @returns The parsed JSON response body (`{ message: {...}, ... }`).
* @throws {MissingParamError} If `messageId` is empty.
*/
getMessage(messageId: string, options?: MessageOptions): Promise<Record<string, any>>;
/**
* Get the archived content of a single sent message.
*
* @param messageId The delivery id (`CIO-Delivery-ID`).
* @returns The parsed JSON response body (`{ archived_message: {...} }`).
* @throws {MissingParamError} If `messageId` is empty.
*/
getArchivedMessage(messageId: string): Promise<Record<string, any>>;
/**
* Start a CSV import.
*
* @param importData The import definition. `data_file_url` and `type` are required. See {@link ImportInput}.
* @returns The parsed JSON response body (`{ import: {...} }`).
* @throws {MissingParamError} If `importData` is missing/not an object, or `data_file_url`/`type` is empty.
*/
createImport(importData: ImportInput): Promise<Record<string, any>>;
/**
* Get the status of an import.
*
* @param importId The import's numeric id.
* @returns The parsed JSON response body (`{ import: {...} }`).
* @throws {MissingParamError} If `importId` is empty.
*/
getImport(importId: string | number): Promise<Record<string, any>>;
/**
* Batch-update attribute metadata (up to 100 at a time).
*
* @param attributes The attribute updates. Each requires a `name`. See {@link DataIndexAttribute}.
* @returns The parsed JSON response body (empty on success — the API returns 204).
* @throws {MissingParamError} If `attributes` is not a non-empty array.
*/
batchUpdateAttributes(attributes: DataIndexAttribute[]): Promise<Record<string, any>>;
/**
* Batch-update event metadata (up to 100 at a time).
*
* @param events The event updates. Each requires a `name`. See {@link DataIndexEvent}.
* @returns The parsed JSON response body (empty on success — the API returns 204).
* @throws {MissingParamError} If `events` is not a non-empty array.
*/
batchUpdateEvents(events: DataIndexEvent[]): Promise<Record<string, any>>;
/**
* List the workspaces (environments) in your account, with usage counts.
*
* @returns The parsed JSON response body (`{ workspaces: [...] }`).
*/
listWorkspaces(): Promise<Record<string, any>>;
/**
* List the Customer.io egress IP addresses (for allowlisting).
*
* @returns The parsed JSON response body (`{ ip_addresses: [...] }`).
*/
getIpAddresses(): Promise<Record<string, any>>;
}
export { SendEmailRequest, SendPushRequest, SendSMSRequest, SendWhatsAppRequest, SendInboxMessageRequest, SendInAppRequest, } from './api/requests';