Skip to content

Class: Optail

Defined in: sdk/src/client.ts:150

new Optail(config: OptailConfig): Optail;

Defined in: sdk/src/client.ts:155

ParameterType
configOptailConfig

Optail

send(params: SendEmailParams): Promise<SendEmailResponse>;

Defined in: sdk/src/client.ts:171

Send a single email. Returns immediately with a provider message ID — the email is queued for async delivery and delivery events flow through webhooks.

ParameterType
paramsSendEmailParams

Promise<SendEmailResponse>


listTemplates(params?: ListTemplatesParams): Promise<PaginatedResponse<TemplateResponse>>;

Defined in: sdk/src/client.ts:182

List templates with pagination. Supports name (substring, case-insensitive), nameExact (exact match — used by migration tooling), and providerTemplateId (resolve a legacy upstream id like SendGrid d-...).

ParameterType
params?ListTemplatesParams

Promise<PaginatedResponse<TemplateResponse>>


getTemplate(templateId: string): Promise<TemplateWithVersionResponse>;

Defined in: sdk/src/client.ts:190

Get a template by id, including its current published version.

ParameterType
templateIdstring

Promise<TemplateWithVersionResponse>


createTemplate(params: CreateTemplateParams): Promise<TemplateResponse>;

Defined in: sdk/src/client.ts:198

Create a template. Returns the row immediately — add a version separately via createTemplateVersion().

ParameterType
paramsCreateTemplateParams

Promise<TemplateResponse>


updateTemplate(templateId: string, params: UpdateTemplateParams): Promise<TemplateResponse>;

Defined in: sdk/src/client.ts:205

Update template metadata (name, description, tags). Does not change the current version.

ParameterType
templateIdstring
paramsUpdateTemplateParams

Promise<TemplateResponse>


deleteTemplate(templateId: string): Promise<SuccessResponse>;

Defined in: sdk/src/client.ts:215

Delete a template and all its versions. Irreversible.

ParameterType
templateIdstring

Promise<SuccessResponse>


createTemplateVersion(templateId: string, params: CreateTemplateVersionParams): Promise<TemplateVersionResponse>;

Defined in: sdk/src/client.ts:223

Add a new version to an existing template. Pass MJML or HTML; MJML is rendered server-side. The new version becomes the current version automatically.

ParameterType
templateIdstring
paramsCreateTemplateVersionParams

Promise<TemplateVersionResponse>


listTemplateVersions(templateId: string): Promise<TemplateVersionListResponse>;

Defined in: sdk/src/client.ts:237

List all versions of a template, newest first.

ParameterType
templateIdstring

Promise<TemplateVersionListResponse>


getTemplateVersion(templateId: string, versionId: string): Promise<TemplateVersionResponse>;

Defined in: sdk/src/client.ts:247

Get a specific version of a template by id.

ParameterType
templateIdstring
versionIdstring

Promise<TemplateVersionResponse>


previewTemplate(templateId: string, params?: PreviewTemplateParams): Promise<PreviewTemplateResponse>;

Defined in: sdk/src/client.ts:261

Render the template with sample variables and return the resolved HTML/text. Useful for editor preview.

ParameterType
templateIdstring
params?PreviewTemplateParams

Promise<PreviewTemplateResponse>


rollbackTemplate(templateId: string, versionId: string): Promise<RollbackTemplateResponse>;

Defined in: sdk/src/client.ts:276

Set a previous version as the current version. The old current version is preserved in history.

ParameterType
templateIdstring
versionIdstring

Promise<RollbackTemplateResponse>


listProviders(): Promise<ProviderResponse[]>;

Defined in: sdk/src/client.ts:289

List provider accounts connected to your organization (SendGrid, Postmark, Mailgun, SES).

Promise<ProviderResponse[]>


getProvider(providerId: string): Promise<ProviderResponse>;

Defined in: sdk/src/client.ts:296

Get a single provider account with its credentials masked.

ParameterType
providerIdstring

Promise<ProviderResponse>


createProvider(params: CreateProviderParams): Promise<ProviderResponse>;

Defined in: sdk/src/client.ts:305

Connect a new provider. Triggers async webhook registration, template import, and unsubscribe-group sync — failures surface in the response without rolling back the connection.

ParameterType
paramsCreateProviderParams

Promise<ProviderResponse>


updateProvider(providerId: string, params: UpdateProviderParams): Promise<ProviderResponse>;

Defined in: sdk/src/client.ts:313

Update a provider (display name, isActive). Credential rotation requires creating a new provider account.

ParameterType
providerIdstring
paramsUpdateProviderParams

Promise<ProviderResponse>


deleteProvider(providerId: string): Promise<SuccessResponse>;

Defined in: sdk/src/client.ts:324

Disconnect a provider. Existing sends already routed to it complete; new sends fail unless another provider covers the routing.

ParameterType
providerIdstring

