# Sendway API # For the full version with examples, see: https://sendway.ai/llms-full.txt > Sendway is an AI-powered email marketing platform with a REST API for managing contacts, lists, automation flows, campaigns, tags, webhooks, and sending emails. > NOTE: Do NOT fetch /docs — it is a React SPA. Use this file or /llms-full.txt for API documentation. ## API Base URL https://szwwcqeletigqclkuvjx.supabase.co/functions/v1/sendway-api ## Authentication All requests require an `x-api-key` header. Create API keys in the Sendway dashboard under Settings → Integrations. ## Permissions - `contacts:read` - Read and search contacts - `contacts:write` - Create, update, delete contacts - `lists:read` - View lists and members - `lists:write` - Create, update, delete lists and manage members - `flows:read` - View automation flows - `flows:write` - Activate, pause, trigger flows - `campaigns:read` - View campaigns - `analytics:read` - Access campaign analytics - `email:send` - Send emails directly - `tags:write` - Add and remove tags on contacts - `webhooks:read` - View registered webhooks - `webhooks:write` - Create, update, delete webhooks ## Endpoints ### Account Discovery - `GET /account` - Get business profile and settings (company name, industry, brand tone, colors, target audience, sending config, social links) - `GET /account/summary` - Full account overview in one call: business settings, stats (contacts/lists/campaigns/flows counts), recent campaigns, all lists, all flows, all tags ### Contacts - `GET /contacts` - List contacts (params: page, limit, search) - `GET /contacts/:id` - Get contact by ID - `POST /contacts` - Create or update contacts (single or array, matched by email) - `PUT /contacts/:id` - Update contact - `DELETE /contacts/:id` - Delete contact Contact fields: email (required), first_name, last_name, company, tags (string[]), source ### Lists - `GET /lists` - List all lists with member counts - `GET /lists/:id` - Get list details - `POST /lists` - Create list (fields: name, description) - `PUT /lists/:id` - Update list - `DELETE /lists/:id` - Delete list - `GET /lists/:id/members` - List members (params: page, limit) - `POST /lists/:id/members` - Add contacts to list (triggers list_joined automation flows) - `DELETE /lists/:id/members?contact_id=ID` - Remove contact from list ### Campaigns - `GET /campaigns` - List campaigns (params: status, page, limit) - `GET /campaigns/:id` - Get campaign details including full email content (blocks + HTML) - `GET /campaigns/:id/analytics` - Get analytics: total_recipients, sent, delivered, opened, clicked, bounced, complained, hard_bounces, soft_bounces, bot_clicks_filtered, rates (delivery_rate, open_rate, click_rate, bounce_rate, complaint_rate) ### Automation Flows - `GET /flows` - List all flows - `GET /flows/:id` - Get flow details with enrollment stats - `POST /flows` - Create a new flow (body: name, description, trigger_type, trigger_config, nodes, edges, audience_type, audience_id, goal_condition, enroll_existing) - `PUT /flows/:id` - Update a flow (same fields as create, all optional) - `DELETE /flows/:id` - Delete a flow - `POST /flows/:id/activate` - Activate a flow - `POST /flows/:id/pause` - Pause a flow - `POST /flows/:id/trigger` - Enroll a contact (body: contact_id or email) Node types: trigger, email, delay, condition, goal Trigger types: contact_added, list_joined, tag_added, manual Node structure: { id, type, position, label, subject?, content?, delayDays?, delayHours?, conditionType?, conditionValue?, yesNodeId?, noNodeId?, goalCondition?, goalConditionValue? } Condition types: has_tag, not_has_tag, opened, not_opened, clicked, not_clicked, has_company, source_equals Goal exit conditions: has_tag, email_opened, email_clicked ### Tags - `GET /tags` - List all unique tags - `POST /tags/add` - Add tags to contacts (body: tags[], contact_ids[] or emails[] or filter:"all") - `POST /tags/remove` - Remove tags from contacts (same body format) ### Webhooks - `GET /webhooks` - List registered webhooks - `GET /webhooks/:id` - Get webhook details - `POST /webhooks` - Register webhook (body: url, events[]) - returns signing secret (shown once) - `PUT /webhooks/:id` - Update webhook (url, events, active) - `DELETE /webhooks/:id` - Delete webhook Webhook events: contact.created, contact.updated, contact.deleted, email.sent, email.delivered, email.opened, email.clicked, email.bounced, email.complained, flow.enrolled, flow.completed, list.member_added ### Direct Email - `POST /email` - Send email (body: to, subject, html, from_name, from_email) ## Example: Client Onboarding ```javascript const API_KEY = "sw_live_..."; const BASE = "https://szwwcqeletigqclkuvjx.supabase.co/functions/v1/sendway-api"; // Step 1: Add contact await fetch(`${BASE}/contacts`, { method: "POST", headers: { "x-api-key": API_KEY, "Content-Type": "application/json" }, body: JSON.stringify({ email: "new@client.com", first_name: "Jan", tags: ["new-client"] }) }); // Step 2: Trigger welcome flow await fetch(`${BASE}/flows/FLOW_ID/trigger`, { method: "POST", headers: { "x-api-key": API_KEY, "Content-Type": "application/json" }, body: JSON.stringify({ email: "new@client.com" }) }); ``` ## Links - Documentation: https://sendway.ai/docs - API Key Management: https://sendway.ai/settings/integrations - Website: https://sendway.ai