1---2name: scribeless-api-integration3description: Build public Scribeless API and automation workflows for creating recipients, including custom HTML recipient rendering. Use when a user needs API authentication guidance, X-API-Key examples, POST /api/recipients payloads, POST /api/recipients/html payloads, product_key selection, HTML front/back rendering, Zapier/Make/Pipedream/n8n/CRM/ecommerce mappings, error handling, webhook-to-recipient mapping, or implementation review.4---56# Scribeless API Integration78## Workflow9101. Identify the source system:11 - CRM, ecommerce store, product analytics, warehouse, form, event tool, AI agent, data pipeline, server-side automation, or custom app122. Identify the trigger:13 - order created, deal stage changed, demo booked, form submitted, customer milestone, QR scan, agent-approved send, or scheduled list sync143. Confirm the Scribeless destination:15 - existing campaign ID for standard campaign recipients16 - `product_key` for custom HTML recipient rendering17 - recipient data fields18 - template variables required by the campaign194. Build mapping:20 - source contact/customer fields to recipient fields21 - source email/domain fields to recipient `email` and `domain`22 - source event fields to `variables`23 - generated HTML to `/api/recipients/html` `html.front`, with optional `html.back`24 - source record IDs and run IDs for audit/dedupe25 - suppression rules and deduplication strategy265. Produce an example:27 - curl28 - JavaScript/TypeScript fetch29 - Zapier/Make step outline when relevant306. Review safety:31 - do not expose API keys32 - do not send live requests unless the user confirms33 - test standard campaign recipients against a Pending recurring campaign before activating it34 - review custom HTML rendered documents before using them in a live workflow35 - show returned preview `signed_url` images to the user when validating an HTML recipient render36 - confirm whether the account has an active subscription or requires checkout before treating recipients as ready for fulfilment37 - include retry/backoff guidance for transient failures3839## API Basics4041- Base endpoint for campaign recipient creation: `https://platform.scribeless.co/api/recipients`42- Base endpoint for custom HTML recipient rendering: `https://platform.scribeless.co/api/recipients/html`43- Authentication header: `X-API-Key`44- API keys are created in platform settings.45- For `POST /api/recipients`, campaigns should already exist before sending recipients through the API.46- Send standard recipients to a recurring campaign while it is still Pending for test previews; after activation, new API recipients may be processed and charged.47- Send recipient email addresses and account/customer domains as first-class `email` and `domain` fields instead of placing them in `variables`; Scribeless uses these fields for analytics and attribution.48- Custom HTML recipient rendering uses `product_key`, `include_envelope`, `orientation`, `html`, and `data`.49- For teams on a subscription, recipients move straight to `ready`. One-time recipients may remain `pending` until they are checked out.50- Product keys identify supported postcard, flat card/note, and letter formats for HTML rendering.5152## Example Payload5354```json55{56 "campaignId": "CAMPAIGN_ID",57 "data": [58 {59 "firstName": "Ada",60 "lastName": "Lovelace",61 "company": "Example Co",62 "email": "ada@example.com",63 "domain": "example.com",64 "address": {65 "address1": "123 Example St",66 "city": "Bristol",67 "state": "Bristol",68 "postalCode": "BS1 1AA",69 "country": "GB"70 },71 "variables": {72 "plan": "VIP",73 "source": "demo"74 }75 }76 ]77}78```7980## HTML Recipient Rules8182- Use the `POST /api/recipients/html` endpoint for custom HTML recipients.83- `product_key` must match a supported product key.84- `orientation` can be `landscape` or `portrait`.85- `html.front` is required for non-envelope products. `html.back` can be included for duplex/front-and-back output.86- Add Smart QR placeholders with an empty `div data-sqr` when the HTML should render a tracked QR code.87- Give each QR slot on the same side a unique `data-sqr-id`, a `data-sqr-destination`, and a stable CSS size.88- After a successful HTML recipient request, surface any returned `documents` with `format: "preview"` and `signed_url` so the user can inspect the rendered output.89- Use self-contained HTML in each side's `html` value; JavaScript is disabled during rendering.90- Do not rely on external stylesheets, scripts, fetch/XHR, iframes, or other network resources.91- Inline `data:image/*` images are allowed.92- External images must be HTTPS, publicly reachable, and must not redirect to another URL.93- Use standard web font hosting only when it is supported by the renderer; avoid depending on custom font requests unless they have been tested in rendered output.94- Keep HTML payloads deterministic and product-sized; content is rendered inside a clipped mail-piece container.9596## Error Guidance9798- `401`: missing, malformed, or invalid API key.99- `400`: payload validation issue; inspect required fields and variable shape.100- `503`: unexpected traffic spike or temporary service issue; retry after a short delay.101102## Support103104- Help Center: `https://help.scribeless.co/en/`105- API documentation: `https://docs.scribeless.co/`106- For API or automation issues, ask the user to contact Scribeless through live chat or `team@scribeless.co`.107108## References109110- Use `references/api-workflows.md` for examples and connector outlines.111- Use `references/html-recipient-api.md` for HTML recipient product keys and request/response examples.