Promise<SuccessResponse>


validateProvider(providerId: string): Promise<ValidateProviderResponse>;

Defined in: sdk/src/client.ts:331

Verify the stored credentials still work by hitting the provider’s validate endpoint.

ParameterType
providerIdstring

Promise<ValidateProviderResponse>


listProviderDomains(providerId: string): Promise<ProviderDomainResponse[]>;

Defined in: sdk/src/client.ts:341

List sending domains attached to a provider account.

ParameterType
providerIdstring

Promise<ProviderDomainResponse[]>


getMetrics(params?: MetricsQueryParams): Promise<MetricsResponse>;

Defined in: sdk/src/client.ts:354

Time-series email metrics (sent, delivered, opened, etc.) over a date range, grouped by granularity.

ParameterType
params?MetricsQueryParams

Promise<MetricsResponse>


getMetricsBreakdown(params?: MetricsBreakdownParams): Promise<MetricsBreakdownResponse>;

Defined in: sdk/src/client.ts:362

Aggregated metrics grouped by a dimension (provider, domain, template, tag).

ParameterType
params?MetricsBreakdownParams

Promise<MetricsBreakdownResponse>


getMetricsSummary(params?: MetricsSummaryParams): Promise<MetricsSummaryResponse>;

Defined in: sdk/src/client.ts:371

Single-snapshot totals for the period (no time-series). Faster than getMetrics() for dashboard headlines.

ParameterType
params?MetricsSummaryParams

Promise<MetricsSummaryResponse>


listMessages(params?: ListMessagesParams): Promise<PaginatedResponse<MessageListItem>>;

Defined in: sdk/src/client.ts:383

List sent messages with rich filtering: status, provider, template, tag, date range, bounceType, and unsubscribe groupId. Each row includes lastEvent (most recent webhook event for the message) without N+1 queries.

ParameterType
params?ListMessagesParams

Promise<PaginatedResponse<MessageListItem>>


getMessage(messageId: string): Promise<MessageDetailResponse>;

Defined in: sdk/src/client.ts:391

Get a single message with its full event timeline.

ParameterType
messageIdstring

Promise<MessageDetailResponse>


listRoutingRules(): Promise<RoutingRuleResponse[]>;

Defined in: sdk/src/client.ts:401

List all routing rules. Rules pick a provider for outbound sends based on domain + tag matching.

Promise<RoutingRuleResponse[]>


createRoutingRule(params: CreateRoutingRuleParams): Promise<RoutingRuleResponse>;

Defined in: sdk/src/client.ts:409

Create a routing rule. Modes: PRIORITY (try in order), ROUND_ROBIN (alternate), COST_OPTIMIZED, DELIVERY_OPTIMIZED, BALANCED.

ParameterType
paramsCreateRoutingRuleParams

Promise<RoutingRuleResponse>


updateRoutingRule(ruleId: string, params: UpdateRoutingRuleParams): Promise<RoutingRuleResponse>;

Defined in: sdk/src/client.ts:417

Update a routing rule. Mode and weights can change without recreating; provider list cannot reduce to empty.

ParameterType
ruleIdstring
paramsUpdateRoutingRuleParams

Promise<RoutingRuleResponse>


deleteRoutingRule(ruleId: string): Promise<SuccessResponse>;

Defined in: sdk/src/client.ts:427

Delete a routing rule. Any rule remaining catch-all becomes the new fallback.

ParameterType
ruleIdstring

Promise<SuccessResponse>


resolveRouting(params: ResolveRoutingParams): Promise<ResolveRoutingResponse>;

Defined in: sdk/src/client.ts:435

Dry-run: which provider would be picked for a given domain + tag set? Returns the chosen provider plus the rule that matched.

ParameterType
paramsResolveRoutingParams

Promise<ResolveRoutingResponse>


listDomains(): Promise<DomainListItem[]>;

Defined in: sdk/src/client.ts:445

List sending domains across all connected providers, with verification status (SPF / DKIM / DMARC).

Promise<DomainListItem[]>


getDomain(domain: string): Promise<DomainDetailResponse>;

Defined in: sdk/src/client.ts:452

Get a single domain with full DNS-record expected values vs current state.

ParameterType
domainstring

Promise<DomainDetailResponse>


refreshDomain(domain: string): Promise<RefreshDomainResponse>;

Defined in: sdk/src/client.ts:459

Re-check SPF/DKIM/DMARC against authoritative DNS now. Use after updating DNS records.

ParameterType
domainstring

Promise<RefreshDomainResponse>


listUnsubscribeGroups(): Promise<UnsubscribeGroupResponse[]>;

Defined in: sdk/src/client.ts:469

List unsubscribe groups for your organization. Each group can map to multiple provider-side concepts (SendGrid ASM groups, etc.) via listProviderMappings().

Promise<UnsubscribeGroupResponse[]>


