Wraps Logo
DocsHome
Reference

API Reference

OpenAPI reference for the Wraps Platform API. Browse endpoints, auth, and the interactive spec.

Interactive API Explorer

Try endpoints directly in your browser with the OpenAPI spec.

Base URL

All API requests are made to:

Authentication

Authenticate using a Bearer token in the Authorization header. Two methods are supported:

API Key

Prefixed with wraps_. Best for server-to-server and SDK usage.

Create keys in the dashboard under Settings > API Keys.

Session Token

better-auth session token. Used by the dashboard and browser-based clients.

Endpoints

The API is organized into endpoint groups. See the interactive docs for full request/response schemas.

HealthPublic

Health check and API info

GET
Contacts

Create, update, delete, and list contacts

GETPOSTPATCHPUTDELETE
Batch

Batch email sending for broadcasts

POSTGETDELETE
Events

Custom event ingestion for triggering workflows

POST
Workflows

API-triggered workflow execution

POST
Connections

AWS account connection management

GETPOSTDELETE
WebhooksPublic

Receive SES delivery events

POST
UnsubscribePublic

RFC 8058 one-click unsubscribe

GETPOST
ToolsPublic

Free email deliverability tools

GETPOST

Workflows

Trigger, manage, and control workflow executions via the API. Workflows must have triggerType: "api" and be enabled.

Trigger Workflow

POST/v1/workflows/:workflowId/trigger

Triggers a workflow for a single contact. Identify the contact by ID or email. Arbitrary data can be passed through to the workflow.

FieldTypeDescription
contactIdstringContact UUID (provide this or contactEmail)
contactEmailstringContact email (alternative to contactId)
dataobjectArbitrary data passed to the workflow

Batch Trigger Workflow

POST/v1/workflows/:workflowId/trigger/batch

Trigger a workflow for multiple contacts in one request. Per-contact data is merged with common data. Duplicate contacts are automatically deduplicated.

FieldTypeDescription
contactsarrayArray of { contactId?, contactEmail?, data? }
dataobjectCommon data merged into every trigger

Retry Failed Execution

POST/v1/workflows/executions/:executionId/retry

Retries a failed workflow execution from the step where it failed. Previously completed steps are preserved. Only executions with status failed can be retried.

Cancel Execution

POST/v1/workflows/executions/:executionId/cancel

Cancels an active workflow execution. Cleans up any pending schedulers and adjusts workflow stats.

Batch Sending

The GET /v1/batch/:id endpoint returns the full batch status including progress tracking fields:

FieldTypeDescription
idstringBatch ID
statusstringqueued, scheduled, processing, completed, failed, or cancelled
channelstringemail or sms
namestring | nullBatch name
totalRecipientsnumberTotal targeted recipients
processedRecipientsnumberRecipients processed so far
sentnumberSuccessfully sent count
failednumberFailed send count
startedAtstring | nullISO 8601 timestamp when processing began
completedAtstring | nullISO 8601 timestamp when processing finished
createdAtstringISO 8601 creation timestamp

Use DELETE /v1/batch/:id to cancel a batch in scheduled, queued, or processing status.

Contact Topics: PATCH vs PUT

Topic subscriptions support two update strategies with different semantics:

PATCH /v1/contacts/:id

Adds topics to existing subscriptions. No topics are removed. Safe for incremental updates from multiple sources.

PUT /v1/contacts/:id/topics

Replaces all subscriptions. Topics not in the new list are unsubscribed. Triggers workflow events for both additions and removals.

Both endpoints accept topicIds (UUIDs) and topicSlugs (human-readable slugs). Topics with double opt-in enabled will send a confirmation email unless the contact was previously confirmed.

SDK Usage

The @wraps.dev/client SDK provides a typed wrapper around the API.

OpenAPI Spec

The full OpenAPI 3.0.3 specification is auto-generated from route definitions. Use it with any OpenAPI-compatible tool.

Interactive Docs

Browse and test endpoints in the Swagger UI.

Open Swagger UI
JSON Spec

Import into Postman, Insomnia, Scalar, or any OpenAPI tool.

Download OpenAPI JSON

Next Steps

Rate Limits

Per-minute and daily limits by plan.

View Rate Limits
Error Codes

Complete reference for CLI and SDK error codes.

View Error Codes
Platform SDK

Typed TypeScript wrapper for the API.

View SDK Reference
Environment Variables

All env vars for CLI, SDKs, and CI/CD.

View Env Vars