### Install the PostStack Go SDK Source: https://poststack.dev/docs/send-with-go Use the go get command to add the SDK to your project. ```bash go get github.com/getpoststack/go-sdk ``` -------------------------------- ### Install PostStack SDK and Hono Source: https://poststack.dev/docs/send-with-hono Install the necessary dependencies using your package manager. ```bash bun add @poststack.dev/sdk hono ``` -------------------------------- ### Install PostStack SDK and Express Source: https://poststack.dev/docs/send-with-express Install the necessary dependencies for the PostStack SDK and Express framework. ```bash npm install @poststack.dev/sdk express ``` -------------------------------- ### Install PostStack SDK Source: https://poststack.dev/docs/send-with-nextjs Install the required package using npm. ```bash npm install @poststack.dev/sdk ``` -------------------------------- ### Install PostStack SDK Source: https://poststack.dev/docs/send-with-django Install the required package via pip. ```bash pip install poststack ``` -------------------------------- ### Install the PostStack SDK Source: https://poststack.dev/docs Use your preferred package manager to add the PostStack SDK to your project. ```bash bun add @poststack.dev/sdk ``` ```bash npm install @poststack.dev/sdk ``` ```bash pnpm add @poststack.dev/sdk ``` -------------------------------- ### GET /templates Source: https://poststack.dev/docs/templates List all templates with pagination. ```APIDOC ## GET /templates ### Description List all templates with pagination. ### Method GET ### Endpoint /templates ### Response #### Success Response (200) - **data** (array) - List of template objects - **meta** (object) - Pagination metadata #### Response Example { "data": [ { "id": "tpl_abc123def456ghi789", "name": "Welcome Email", "status": "published", "created_at": "2026-03-23T10:00:00.000Z", "updated_at": "2026-03-23T12:00:00.000Z" } ], "meta": { "page": 1, "perPage": 20, "total": 12, "totalPages": 1 } } ``` -------------------------------- ### GET /workflows Source: https://poststack.dev/docs/workflows List all workflows. ```APIDOC ## GET /workflows ### Description List all workflows with their status and trigger type. ### Method GET ### Endpoint /workflows ### Response #### Success Response (200) - **data** (array) - List of workflow objects #### Response Example { "data": [ { "id": "wf_abc123def456ghi789", "name": "Welcome Sequence", "trigger_type": "contact.created", "status": "active", "created_at": "2026-03-23T10:00:00.000Z" } ] } ``` -------------------------------- ### Install PostStack SDK with Bun Source: https://poststack.dev/docs/send-with-bun Add the PostStack SDK to your project using the Bun package manager. ```bash bun add @poststack.dev/sdk ``` -------------------------------- ### GET /templates/presets Source: https://poststack.dev/docs/templates List available template presets from the gallery. ```APIDOC ## GET /templates/presets ### Description List available template presets from the gallery. Presets are pre-built templates you can use as a starting point. ### Method GET ### Endpoint /templates/presets ### Response #### Success Response (200) - **data** (array) - List of preset objects #### Response Example { "data": [ { "id": 1, "name": "Welcome Email", "description": "A clean welcome email with logo and CTA", "subject": "Welcome!", "html": "
Welcome!
', }); console.log('Email sent:', id); ``` -------------------------------- ### Add a new domain Source: https://poststack.dev/docs/domains Create a new domain configuration. Returns the necessary DNS records for setup. ```json { "name": "yourdomain.com", "region": "eu-west-1", "custom_return_path": "bounce.yourdomain.com", "open_tracking": true, "click_tracking": true, "tls_mode": "enforced" } ``` -------------------------------- ### Install Req dependency Source: https://poststack.dev/docs/send-with-elixir Add the Req library to your mix.exs file to enable HTTP requests. ```bash # mix.exs {:req, "~> 0.5"} ``` -------------------------------- ### Get a signup form by ID Source: https://poststack.dev/docs/signup-forms Retrieves the full configuration and metadata for a specific signup form. ```json { "id": 1, "public_id": "sf_abc123def456", "name": "Newsletter Signup", "segment_id": "seg_abc123def456", "topic_id": "top_xyz789ghi012", "fields": [ { "name": "email", "type": "email", "label": "Email Address", "required": true } ], "success_message": "Thanks for subscribing!", "redirect_url": "https://example.com/welcome", "active": true, "submission_count": 142, "created_at": "2026-03-20T10:00:00.000Z", "updated_at": "2026-03-20T10:00:00.000Z" } ``` -------------------------------- ### GET /webhooks Source: https://poststack.dev/docs/webhooks List all webhook endpoints for your account. ```APIDOC ## GET /webhooks ### Description List all webhook endpoints for your account. ### Method GET ### Endpoint /webhooks ### Response #### Success Response (200) - **webhooks** (array) - List of webhook configurations. ``` -------------------------------- ### GET /subscription-topics Source: https://poststack.dev/docs/subscription-topics List all subscription topics. ```APIDOC ## GET /subscription-topics ### Description List all subscription topics. ### Method GET ### Endpoint /subscription-topics ### Response #### Success Response (200) - **topics** (array) - List of subscription topics. ``` -------------------------------- ### POST /templates Source: https://poststack.dev/docs/templates Create a new email template. Templates start in draft status. ```APIDOC ## POST /templates ### Description Create a new email template. Templates start in draft status. ### Method POST ### Endpoint /templates ### Request Body - **name** (string) - Required - The name of the template - **subject** (string) - Required - The email subject line with optional {{variable}} placeholders - **html** (string) - Required - The HTML content of the template - **text** (string) - Required - The plain text content of the template - **variables** (array) - Required - A list of variable names used in the template ### Request Example { "name": "Welcome Email", "subject": "Welcome to {{company_name}}, {{first_name}}!", "html": "Welcome to {{company_name}}.
", "text": "Hello {{first_name}}, Welcome to {{company_name}}.", "variables": ["first_name", "company_name"] } ``` -------------------------------- ### Install PostStack dependencies Source: https://poststack.dev/docs/send-with-rust Add the required dependencies to your Cargo.toml file to enable JSON support and async operations. ```toml # Cargo.toml [dependencies] reqwest = { version = "0.12", features = ["json"] } serde_json = "1" tokio = { version = "1", features = ["full"] } ``` -------------------------------- ### GET /domains Source: https://poststack.dev/docs/domains List all domains associated with your account along with their current verification status. ```APIDOC ## GET /domains ### Description List all domains for your account with their verification status. ### Method GET ### Endpoint /domains ### Response #### Success Response (200) - **domains** (array) - List of domain objects. ``` -------------------------------- ### GET /signup-forms/:id Source: https://poststack.dev/docs/signup-forms Retrieve a specific signup form by its ID, including field configurations. ```APIDOC ## GET /signup-forms/:id ### Description Get a signup form by ID, including its full field configuration. ### Method GET ### Endpoint /signup-forms/:id ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the signup form ``` -------------------------------- ### Frontend form submission integration Source: https://poststack.dev/docs/signup-forms Example of how to submit form data from a client-side application using the Fetch API. ```typescript async function submitForm(formId: string, email: string) { const response = await fetch( `https://api.poststack.dev/signup-forms/${formId}/submit`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email }), }, ); return response.json(); } ``` -------------------------------- ### PHP cURL Security and Performance Source: https://poststack.dev/docs/send-with-php Examples of common cURL configuration pitfalls regarding SSL verification and handle reuse. ```php CURLOPT_SSL_VERIFYPEER => false ``` ```php curl_init ``` ```php curl_setopt ``` -------------------------------- ### List Received Inbound Emails Response Source: https://poststack.dev/docs/inbound-email Example JSON response for the GET /inbound endpoint. ```json { "data": [ { "id": 7, "domainId": 12, "fromAddress": "sender@external.com", "fromName": "Jane Sender", "toAddress": "support+invoice-42@yourdomain.com", "toAddresses": [{ "address": "support+invoice-42@yourdomain.com", "name": null }], "ccAddresses": [{ "address": "colleague@external.com", "name": "A Colleague" }], "messageId": "Hi, I need help resetting my password...
", "textBody": "Hi, I need help resetting my password...", "headers": { "date": "Mon, 23 Mar 2026 10:00:00 +0000" }, "createdAt": "2026-03-23T10:00:00.000Z", "mailboxHash": "invoice-42", "spamScore": 1.8, "spamVerdict": "clean", "strippedReply": "Thanks, that worked!" } ], "meta": { "page": 1, "perPage": 20, "total": 48, "totalPages": 3 } } ``` -------------------------------- ### Initialize the PostStack client Source: https://poststack.dev/docs/send-with-go Import the package and instantiate the client using your live secret key. ```go import ( "context" poststack "github.com/getpoststack/go-sdk" ) client := poststack.NewClient("sk_live_...") ``` -------------------------------- ### GET /templates/:id Source: https://poststack.dev/docs/templates Retrieve a single template including its full HTML content and variable list. ```APIDOC ## GET /templates/:id ### Description Retrieve a single template including its full HTML content and variable list. ### Method GET ### Endpoint /templates/:id ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the template ### Response #### Success Response (200) - **template** (object) - The template details #### Response Example { "template": { "id": "tpl_abc123def456ghi789", "name": "Welcome Email", "subject": "Welcome to {{company_name}}, {{first_name}}!", "html": "Welcome to {{company_name}}.
", "text": "Hello {{first_name}}, Welcome to {{company_name}}.", "status": "published", "variables": ["first_name", "company_name"], "created_at": "2026-03-23T10:00:00.000Z", "updated_at": "2026-03-23T12:00:00.000Z" } } ``` -------------------------------- ### Initialize PostStack with Test API Key Source: https://poststack.dev/docs/test-mode Use an API key starting with 'sk_test_' to ensure no emails are delivered while still receiving simulated event IDs. ```typescript import { PostStack } from '@poststack.dev/sdk'; // Use a test key -- no real emails will be sent const poststack = new PostStack('sk_test_...'); // This email is validated and queued, but never delivered const { id } = await poststack.emails.send({ from: 'you@yourdomain.com', to: ['user@example.com'], subject: 'Test Email', html: 'This is a test.
', }); // id is still returned, and events are simulated ``` -------------------------------- ### List Inbound Email Attachments Response Source: https://poststack.dev/docs/inbound-email Example JSON response for the GET /inbound/:id/attachments endpoint. ```json { "attachments": [ { "id": 1, "filename": "screenshot.png", "contentType": "image/png", "size": 24576, "createdAt": "2026-03-23T10:00:00.000Z" } ] } ``` -------------------------------- ### Retrieve Single Inbound Email Response Source: https://poststack.dev/docs/inbound-email Example JSON response for the GET /inbound/:id endpoint. ```json { "inboundEmail": { "id": 7, "domainId": 12, "fromAddress": "sender@external.com", "fromName": "Jane Sender", "toAddress": "support@yourdomain.com", "toAddresses": [{ "address": "support@yourdomain.com", "name": null }], "ccAddresses": [{ "address": "colleague@external.com", "name": "A Colleague" }], "messageId": "Hi, I need help resetting my password...
", "textBody": "Hi, I need help resetting my password...", "headers": { "date": "Mon, 23 Mar 2026 10:00:00 +0000" }, "createdAt": "2026-03-23T10:00:00.000Z", "mailboxHash": null, "spamScore": 1.8, "spamVerdict": "clean", "strippedReply": "Hi, I need help resetting my password..." } } ``` -------------------------------- ### Example Email Event Payload Source: https://poststack.dev/docs/tracking Shows the structure of an email event payload containing client, OS, and location data. ```json { "type": "email.opened", "timestamp": "2026-03-23T10:01:15.000Z", "data": { "email_id": "em_abc123def456ghi789", "client": { "name": "Apple Mail", "type": "desktop", "os": "macOS" }, "location": { "country": "US", "region": "California", "city": "San Francisco" } } } ``` -------------------------------- ### Initialize PostStack and Hono Source: https://poststack.dev/docs/send-with-hono Set up the PostStack client and Hono application instance. ```typescript import { PostStack } from '@poststack.dev/sdk'; import { Hono } from 'hono'; const poststack = new PostStack(process.env.POSTSTACK_API_KEY!); const app = new Hono(); ``` -------------------------------- ### GET /emails/:id/insights Source: https://poststack.dev/docs/emails Get delivery insights and warnings for an email. ```APIDOC ## GET /emails/:id/insights ### Description Get delivery insights and warnings for an email, such as missing authentication records or content issues. ### Method GET ### Endpoint /emails/:id/insights ### Parameters #### Path Parameters - **id** (string) - Required - The email ID ### Response #### Success Response (200) - **warnings** (array) - List of warning objects ### Response Example { "warnings": [ { "type": "missing_dkim", "message": "DKIM record not found for this domain", "severity": "high" }, { "type": "large_html", "message": "HTML content exceeds 100KB which may cause clipping", "severity": "low" } ] } ``` -------------------------------- ### Initialize the PostStack client Source: https://poststack.dev/docs/send-with-java Sets up the standard Java HttpClient and retrieves the API key from environment variables. ```java import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.URI; HttpClient client = HttpClient.newHttpClient(); String apiKey = System.getenv("POSTSTACK_API_KEY"); ``` -------------------------------- ### GET /broadcasts/:id/variant-stats Source: https://poststack.dev/docs/broadcasts Get performance statistics for A/B test variants. ```APIDOC ## GET /broadcasts/:id/variant-stats ### Description Get performance statistics for A/B test variants, including which variant won. ### Method GET ### Endpoint /broadcasts/:id/variant-stats ### Parameters #### Path Parameters - **id** (string) - Required - The broadcast ID ``` -------------------------------- ### Configure Django SMTP Backend for PostStack Source: https://poststack.dev/docs/send-with-django Configures Django's built-in email backend to use PostStack SMTP. Includes examples for standard email, HTML alternatives, and file attachments. ```python # settings.py — route Django's built-in email through PostStack over SMTP import os EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend" EMAIL_HOST = "smtp.poststack.dev" EMAIL_PORT = 587 EMAIL_USE_SSL = True # implicit TLS on 587 (RFC 8314) — do NOT also set EMAIL_USE_TLS EMAIL_HOST_USER = "poststack" EMAIL_HOST_PASSWORD = os.environ["POSTSTACK_API_KEY"] DEFAULT_FROM_EMAIL = "hello@yourdomain.com" # 1. send_mail — the one-liner from django.core.mail import send_mail send_mail( "Welcome to Acme", "Thanks for signing up.", None, # None uses DEFAULT_FROM_EMAIL ["user@example.com"], ) # 2. EmailMultiAlternatives — HTML with a plain-text fallback from django.core.mail import EmailMultiAlternatives msg = EmailMultiAlternatives( subject="Welcome", body="Thanks for signing up.", # text/plain part to=["user@example.com"], ) msg.attach_alternative("Here's what happened...
", "segmentId": 1, "totalRecipients": 1250, "deliveredCount": 1230, "bouncedCount": 12, "openedCount": 456, "clickedCount": 89, "sentAt": "2026-03-25T09:00:00.000Z", "createdAt": "2026-03-23T10:00:00.000Z" } } ``` -------------------------------- ### GET /segments/:id Source: https://poststack.dev/docs/segments Retrieve a single segment with its rules (if dynamic) and contact count. ```APIDOC ## GET /segments/:id ### Description Retrieve a single segment with its rules (if dynamic) and contact count. ### Method GET ### Endpoint /segments/:id ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the segment. ``` -------------------------------- ### Initialize PostStack client in Flask Source: https://poststack.dev/docs/send-with-flask Store the PostStack client in app.extensions within the app factory to make it accessible via current_app. ```python # app.py — initialise the client once in your app factory import os from flask import Flask from poststack import PostStack def create_app(): app = Flask(__name__) # Store the client on app.extensions so views can reach it via current_app app.extensions["poststack"] = PostStack(api_key=os.environ["POSTSTACK_API_KEY"]) return app ``` -------------------------------- ### Enable Catch-All for a Domain Source: https://poststack.dev/docs/domains Configures a domain to accept emails sent to any address, regardless of whether a mailbox exists. ```typescript await poststack.domains.update('dom_abc123def456', { catch_all: true, }); ``` -------------------------------- ### Generate Claude Desktop Configuration Source: https://poststack.dev/docs/mcp Command to automatically generate the required configuration snippet for Claude Desktop. ```bash npx @poststack.dev/mcp --print-config claude-desktop ``` -------------------------------- ### Initialize PostStack SDK Source: https://poststack.dev/docs/authentication Pass the API key during client initialization when using the TypeScript SDK. ```typescript import { PostStack } from '@poststack.dev/sdk'; const poststack = new PostStack('sk_live_...'); ``` -------------------------------- ### Publish Template Source: https://poststack.dev/docs/templates Response after successfully publishing a draft template. ```json { "template": { "id": "tpl_abc123def456ghi789", "status": "published", "published_at": "2026-03-23T15:00:00.000Z" } } ``` -------------------------------- ### GET /emails/:id Source: https://poststack.dev/docs/emails Retrieve a single email by ID, including delivery events and metadata. ```APIDOC ## GET /emails/:id ### Description Retrieve a single email by ID, including delivery events and metadata. ### Method GET ### Endpoint /emails/:id ### Parameters #### Path Parameters - **id** (string) - Required - The email ID ### Response #### Success Response (200) - **email** (object) - Email details ### Response Example { "email": { "id": "em_abc123def456ghi789", "from": "PostStackWelcome aboard.
", "text": "Hello! Welcome aboard.", "tags": ["welcome"], "created_at": "2026-03-23T10:00:00.000Z", "sent_at": "2026-03-23T10:00:01.000Z", "delivered_at": "2026-03-23T10:00:02.000Z" } } ``` -------------------------------- ### POST /subscription-topics Source: https://poststack.dev/docs/subscription-topics Create a new subscription topic. ```APIDOC ## POST /subscription-topics ### Description Create a new subscription topic. ### Method POST ### Endpoint /subscription-topics ### Request Body - **name** (string) - Required - The name of the topic. - **description** (string) - Required - A description of the topic. ### Request Example { "name": "Product Updates", "description": "New features, improvements, and release notes" } ``` -------------------------------- ### Configure Claude Desktop for MCP Source: https://poststack.dev/docs/mcp JSON configuration for the Claude Desktop application to enable the PostStack MCP server. ```json { "mcpServers": { "poststack": { "command": "npx", "args": ["-y", "@poststack.dev/mcp"], "env": { "POSTSTACK_API_KEY": "sk_live_..." } } } } ``` -------------------------------- ### GET /domains/:id/dmarc/reports Source: https://poststack.dev/docs/domains List aggregated DMARC reports for a specific domain with pagination support. ```APIDOC ## GET /domains/:id/dmarc/reports ### Description List aggregated DMARC reports for a domain with pagination. ### Method GET ### Endpoint /domains/:id/dmarc/reports ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the domain. ### Response #### Success Response (200) - **reports** (array) - List of DMARC report summaries. - **pagination** (object) - Pagination metadata including page, perPage, total, and totalPages. #### Response Example { "reports": [ { "id": 1, "org_name": "google.com", "date_range_begin": "2026-03-22T00:00:00.000Z", "date_range_end": "2026-03-23T00:00:00.000Z", "total_count": 1250, "pass_count": 1248, "fail_count": 2 } ], "pagination": { "page": 1, "perPage": 20, "total": 15, "totalPages": 1 } } ``` -------------------------------- ### GET /contacts/:id Source: https://poststack.dev/docs/contacts Retrieve a single contact by ID, including all properties and subscription status. ```APIDOC ## GET /contacts/:id ### Description Retrieve a single contact by ID, including all properties and subscription status. ### Method GET ### Endpoint /contacts/:id ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the contact. ### Response #### Success Response (200) - **contact** (object) - The contact details including properties, subscription status, and timestamps. ### Response Example { "contact": { "id": "con_abc123def456ghi789", "email": "alice@example.com", "first_name": "Alice", "last_name": "Smith", "properties": { "plan": "pro", "signed_up": "2026-01-15" }, "unsubscribed": false, "created_at": "2026-03-23T10:00:00.000Z", "updated_at": "2026-03-23T12:00:00.000Z" } } ``` -------------------------------- ### Create a new signup form Source: https://poststack.dev/docs/signup-forms Defines the structure for a new signup form, including field configurations and post-submission behavior. ```json { "name": "Newsletter Signup", "segment_id": "seg_abc123def456", "topic_id": "top_xyz789ghi012", "fields": [ { "name": "email", "type": "email", "label": "Email Address", "required": true, "placeholder": "you@example.com" }, { "name": "first_name", "type": "text", "label": "First Name", "required": false, "placeholder": "Jane" } ], "success_message": "Thanks for subscribing!", "redirect_url": "https://example.com/welcome" } ``` -------------------------------- ### GET /contacts Source: https://poststack.dev/docs/contacts List contacts with pagination. Supports search by email or name, and filtering by segment. ```APIDOC ## GET /contacts ### Description List contacts with pagination. Supports search by email or name, and filtering by segment. ### Method GET ### Endpoint /contacts ### Response #### Success Response (200) - **data** (array) - List of contact objects. - **meta** (object) - Pagination metadata including page, perPage, total, and totalPages. ### Response Example { "data": [ { "id": "con_abc123def456ghi789", "email": "alice@example.com", "first_name": "Alice", "last_name": "Smith", "unsubscribed": false, "created_at": "2026-03-23T10:00:00.000Z" } ], "meta": { "page": 1, "perPage": 20, "total": 1250, "totalPages": 63 } } ``` -------------------------------- ### Signup Forms Source: https://poststack.dev/docs/sdk Methods for creating and submitting signup forms. ```APIDOC ## poststack.signupForms.create(params) Creates a new signup form. ## poststack.signupForms.submit(formId, params) Submits data to a signup form. ``` -------------------------------- ### List Mailboxes API Response Source: https://poststack.dev/docs/mailboxes Example response containing a list of mailboxes with pagination metadata. ```json { "data": [ { "id": 1, "emailAddress": "support@yourdomain.com", "displayName": "Support Team", "quotaBytes": 1073741824, "status": "active", "webhookEnabled": true, "lastLoginAt": "2026-03-28T15:30:00.000Z", "createdAt": "2026-03-28T12:00:00.000Z", "domain": { "id": 1, "name": "yourdomain.com" } } ], "meta": { "page": 1, "perPage": 50, "total": 1, "totalPages": 1 } } ``` -------------------------------- ### Create a Subscription Topic Source: https://poststack.dev/docs/subscription-topics Define a new category for email subscriptions by providing a name and description. ```json { "name": "Product Updates", "description": "New features, improvements, and release notes" } ``` -------------------------------- ### Dynamic segment rule structure Source: https://poststack.dev/docs/segments Example of the rule object structure used for dynamic segments. ```json { "rules": { "operator": "and", "conditions": [ { "field": "plan", "comparator": "equals", "value": "pro" }, { "field": "email", "comparator": "contains", "value": "@company.com" } ] } } ```