createUnsubscribeGroup(params: CreateUnsubscribeGroupParams): Promise<UnsubscribeGroupResponse>;

Defined in: sdk/src/client.ts:477

Create an unsubscribe group. tags enables tag-based send-time routing — sends matching the tags use this group’s opt-outs.

ParameterType
paramsCreateUnsubscribeGroupParams

Promise<UnsubscribeGroupResponse>


updateUnsubscribeGroup(groupId: string, params: UpdateUnsubscribeGroupParams): Promise<UnsubscribeGroupResponse>;

Defined in: sdk/src/client.ts:487

Update group metadata (name, description, isDefault, tags). Provider mappings are managed separately.

ParameterType
groupIdstring
paramsUpdateUnsubscribeGroupParams

Promise<UnsubscribeGroupResponse>


deleteUnsubscribeGroup(groupId: string): Promise<SuccessResponse>;

Defined in: sdk/src/client.ts:502

Delete an unsubscribe group. All suppressions scoped to this group are deleted (cascade).

ParameterType
groupIdstring

Promise<SuccessResponse>


listProviderMappings(unsubscribeGroupId: string): Promise<ProviderMappingResponse[]>;

Defined in: sdk/src/client.ts:510

List provider-side mappings for an unsubscribe group (which SendGrid ASM groups, Postmark MessageStreams, etc. resolve to this Optail group).

ParameterType
unsubscribeGroupIdstring

Promise<ProviderMappingResponse[]>


createProviderMapping(unsubscribeGroupId: string, params: CreateProviderMappingParams): Promise<ProviderMappingResponse>;

Defined in: sdk/src/client.ts:521

Manually attach a provider-side group identifier to an Optail group. Auto-sync handles the common case; this is the manual fallback.

ParameterType
unsubscribeGroupIdstring
paramsCreateProviderMappingParams

Promise<ProviderMappingResponse>


deleteProviderMapping(unsubscribeGroupId: string, mappingId: string): Promise<SuccessResponse>;

Defined in: sdk/src/client.ts:536

Remove a provider mapping. The Optail group itself stays — only the provider linkage is severed.

ParameterType
unsubscribeGroupIdstring
mappingIdstring

Promise<SuccessResponse>


syncProviderUnsubscribeGroups(providerAccountId: string): Promise<SyncProviderUnsubscribeGroupsResponse>;

Defined in: sdk/src/client.ts:550

Re-sync provider-side unsubscribe groups on demand. Idempotent — upserts existing mappings, creates new ones. Use after adding ASM groups in SendGrid, etc.

ParameterType
providerAccountIdstring

Promise<SyncProviderUnsubscribeGroupsResponse>


importProviderTemplates(providerAccountId: string): Promise<ImportProviderTemplatesResponse>;

Defined in: sdk/src/client.ts:563

Pull all templates from a provider account and upsert into Optail. Idempotent. Used to backfill providers connected before template import existed.

ParameterType
providerAccountIdstring

Promise<ImportProviderTemplatesResponse>


listSuppressions(params?: ListSuppressionsParams): Promise<PaginatedResponse<SuppressionResponse>>;

Defined in: sdk/src/client.ts:577

List suppression rows (bounced, unsubscribed, complained recipients). Filter by source.

ParameterType
params?ListSuppressionsParams

Promise<PaginatedResponse<SuppressionResponse>>


createSuppression(params: CreateSuppressionParams): Promise<SuppressionResponse>;

Defined in: sdk/src/client.ts:590

Manually suppress a recipient. Source defaults to MANUAL; pass IMPORT for bulk lists.

ParameterType
paramsCreateSuppressionParams

Promise<SuppressionResponse>


deleteSuppression(suppressionId: string): Promise<SuccessResponse>;

Defined in: sdk/src/client.ts:597

Remove a suppression. Use carefully — restores deliverability to that recipient.

ParameterType
suppressionIdstring

Promise<SuccessResponse>


importSuppressions(params: ImportSuppressionsParams): Promise<ImportSuppressionsResponse>;

Defined in: sdk/src/client.ts:605

Bulk-import suppressions from a list of emails. Idempotent — duplicates are skipped, returns counts.

ParameterType
paramsImportSuppressionsParams

Promise<ImportSuppressionsResponse>


checkSuppression(email: string): Promise<SuppressionCheckResponse>;

Defined in: sdk/src/client.ts:612

Check whether an email is suppressed. Returns the matching suppression rows and groups.

ParameterType
emailstring

Promise<SuppressionCheckResponse>


listWebhookEndpoints(): Promise<WebhookEndpointResponse[]>;

Defined in: sdk/src/client.ts:624

List configured webhook destinations where Optail forwards email events.

Promise<WebhookEndpointResponse[]>


createWebhookEndpoint(params: CreateWebhookEndpointParams): Promise<WebhookEndpointCreateResponse>;

Defined in: sdk/src/client.ts:632

