← Back to Postcard API Hub
    REST API v2 • https://api.thanks.io/api/v2
    Free Developer Test Mode Sandbox
    OAuth 2.0 & X-Subaccount-Id Multi-Tenant Ready

    Direct Mail API Developer Guide & Architecture Blueprints

    Programmatically dispatch 4×6, 6×9 & 6×11 postcards, windowed & windowless letters, custom PDF documents, folded notecards, $5–$100 gift cards, and 6×9 MagnaCards from your CRM or backend with 1-piece minimums, proprietary AI handwriting-style fonts, and real-time QR scan webhooks.

    Direct Answer — Direct Mail REST API v2

    A Direct Mail API allows developers to programmatically send personalized physical postcards, windowed or windowless letters, folded notecards, and gift cards from any CRM or backend via REST endpoints (https://api.thanks.io/api/v2), featuring a free Test Mode sandbox, CASS address validation, and real-time QR scan webhooks.

    Base Endpoint & Authentication
    TLS 1.3 • JSON
    Base REST API v2 URL
    https://api.thanks.io/api/v2
    Bearer Token & Multi-Tenant Subaccount Header
    Authorization: Bearer YOUR_API_KEY
    Content-Type: application/json
    Accept: application/json
    X-Subaccount-Id: sub_99201 # Optional (Agencies/SaaS)
    Enable Zero-Charge Sandbox (Test Mode)
    Account Settings → API Access → API Settings → Test Mode
    Same-Day Print Cutoff
    11:00 AM Central Time
    Minimum Volume
    1 Piece (Postage Incl.)
    6 Formats
    Postcards, Letters, Notecards, Gifts & Magnets
    $0.64
    4×6 Postcard on Pro ($0.77 Biz / $1.18 PAYG)
    Test Mode
    Free Sandbox Validation & Order Previews
    < 2 Sec
    Real-Time QR Scan Webhook Dispatch
    Unified Endpoint Matrix (2026 Pricing)

    All 6 Mail Formats Programmable via REST API & MCP

    Every format includes First-Class or Standard postage, 1-piece minimum order volume, CASS address standardization, and Thanks.io's proprietary digital handwriting engine (AI Fonts with natural glyph variation and Realism Mode crossouts).

    Mail FormatREST v2 EndpointPro Plan ($199/mo)Business ($49/mo)Pay-As-You-Go ($0/mo)Developer Capabilities
    Postcards (4×6, 6×9, 6×11)POST /api/v2/recipients/postcard$0.64 (4×6)$0.77 (4×6)$1.18 (4×6)Saved Creative ID or inline front_image_url, AI handwriting-style fonts, Realism Mode, dynamic Street View, per-recipient QR tracking.
    Windowed Letters (8.5×11)POST /api/v2/recipients/letter$0.79$0.83$1.20Single or multi-page letters via saved Creative ID, handwritten-style text template, or custom rendered pdf_url upload.
    Windowless Letters (Real First-Class Stamp)POST /api/v2/recipients/windowlessletter$0.99$1.35$1.62Executive outer envelope with a real First-Class stamp and handwritten-style recipient/return addressing for maximum open rates.
    Folded Notecards (5×4 in Envelope)POST /api/v2/recipients/notecard$1.49$1.83$2.46Premium folded greeting card inside a handwritten-style outer envelope with natural glyph variation and Realism Mode crossouts.
    Branded Gift Cards ($5–$100)POST /api/v2/recipients/giftcardNotecard + Face ValueNotecard + Face ValueBusiness / Pro PlansDeliver Amazon, Starbucks, Home Depot, Visa, or Target gift cards ($5–$100) paired inside a personalized folded notecard or postcard.
    6×9 MagnaCards (Pop-Out Magnet)POST /api/v2/recipients/magnacard$1.04$1.43$1.78Oversized 6×9 glossy mailer featuring a detachable laminated business-card magnet built for long-term kitchen fridge retention.
    Copy-Paste Production Code

    4 Production Direct Mail API Blueprints

    Switch between Node.js / TypeScript, Python, and cURL to implement single-piece CRM triggers, custom PDF or windowless letters, geospatial neighbor radius blasts, and idempotent webhook consumers.

    CRM Event Trigger

    1. Single-Piece Triggered Postcard with Saved Creative ID & Merge Variables

    Trigger a 1-piece personalized 4×6, 6×9, or 6×11 postcard from any CRM lifecycle event using a pre-approved Creative ID, custom merge variables (%CUSTOM1%–%CUSTOM4%), and optional absentee property address for dynamic Google Street View.

    ENDPOINT:POST https://api.thanks.io/api/v2/recipients/postcard
    Implementation Highlights
    • Reference a saved creative_id so marketing controls artwork & handwriting font without code deploys
    • Inject %CUSTOM1% through %CUSTOM4% for dynamic offer amounts, renewal dates, or rep phone numbers
    • Pass property_address + property_postal_code to render Google Street View of an absentee property while mailing the owner's residence
    Format & Unit Economics
    4×6, 6×9, or 6×11 Postcard (1-Piece Minimum)
    $0.64 Pro / $0.77 Business / $1.18 Pay-As-You-Go (Postage Included)
    // Node.js 20+ / TypeScript — Triggered Postcard with Creative ID & Merge Variables
    const THANKS_IO_API_KEY = process.env.THANKS_IO_API_KEY!;
    
    interface SendPostcardPayload {
      creative_id: number;
      size: "4x6" | "6x9" | "6x11";
      postage_class?: "first_class" | "standard";
      recipients: Array<{
        name: string;
        address: string;
        city: string;
        province: string;
        postal_code: string;
        country: string;
        email?: string;
        custom1?: string;
        custom2?: string;
        property_address?: string;
        property_postal_code?: string;
      }>;
    }
    
    export async function triggerCrmPostcard() {
      const payload: SendPostcardPayload = {
        creative_id: 48291, // Saved Creative in Thanks.io Dashboard
        size: "6x9",
        postage_class: "first_class",
        recipients: [
          {
            name: "Jordan Vance",
            address: "742 Evergreen Terrace",
            city: "Austin",
            province: "TX",
            postal_code: "78701",
            country: "US",
            email: "[email protected]",
            custom1: "$250 Onboarding Credit",
            custom2: "Acct-88412",
            // Optional: Display Street View of subject property while mailing owner's address
            property_address: "1104 Congress Ave, Austin, TX",
            property_postal_code: "78701",
          },
        ],
      };
    
      const response = await fetch("https://api.thanks.io/api/v2/recipients/postcard", {
        method: "POST",
        headers: {
          "Authorization": `Bearer ${THANKS_IO_API_KEY}`,
          "Content-Type": "application/json",
          "Accept": "application/json",
          // Optional for multi-tenant SaaS / agencies:
          // "X-Subaccount-Id": "sub_99201"
        },
        body: JSON.stringify(payload),
      });
    
      if (!response.ok) {
        throw new Error(`Thanks.io API Error (${response.status}): ${await response.text()}`);
      }
    
      return await response.json();
    }
    Sample 200 OK JSON Payloadapplication/json
    {
      "status": "queued",
      "order_id": 9184022,
      "mode": "production",
      "format": "postcard_6x9",
      "recipients_accepted": 1,
      "cass_verified": true,
      "estimated_dispatch": "Same-Day (Before 11:00 AM CT)"
    }
    End-to-End Event Loop

    Direct Mail API Architecture & Bidirectional Webhook Lifecycle

    Close the attribution loop between backend CRM triggers and physical mailbox engagement with real-time JSON webhooks.

    Step 01

    CRM / Backend Event

    Deal stage change, invoice dunning trigger, or nightly cron job fires in your application.

    Step 02

    POST /api/v2/recipients/{format}

    Your server dispatches a JSON request with creative_id, recipient address, and %CUSTOM1%–%CUSTOM4%.

    Step 03

    Same-Day Print (<11am CT)

    CASS-verified orders submitted before 11:00 AM CT are rendered, printed, and cut the same business day.

    Step 04

    USPS First-Class / Standard Stream

    Inducted into USPS with Intelligent Mail Barcode (IMb) scan events tracked automatically.

    Step 05

    Recipient QR Code Scan

    The recipient scans their personalized tracking QR code on the postcard, letter, or notecard.

    Step 06

    Webhook POST to Your Endpoint

    Thanks.io POSTs qr.scanned or order_item.delivered JSON with event_id to your webhook listener.

    Pre-Flight Verification

    Sandbox to Production Readiness Checklist

    Follow this 4-step engineering checklist to validate payloads in API Testing Mode, verify rendered proofs, and cut over to live USPS production safely.

    01
    Sandbox & Auth

    Enable API Testing Mode (Sandbox)

    Navigate to Account Settings -> API Access -> API Settings -> Test Mode in your Thanks.io dashboard. While Test Mode is enabled, all POST requests validate your JSON schema, Bearer token, and address fields without queuing physical print jobs or billing your card.

    GET https://api.thanks.io/api/v2/account
    02
    Payload & Creatives

    Generate Proof Previews Before Live Dispatch

    Lock in your front artwork, AI handwriting-style font (handwriting_id), Realism Mode toggle, and %CUSTOM1%–%CUSTOM4% merge variables inside a saved Creative ID, or inspect rendered proofs using the preview-order tool before disabling Test Mode.

    POST https://api.thanks.io/api/v2/orders/preview
    03
    Payload & Creatives

    Verify CASS Address Standardization & Multi-Tenant Headers

    Ensure your CRM integration passes complete street address, city, state/province, and 5-digit ZIP/postal code. If you are building a multi-tenant SaaS or agency platform, test scoping requests with the X-Subaccount-Id header or OAuth 2.0 bearer tokens.

    Header: X-Subaccount-Id: <subaccount_id>
    04
    Go-Live Cutover

    Test Webhook Idempotency & Cut Over Before 11:00 AM CT

    Fire a test payload to your webhook consumer from Settings -> Webhooks -> Test Event, verify your handler deduplicates by event_id and returns HTTP 200 within 3 seconds, then switch Test Mode off. Orders received before 11:00 AM Central Time print and enter the USPS stream the same business day.

    POST https://api.thanks.io/api/v2/webhooks/test
    Developer FAQ

    Direct Mail REST API & CRM Automation FAQs

    Direct answers to common engineering questions on Test Mode sandboxes, handwritten-style card APIs, PDF letters, and OAuth 2.0 sub-accounts.

    Start in Sandbox Mode Today — $0/mo Pay-As-You-Go Available

    Ship Your First Direct Mail API Integration in 10 Minutes

    Generate your Personal Access Token, enable API Testing Mode to validate payloads for free, and dispatch physical postcards, letters, and gift cards with zero minimums.