Create a webhook endpoint. Optail signs every delivery with HMAC — verify on receipt using verifyWebhookSignature.

ParameterType
paramsCreateWebhookEndpointParams

Promise<WebhookEndpointCreateResponse>


updateWebhookEndpoint(endpointId: string, params: UpdateWebhookEndpointParams): Promise<WebhookEndpointResponse>;

Defined in: sdk/src/client.ts:642

Update a webhook endpoint (URL, event filter, isActive). Secret cannot be rotated without recreating the endpoint.

ParameterType
endpointIdstring
paramsUpdateWebhookEndpointParams

Promise<WebhookEndpointResponse>


deleteWebhookEndpoint(endpointId: string): Promise<SuccessResponse>;

Defined in: sdk/src/client.ts:656

Delete a webhook endpoint. In-flight deliveries already enqueued may still fire.

ParameterType
endpointIdstring

Promise<SuccessResponse>


testWebhookEndpoint(endpointId: string): Promise<WebhookTestResponse>;

Defined in: sdk/src/client.ts:664

Send a synthetic test event to the endpoint to verify your receiver works. Logs the delivery in the dashboard.

ParameterType
endpointIdstring

Promise<WebhookTestResponse>


getOrganization(): Promise<OrganizationResponse>;

Defined in: sdk/src/client.ts:676

Get the current organization (name, plan, slug, Stripe customer id).

Promise<OrganizationResponse>


updateOrganization(params: UpdateOrganizationParams): Promise<OrganizationResponse>;

Defined in: sdk/src/client.ts:683

Update organization metadata (name, slug).

ParameterType
paramsUpdateOrganizationParams

Promise<OrganizationResponse>


listOrganizationMembers(): Promise<OrganizationMemberResponse[]>;

Defined in: sdk/src/client.ts:690

List members of the current organization with their roles.

Promise<OrganizationMemberResponse[]>


getUsage(): Promise<UsageResponse>;

Defined in: sdk/src/client.ts:697

Current month usage against your plan limits.

Promise<UsageResponse>


listApiKeys(): Promise<ApiKeyResponse[]>;

Defined in: sdk/src/client.ts:707

List API keys with their permissions and last-used timestamps. Key material itself is never returned after creation.

Promise<ApiKeyResponse[]>


createApiKey(params: CreateApiKeyParams): Promise<ApiKeyCreateResponse>;

Defined in: sdk/src/client.ts:715

Mint a new API key. The full key is returned ONCE — store it immediately; subsequent reads only return the prefix.

ParameterType
paramsCreateApiKeyParams

Promise<ApiKeyCreateResponse>


revokeApiKey(apiKeyId: string): Promise<ApiKeyRevokeResponse>;

Defined in: sdk/src/client.ts:723

Revoke an API key. Subsequent requests using it return 401. Revocation is immediate and irreversible.

ParameterType
apiKeyIdstring

Promise<ApiKeyRevokeResponse>


getStatus(): Promise<StatusResponse>;

Defined in: sdk/src/client.ts:736

Public service status (no auth required). Returns overall health, per-service status, and active incidents.

Promise<StatusResponse>


getStatusHistory(): Promise<StatusIncident[]>;

Defined in: sdk/src/client.ts:743

Historical incidents on the public status page.

Promise<StatusIncident[]>


listPlans(): Promise<PlanDefinition[]>;

Defined in: sdk/src/client.ts:752

List available subscription plans.

Promise<PlanDefinition[]>


createCheckout(params: CheckoutParams): Promise<CheckoutResponse>;

Defined in: sdk/src/client.ts:760

Create a Stripe Checkout Session for upgrading the plan. Returns the hosted Checkout URL.

ParameterType
paramsCheckoutParams

Promise<CheckoutResponse>


createBillingPortal(): Promise<PortalResponse>;

Defined in: sdk/src/client.ts:767

Create a Stripe Billing Portal session for managing payment methods / canceling.

Promise<PortalResponse>


getSubscription(): Promise<SubscriptionResponse>;

Defined in: sdk/src/client.ts:774

Active subscription with billing cycle dates.

Promise<SubscriptionResponse>


listContacts(params?: ListContactsParams): Promise<PaginatedResponse<ContactResponse>>;

Defined in: sdk/src/client.ts:784

List contacts with pagination. Filter by status (active / unsubscribed / bounced / complained) or free-text search.

ParameterType
params?ListContactsParams

Promise<PaginatedResponse<ContactResponse>>


getContact(contactId: string): Promise<ContactDetailResponse>;

Defined in: sdk/src/client.ts:792

Get a contact with their list memberships.

ParameterType
contactIdstring

Promise<ContactDetailResponse>


createContact(params: CreateContactParams): Promise<ContactResponse>;

Defined in: sdk/src/client.ts:800

Create a contact. Race-safe: returns the existing row if email already exists (no error).

ParameterType
paramsCreateContactParams

Promise<ContactResponse>


updateContact(contactId: string, params: UpdateContactParams): Promise<ContactResponse>;

Defined in: sdk/src/client.ts:808

Update contact attributes. Cannot change email — create a new contact + delete the old one.

ParameterType
contactIdstring
paramsUpdateContactParams

Promise<ContactResponse>


deleteContact(contactId: string): Promise<SuccessResponse>;

Defined in: sdk/src/client.ts:816

Hard-delete a contact. Suppression history is preserved (suppressions live independently).

ParameterType
contactIdstring

Promise<SuccessResponse>


unsubscribeContact(contactId: string): Promise<ContactResponse>;

Defined in: sdk/src/client.ts:824

Globally unsubscribe a contact (across all lists and groups). Sets the unsubscribedAt flag.

ParameterType
contactIdstring

Promise<ContactResponse>


importContacts(params: ImportContactsParams): Promise<ContactImportJobResponse>;

Defined in: sdk/src/client.ts:832

Bulk-import contacts via an async job. Enqueues the work and returns immediately; poll status with getContactImportJob().

ParameterType
paramsImportContactsParams

Promise<ContactImportJobResponse>


getContactImportJob(jobId: string): Promise<ContactImportJobResponse>;

Defined in: sdk/src/client.ts:839

Poll the status of an import job. Returns counts and per-row errors when complete.

ParameterType
jobIdstring

Promise<ContactImportJobResponse>


listContactLists(params?: ListContactListsParams): Promise<PaginatedResponse<ContactListResponse>>;

Defined in: sdk/src/client.ts:848

List contact lists with member counts.

ParameterType
params?ListContactListsParams

Promise<PaginatedResponse<ContactListResponse>>


getContactList(listId: string): Promise<ContactListResponse>;

Defined in: sdk/src/client.ts:858

Get a single list.

ParameterType
listIdstring

Promise<ContactListResponse>


createContactList(params: CreateListParams): Promise<ContactListResponse>;

Defined in: sdk/src/client.ts:865

Create a static contact list. Race-safe: returns existing row if name already exists.

ParameterType
paramsCreateListParams

Promise<ContactListResponse>


updateContactList(listId: string, params: UpdateListParams): Promise<ContactListResponse>;

Defined in: sdk/src/client.ts:872

Update list metadata (name, description).

ParameterType
listIdstring
paramsUpdateListParams

Promise<ContactListResponse>


deleteContactList(listId: string): Promise<SuccessResponse>;

Defined in: sdk/src/client.ts:879

Delete a list. Member memberships are deleted; the contacts themselves are not.

ParameterType
listIdstring

Promise<SuccessResponse>


listContactListMembers(listId: string, params?: ListMembersParams): Promise<PaginatedResponse<ListMemberResponse>>;

Defined in: sdk/src/client.ts:887

List members of a list. Paginated; pass subscribed: false to include unsubscribed members.

ParameterType
listIdstring
params?ListMembersParams

Promise<PaginatedResponse<ListMemberResponse>>


addContactListMembers(listId: string, params: AddListMembersParams): Promise<AddListMembersResponse>;

Defined in: sdk/src/client.ts:902

Add members by contact id or email. Emails that don’t map to existing contacts auto-create them.

ParameterType
listIdstring
paramsAddListMembersParams

Promise<AddListMembersResponse>


removeContactListMember(listId: string, contactId: string): Promise<ListMembershipResponse>;

Defined in: sdk/src/client.ts:913

Remove a contact from a list (soft unsubscribe — keeps the membership row with unsubscribedAt set).

ParameterType
listIdstring
contactIdstring

Promise<ListMembershipResponse>


listNotificationChannels(): Promise<NotificationChannelResponse[]>;

Defined in: sdk/src/client.ts:929

List notification channels (Slack, webhook, email destinations for Optail internal alerts).

Promise<NotificationChannelResponse[]>


createNotificationChannel(params: CreateNotificationChannelParams): Promise<NotificationChannelResponse>;

Defined in: sdk/src/client.ts:937

Create a notification channel. The events array selects which Optail events route to this channel.

ParameterType
paramsCreateNotificationChannelParams

Promise<NotificationChannelResponse>


updateNotificationChannel(channelId: string, params: UpdateNotificationChannelParams): Promise<NotificationChannelResponse>;

Defined in: sdk/src/client.ts:946

Update a notification channel.

ParameterType
channelIdstring
paramsUpdateNotificationChannelParams

Promise<NotificationChannelResponse>


deleteNotificationChannel(channelId: string): Promise<SuccessResponse>;

Defined in: sdk/src/client.ts:960

Delete a notification channel.

ParameterType
channelIdstring

Promise<SuccessResponse>


testNotificationChannel(channelId: string): Promise<NotificationChannelTestResponse>;

Defined in: sdk/src/client.ts:970

Send a synthetic alert to verify the channel works.

ParameterType
channelIdstring

Promise<NotificationChannelTestResponse>


createExport(params: CreateExportParams): Promise<ExportResponse>;

Defined in: sdk/src/client.ts:983

Create an async export job for email events. Date range capped at 90 days. Formats: csv, jsonl, parquet.

ParameterType
paramsCreateExportParams

Promise<ExportResponse>


getExport(exportId: string): Promise<ExportResponse>;

Defined in: sdk/src/client.ts:990

Poll the status of an export. Returns progress + download URL when complete.

ParameterType
exportIdstring

Promise<ExportResponse>


listExports(params?: PaginationParams): Promise<PaginatedResponse<ExportResponse>>;

Defined in: sdk/src/client.ts:997

List recent export jobs.

ParameterType
params?PaginationParams

Promise<PaginatedResponse<ExportResponse>>


cancelExport(exportId: string): Promise<SuccessResponse>;

Defined in: sdk/src/client.ts:1005

Cancel a pending export. In-progress exports complete normally.

ParameterType
exportIdstring

Promise<SuccessResponse>


getFailoverStatus(): Promise<FailoverStatusResponse[]>;

Defined in: sdk/src/client.ts:1015

Circuit breaker state for each provider account: closed (healthy), open (failing), half_open (recovering).

Promise<FailoverStatusResponse[]>


listFailoverEvents(hours?: number): Promise<FailoverEventResponse[]>;

Defined in: sdk/src/client.ts:1022

Recent failover state transitions. Default window: last 24 hours.

ParameterType
hours?number

Promise<FailoverEventResponse[]>


resetFailover(providerAccountId: string): Promise<ResetFailoverResponse>;

Defined in: sdk/src/client.ts:1030

Manually close an open circuit breaker. Use after fixing a known provider issue.

ParameterType
providerAccountIdstring

Promise<ResetFailoverResponse>


interpretBounce(params: InterpretBounceParams): Promise<InterpretBounceResponse>;

Defined in: sdk/src/client.ts:1043

Classify a raw SMTP bounce code / message / enhanced status into Optail’s normalized taxonomy (hard, soft, block, invalid, mailbox_full, policy, reputation).

ParameterType
paramsInterpretBounceParams

Promise<InterpretBounceResponse>


getBounceAnalysis(messageId: string): Promise<BounceAnalysisResponse>;

Defined in: sdk/src/client.ts:1050

Get bounce-interpretation results for every bounce event on a specific message.

ParameterType
messageIdstring

Promise<BounceAnalysisResponse>


createWarmupPlan(params: CreateWarmupPlanParams): Promise<WarmupPlanResponse>;

Defined in: sdk/src/client.ts:1062

Create an IP / domain warmup plan with ramped daily volumes.

ParameterType
paramsCreateWarmupPlanParams

Promise<WarmupPlanResponse>


listWarmupPlans(params?: ListWarmupPlansParams): Promise<WarmupPlanResponse[]>;

Defined in: sdk/src/client.ts:1069

List warmup plans. Filter by status (active / paused / completed / cancelled).

ParameterType
params?ListWarmupPlansParams

Promise<WarmupPlanResponse[]>


getWarmupOrchestration(): Promise<WarmupOrchestrationResponse>;

Defined in: sdk/src/client.ts:1078

Get the orchestration overview: how traffic should split across providers/domains for plans currently active.

Promise<WarmupOrchestrationResponse>


recalculateWarmupOrchestration(currentVolume?: number): Promise<WarmupOrchestrationResponse>;

Defined in: sdk/src/client.ts:1086

Recalculate traffic distribution. Use after creating/cancelling plans or when current volume changes meaningfully.

ParameterType
currentVolume?number

Promise<WarmupOrchestrationResponse>


getWarmupPlan(planId: string): Promise<WarmupPlanDetailResponse>;

Defined in: sdk/src/client.ts:1099

Get a warmup plan with day-by-day progress.

ParameterType
planIdstring

Promise<WarmupPlanDetailResponse>


recordWarmupMetrics(planId: string, params: RecordWarmupParams): Promise<WarmupPlanResponse>;

Defined in: sdk/src/client.ts:1107

Record actual sent volume + deferrals + bounces for today. Auto-advances the plan to the next day on success.

ParameterType
planIdstring
paramsRecordWarmupParams

Promise<WarmupPlanResponse>


pauseWarmupPlan(planId: string): Promise<WarmupPlanResponse>;

Defined in: sdk/src/client.ts:1117

Pause a warmup plan. The plan’s current day is preserved; resume picks up from there.

ParameterType
planIdstring

Promise<WarmupPlanResponse>


resumeWarmupPlan(planId: string): Promise<WarmupPlanResponse>;

Defined in: sdk/src/client.ts:1124

Resume a paused warmup plan.

ParameterType
planIdstring

Promise<WarmupPlanResponse>


cancelWarmupPlan(planId: string): Promise<WarmupPlanResponse>;

Defined in: sdk/src/client.ts:1131

Cancel a warmup plan permanently.

ParameterType
planIdstring

Promise<WarmupPlanResponse>


createAbTest(params: CreateAbTestParams): Promise<AbTestResponse>;

Defined in: sdk/src/client.ts:1141

Create an A/B test with weighted template-version variants. Metric: open_rate, click_rate, or conversion_rate.

ParameterType
paramsCreateAbTestParams

Promise<AbTestResponse>


listAbTests(params?: ListAbTestsParams): Promise<AbTestResponse[]>;

Defined in: sdk/src/client.ts:1148

List A/B tests filtered by status (draft / running / completed / cancelled).

ParameterType
params?ListAbTestsParams

Promise<AbTestResponse[]>


getAbTest(testId: string): Promise<AbTestResponse>;

Defined in: sdk/src/client.ts:1156

Get an A/B test with variant performance.

ParameterType
testIdstring

Promise<AbTestResponse>


startAbTest(testId: string): Promise<AbTestResponse>;

Defined in: sdk/src/client.ts:1163

Start an A/B test. Variants begin receiving traffic according to their weights.

ParameterType
testIdstring

Promise<AbTestResponse>


stopAbTest(testId: string, params?: StopAbTestParams): Promise<AbTestResponse>;

Defined in: sdk/src/client.ts:1170

Stop the test and declare a winner. Optionally pass final variant results to record.

ParameterType
testIdstring
params?StopAbTestParams

Promise<AbTestResponse>


deleteAbTest(testId: string): Promise<{
deleted: true;
}>;

Defined in: sdk/src/client.ts:1177

Delete an A/B test. Only allowed for tests in draft or cancelled state.

ParameterType
testIdstring

Promise<{ deleted: true; }>


recommendSendTime(params: SendTimeRecommendationParams): Promise<SendTimeRecommendationResponse>;

Defined in: sdk/src/client.ts:1187

Recommend the optimal time to send to a recipient domain based on historical engagement, optionally constrained by template and tags.

ParameterType
paramsSendTimeRecommendationParams

Promise<SendTimeRecommendationResponse>


scoreSpam(params: SpamScoreParams): Promise<SpamScoreResponse>;

Defined in: sdk/src/client.ts:1199

Score an email against the 100-point rubric (subject, content, headers, ISP signals, audience fit). Returns grade + findings + category breakdown.

ParameterType
paramsSpamScoreParams

Promise<SpamScoreResponse>


rewriteForSpam(params: SpamRewriteParams): Promise<SpamRewriteResponse>;

Defined in: sdk/src/client.ts:1207

AI-rewrite the subject + HTML to address spam-score findings. Uses Claude. Preserves intent + tone.

ParameterType
paramsSpamRewriteParams

Promise<SpamRewriteResponse>


getMessageSpamScore(messageId: string): Promise<SpamScoreResponse>;

Defined in: sdk/src/client.ts:1215

Get the persisted spam score for a sent message (cached from when it was scored). 404 if not yet scored.

ParameterType
messageIdstring

Promise<SpamScoreResponse>


getTemplateSpamScore(templateId: string, versionId?: string): Promise<SpamScoreResponse>;

Defined in: sdk/src/client.ts:1222

Get the persisted spam score for a template version. 404 if not yet scored.

ParameterType
templateIdstring
versionId?string

Promise<SpamScoreResponse>


getDeliverabilityStatus(): Promise<DeliverabilityStatusResponse>;

Defined in: sdk/src/client.ts:1236

Snapshot of which deliverability signal sources are wired up (PMT, SNDS, sender IPs, inbound DMARC).

Promise<DeliverabilityStatusResponse>


connectPmt(params?: PmtConnectParams): Promise<PmtConnectResponse>;

Defined in: sdk/src/client.ts:1244

Start the Gmail Postmaster Tools OAuth flow. Returns an authorizationUrl for the user to visit.

ParameterType
params?PmtConnectParams

Promise<PmtConnectResponse>


getPmtConnection(): Promise<PmtCredentialsResponse>;

Defined in: sdk/src/client.ts:1255

Get the current Gmail PMT connection status (connected email, scopes, expiry).

Promise<PmtCredentialsResponse>


disconnectPmt(): Promise<{
disconnected: true;
}>;

Defined in: sdk/src/client.ts:1262

Revoke the PMT OAuth grant.

Promise<{ disconnected: true; }>


listSndsKeys(): Promise<SndsKeyResponse[]>;

Defined in: sdk/src/client.ts:1269

List Outlook SNDS access keys configured for inbound reputation signals.

Promise<SndsKeyResponse[]>


addSndsKey(params: AddSndsKeyParams): Promise<SndsKeyResponse>;

Defined in: sdk/src/client.ts:1281

Add an Outlook SNDS access key. Optail polls SNDS daily and surfaces complaint-rate signals.

ParameterType
paramsAddSndsKeyParams

Promise<SndsKeyResponse>


deleteSndsKey(keyId: string): Promise<{
deleted: true;
}>;

Defined in: sdk/src/client.ts:1288

Delete an SNDS key.

ParameterType
keyIdstring

Promise<{ deleted: true; }>


listSenderIps(): Promise<SenderIpResponse[]>;

Defined in: sdk/src/client.ts:1295

List sending IP addresses registered for SNDS lookups.

Promise<SenderIpResponse[]>


addSenderIp(params: AddSenderIpParams): Promise<SenderIpResponse>;

Defined in: sdk/src/client.ts:1306

Register a sender IP to monitor via SNDS.

ParameterType
paramsAddSenderIpParams

Promise<SenderIpResponse>


deleteSenderIp(senderIpId: string): Promise<{
deleted: true;
}>;

Defined in: sdk/src/client.ts:1313

Stop monitoring a sender IP.

ParameterType
senderIpIdstring

Promise<{ deleted: true; }>


getDmarcRuaUrl(): Promise<DmarcRuaResponse>;

Defined in: sdk/src/client.ts:1324

Get the inbound DMARC RUA endpoint URL for your organization. Configure in your DMARC DNS record (rua=mailto:...).

Promise<DmarcRuaResponse>


listTestInboxes(): Promise<{
inboxDomain: string;
tokens: TestInboxTokenResponse[];
}>;

Defined in: sdk/src/client.ts:1331

List authenticated test-inbox tokens — durable addresses for end-to-end inbox tests.

Promise<{ inboxDomain: string; tokens: TestInboxTokenResponse[]; }>


createTestInbox(params: CreateTestInboxParams): Promise<TestInboxTokenResponse>;

Defined in: sdk/src/client.ts:1342

Create a durable test inbox. Returns an address you can send to + a token to poll for received messages.

ParameterType
paramsCreateTestInboxParams

Promise<TestInboxTokenResponse>


deleteTestInbox(tokenId: string): Promise<{
deleted: true;
}>;

Defined in: sdk/src/client.ts:1353

Delete a test inbox token.

ParameterType
tokenIdstring

Promise<{ deleted: true; }>


listInboxRuns(params?: {
token?: string;
limit?: number;
}): Promise<{
runs: InboxRunSummary[];
}>;

Defined in: sdk/src/client.ts:1363

List recently received messages on test inboxes. Filter by token.

ParameterType
params?{ token?: string; limit?: number; }
params.token?string
params.limit?number

Promise<{ runs: InboxRunSummary[]; }>


getInboxRun(runId: string): Promise<InboxRunDetail>;

Defined in: sdk/src/client.ts:1378

Get full details of a received message: headers, body, TLS, spam score, layer-1 / layer-2 analysis.

ParameterType
runIdstring

Promise<InboxRunDetail>


shareInboxRun(runId: string, visible: boolean): Promise<ShareInboxRunResponse>;

Defined in: sdk/src/client.ts:1386

Toggle public-share visibility for an inbox run. Public URL allows sharing the score without auth.

ParameterType
runIdstring
visibleboolean

Promise<ShareInboxRunResponse>


listBrandDomains(): Promise<BrandDomainResponse[]>;

Defined in: sdk/src/client.ts:1397

List brand domains used by the inbox visual-similarity engine.

Promise<BrandDomainResponse[]>


addBrandDomain(params: AddBrandDomainParams): Promise<BrandDomainResponse>;

Defined in: sdk/src/client.ts:1408

Register a brand domain so the inbox engine can detect spoofs.

ParameterType
paramsAddBrandDomainParams

Promise<BrandDomainResponse>


deleteBrandDomain(brandDomainId: string): Promise<{
deleted: true;
}>;

Defined in: sdk/src/client.ts:1415

Delete a brand domain.

ParameterType
brandDomainIdstring

Promise<{ deleted: true; }>


listBrandTemplates(): Promise<BrandTemplateResponse[]>;

Defined in: sdk/src/client.ts:1425

List brand template fingerprints (visual hashes of your trusted templates).

Promise<BrandTemplateResponse[]>


addBrandTemplate(params: AddBrandTemplateParams): Promise<BrandTemplateResponse>;

Defined in: sdk/src/client.ts:1437

Register a brand template fingerprint. Used by the inbox engine to detect look-alike phishing.

ParameterType
paramsAddBrandTemplateParams

Promise<BrandTemplateResponse>


deleteBrandTemplate(brandTemplateId: string): Promise<{
deleted: true;
}>;

Defined in: sdk/src/client.ts:1448

Delete a brand template fingerprint.

ParameterType
brandTemplateIdstring

Promise<{ deleted: true; }>