Coming from Lob
If you have built on Lob, most of what you know carries over: JSON over HTTPS, test and live keys, HTML templates with merge fields, idempotency keys, metadata, cursor paging and signed webhooks. This page maps each Lob concept to its UpDash Mail API equivalent, with short REST examples. The examples use $API, $H and $DEALER as in the Quickstart.
The one big difference is the order model. Lob sends a mail piece per API call, for one recipient. The UpDash Mail API orders a campaign: one mailing for one dealer and one product, with an audience file of up to 250,000 recipients, a creative, a quote and a person's approval before anything prints. Lob's Campaigns API is the closest Lob concept.
Concept map
| On Lob | Here | Notes |
|---|---|---|
POST /v1/postcards, POST /v1/letters, one piece per call |
POST /v1/campaigns, then the audience, creative, proof, quote, approval and submit |
A per-piece path answers 404 with a fix that names this flow. |
to (the recipient) |
A row of the audience CSV | Rows never travel as JSON fields: send the file as a link, a CSV body or a PUT to a signed URL (Audiences). |
from (the return address) |
The dealer's profile | Every piece prints the dealer's name, address and phone from its profile (Dealers). |
size, mail_type |
product_code on the campaign, mail_class on the quote |
Products: postcard_6x9 (the 9 x 6 postcard), letter_8_5x11_10win (the 8.5 x 11 letter, tri-folded into a #10) and card_8_5x11_6x9env (the fold card in a 6 x 9 envelope). There is no legal-size letter. Mail classes: marketing_mail, first_class. |
| A letter's envelope (Lob's standard #10 double window, or a custom envelope) | envelope on the campaign: closed_face (the default, a #10 with no window) or double_window (the same windows as Lob's standard #10) |
Lob's #10 outer envelopes all have windows; here a letter mails without one unless you send double_window. Xcel's printer prints each closed-face #10 from the mailing list (A letter's envelope). Lob's custom_envelope is refused with a fix that names envelope. |
use_type |
No equivalent | Every order is marketing mail. A prescreened credit offer is your own HTML or saved template with the FCRA notices (Compliance checks); none of Xcel's current templates is one. |
| Lob's template editor in the dashboard | The designer in the partner console | Lays out a postcard, letter or fold card in the browser, or from a few words for the AI, with the print rules checked as you work. Save as template makes it one of your templates (p_ codes), which the API and MCP order like any other. |
Templates (tmpl_ ids) and versions |
template_code from GET /v1/templates, or your own saved template (POST /v1/templates, p_ codes) |
Xcel's twenty-four templates (fourteen postcards, five letters and five fold cards, for birthdays, trade-ins, service, lease ends, loans almost paid off, open recalls, thanks after service, upcoming service appointments, buyers who never came back for service, accessories, shoppers, showroom visits, conquest, warranties, payment reviews, service customers who bought elsewhere, new owners and the holidays), and your own HTML saved as templates with immutable versions. See Templates and versions. |
front, back, file |
One template_code or one html document for every side, or artwork: one PDF (a page per side), or a PNG or JPEG per side as artwork.front and artwork.back |
Lob's static PDF maps to artwork: {"url": ...} like Lob's file URL, or a signed upload. Lob's PNG or JPEG front and back go inside artwork (Print-ready artwork). |
merge_variables |
copy (the same for every piece) and audience columns (per recipient) |
See Merge variables. |
| Handlebars templates | Conditional blocks in the Handlebars syntax | #if, else, #unless and comparisons; no #each (Conditional blocks). |
send_date |
requested_mail_date (YYYY-MM-DD) on the campaign |
A preferred date. Xcel schedules production. |
metadata |
metadata, with the same limits |
Plus external_ref, your own id for the order (Your reference on a campaign). |
Idempotency-Key |
Idempotency-Key on create, template save, the dealer import, the audience import and submit |
Required on submit (Idempotency). |
test_ and live_ keys, HTTP Basic auth |
xm_test_ and xm_live_ keys, HTTP Basic auth or Authorization: Bearer |
The key is the Basic user name with an empty password, as on Lob (Keys and auth). |
| Webhooks and events | Signed webhooks for campaign events | Events are per campaign, not per piece (Webhooks and events). |
| US address verification | No endpoint yet | Rows are checked at upload; Xcel runs CASS and NCOA on live orders (Address verification). |
| PDF proof URL and thumbnails | A template preview link; the proof goes to the approver | See Proofs, approval and submit. |
| Cancel within the cancellation window | No cancel endpoint yet | See Cancelling. |
| Postman collection | The Postman collection and its sandbox environment | Generated from /openapi.json. Its folders run the sandbox flow in order and save each id for the next request. |
Keys and auth
Send the key as you send it to Lob: as the HTTP Basic user name, with an empty password. A Bearer token works too, and the examples on these pages use it:
curl -s -u "xm_test_REPLACE_WITH_YOUR_SANDBOX_KEY:" "$API/v1/products?detail=compact"
H="Authorization: Bearer xm_test_REPLACE_WITH_YOUR_SANDBOX_KEY"
curl -s -H "$H" "$API/v1/products?detail=compact"The colon after the key ends the user name, so curl sends an empty password and does not ask for one. A password, if your client sends one, is ignored. Code that authenticates the way Lob's SDKs do (the key as the user name) works unchanged against $API; only the endpoints differ, as below. In Postman, choose Basic Auth with the key as the username and an empty password, or keep the collection's Bearer {{apiKey}}. Basic auth is for the REST API: the MCP endpoint takes a Bearer key or OAuth (MCP server).
A sandbox key (xm_test_) never prints, mails or spends, like a Lob test key. It renders real proofs (you open them on the review page from review_url), and after submit you move the order through production yourself with POST /v1/test/campaigns/{id}/advance (MCP: advance_test_campaign), which also simulates results. Test and live data are separate, except dealers, which both modes share; a sandbox key only validates dealer changes (Test keys only validate).
The order, step by step
A Lob postcard for one person is one call:
MAIL_DATE=$(date -u -v+21d +%F 2>/dev/null || date -u -d '+21 days' +%F) # three weeks out, YYYY-MM-DD
curl https://api.lob.com/v1/postcards -u "$LOB_TEST_KEY:" \
-d "to[name]=Pat Lee" -d "to[address_line1]=1 Main St" -d "to[address_city]=Springfield" \
-d "to[address_state]=IL" -d "to[address_zip]=62704" \
-d "from=adr_123" -d "front=tmpl_front" -d "back=tmpl_back" \
-d "merge_variables[first_name]=Pat" -d "send_date=$MAIL_DATE" -d "use_type=marketing"Here, the same mailing to a list is a campaign. Create it, tagged with your own id:
C=$(curl -s -H "$H" -H 'content-type: application/json' $API/v1/campaigns \
-H "Idempotency-Key: $(uuidgen)" \
-d "{\"dealer_id\":\"$DEALER\",\"product_code\":\"postcard_6x9\",\"name\":\"December service\",\"requested_mail_date\":\"$MAIL_DATE\",\"external_ref\":\"lob_cmp_123\",\"metadata\":{\"program\":\"service\"}}" \
| jq -r .campaign.id)Upload the recipients. Start the upload, PUT the CSV to the signed URL, then complete it. A Lob-style export keeps its header names: address_line1, address_line2, address_city, address_state and address_zip are read as they are, and column_map renames the rest, here your record id:
A=$(curl -s -H "$H" -X POST $API/v1/campaigns/$C/audience)
curl -s -X PUT -H 'content-type: text/csv' --data-binary @recipients.csv "$(echo "$A" | jq -r .upload_url)"
curl -s -H "$H" -H 'content-type: application/json' $API/v1/campaigns/$C/audience/complete \
-d "{\"audience_id\":\"$(echo "$A" | jq -r .audience_id)\",\"column_map\":{\"id\":\"external_id\"}}"Or in one call, with the file as the body (up to 4.5 MB) or a source_url Xcel fetches once (Import in one call):
curl -s -H "$H" -H 'content-type: text/csv' --data-binary @recipients.csv \
--url-query 'column_map={"id":"external_id"}' $API/v1/campaigns/$C/audience/importThe required columns are first_name, last_name, address1 and zip. Send city and state when you have them; a file may leave both out when every row has a valid ZIP. Lob's single name has no column here: export it as first_name and last_name (a column_map renames a column but cannot split one, and the refusal's fix says so). Map your record id to external_id: per-lead results come back keyed by it. The completion reports counts, reason codes and row numbers, never rows, and its next_step says what to call next.
Fill a template with copy. Store details you leave out (the phone, web address, QR link and signer) print from the dealer's profile, and the response's profile_slots names them. Send one only with the dealer's own value: the sample values in templates and examples are the sample dealer Demo Motors', and preflight flags them on another dealer (sample_store_value, an error on a live order):
curl -s -H "$H" -H 'content-type: application/json' $API/v1/campaigns/$C/creative \
-d '{"template_code":"postcard_6x9_birthday","copy":{"note":"Happy birthday from all of us! Thank you for trusting us with your {{recipient.vehicle|vehicle}}. Your gift is on the other side: stop by any time this month.","gift_offer":"$50 toward any service","expires":"12/31/2026"}}'Then render the proof, get a quote and ask for approval:
curl -s -H "$H" -X POST $API/v1/campaigns/$C/proof
Q=$(curl -s -H "$H" -X POST $API/v1/campaigns/$C/quote | jq -r .quote.id)
curl -s -H "$H" -H 'content-type: application/json' $API/v1/campaigns/$C/approval \
-d "{\"quote_id\":\"$Q\",\"max_spend_cents\":50000}"A person at the dealer approves on the review page. Then submit, with an Idempotency-Key you keep for the order:
curl -s -H "$H" -H 'content-type: application/json' -H "Idempotency-Key: order-$C" \
$API/v1/campaigns/$C/submit -d '{"approval_id":"REPLACE_WITH_APPROVAL_ID"}'The Quickstart runs this whole flow with the responses.
Templates and versions
Lob templates are your HTML, saved with tmpl_ ids and versions. Here:
- Xcel's templates are twenty-four: fourteen 6 x 9 postcards, five tri-fold letters and five fold cards, among them two birthday pieces designed as a wrapped gift, a trade-in postcard, a service postcard, a lease-end postcard, a recall postcard, a service appointment reminder, a warranty letter, a payment review letter and a holiday card (The templates). For any other message, use your own HTML, a saved template or print-ready art. List them with
GET /v1/templates(filter byproduct_code,use_case,queryorprescreened), read one withGET /v1/templates/{code}, and render one with your copy before any campaign exists withPOST /v1/templates/{code}/preview, the nearest thing to Lob's template compile (Preview a template). - Your own templates.
POST /v1/templatessaves your HTML with typed copy slots under your own code, returned asp_<code>: the nearest thing to Lob'stmpl_templates. Each save is a new immutable version, like Lob's template versions; the newest is the one used unless a creative pinstemplate_version, so the newest plays the part of Lob's published version. List the versions withGET /v1/templates/{code}/versions, and retire a template withPOST /v1/templates/{code}/retire(on Lob, delete it). Unlike Lob, test and live keys share your templates (they are creative, not spend), and a version is stored only when it passes preflight with its samples (Your own templates). - Your own HTML per creative goes in
htmlonPOST /v1/campaigns/{id}/creative. It must keep{{brand.disclaimers}}and, except on a fold card, an element with classxm-address; start from a product's starter file (Your own HTML). - Versions. A creative uses the template's current version and records it (
template_versionin the response), and an approval is bound to that creative, so a later template version never alters an approved order. Your own templates can be pinned withtemplate_versionon the creative and the preview, and read withGET /v1/templates/{code}?version=. Xcel's templates serve only their current version.
Print-ready artwork
Lob's static PDF creative (a front and back file for a postcard, a file for a letter) is artwork on POST /v1/campaigns/{id}/creative. Send a URL, as you would Lob's file URL:
curl -s -H "$H" -H 'content-type: application/json' $API/v1/campaigns/$C/creative \
-d '{"artwork":{"url":"https://cdn.example.com/fall-service-6x9.pdf"}}'Lob's PNG or JPEG front and back go inside artwork, one image per side (on a letter too: front is page 1, back page 2):
curl -s -H "$H" -H 'content-type: application/json' $API/v1/campaigns/$C/creative \
-d '{"artwork":{"front":{"url":"https://cdn.example.com/front.png"},"back":{"url":"https://cdn.example.com/back.jpg"}}}'Or, for a file that is not on a public URL, start a signed upload (POST /v1/artwork, or POST /v1/campaigns/{id}/creative/artwork for one campaign), PUT the file to its upload_url, and send {"artwork":{"artwork_id":"..."}} (one upload per image side) (Print-ready artwork). To check art before you create a campaign, POST /v1/artwork/preview (MCP: preview_artwork) answers the preflight and the review proof. The differences from Lob:
- A PDF holds every side, a page per side in print order (a postcard's front then back), where Lob takes a file per side for postcards. Images are one per side, as on Lob.
- Each PDF page must be the product's file size within 0.01 in (9.25 x 6.25 in for the 6 x 9 postcard, trim plus bleed), as Lob also refuses a file of the wrong size. An image must have the page's proportions within 1% (else the error
artwork_page_size) and should have 300 ppi at that size (2775 x 1875 px for the 6 x 9; below it, the warningartwork_low_resolution); it is placed on the page without resampling, at most 25 MB. A CMYK JPEG is kept as sent; a PNG's transparency prints white. - The address block's position is fixed per product, so Lob's letter
address_placement(such asinsert_blank_page) has no equivalent: page 1 of a letter carries the address block. In a closed-face envelope it is the inside address, and the printer addresses the envelope. - Preflight checks the file (page count and size, embedded fonts, active content, image resolution), but the copy compliance checks cannot read art: the offer wording is yours, and a prescreened credit offer must be your own HTML or saved template with the FCRA notices, never artwork.
- The art is static: no merge variables. To print a recipient's name, use a template or your own HTML.
Merge variables
Lob's merge_variables hold one piece's values. A campaign splits them in two:
| Value | Where it goes | Prints with |
|---|---|---|
| The same on every piece (headline, offer, expiry) | A copy slot in copy, keyed by slot name |
The template's slots; in your HTML, {{copy.<slot>}} |
| Different per recipient (first name, vehicle, a lease payment) | A column of the audience CSV | {{recipient.<column>}} |
| The dealer's details | The dealer profile | {{dealer.*}} and {{brand.*}}, filled in for you |
Merge fields carry a namespace: Lob's {{first_name}} is {{recipient.first_name}} here, and a field without one is a preflight error (unknown_placeholder). A fallback prints when the value is blank: {{recipient.first_name|Valued Customer}}. GET /v1/templates lists each template's audience_columns, the columns it reads beyond the name and address.
Conditional blocks
Blocks use the Handlebars syntax, as Lob's Handlebars templates do: {{#if x}}…{{else}}…{{/if}}, {{else if y}}, {{#unless x}} and the comparisons eq, ne, gt, gte, lt and lte:
{{#if (eq recipient.vehicle_make "Ford")}}Built Ford Tough service{{else}}Service for your vehicle{{/if}}There is no {{#each}}, no other helper and no triple braces, and preflight checks every block before a proof (Conditional blocks).
Scheduling
send_date becomes requested_mail_date on POST /v1/campaigns: a date (YYYY-MM-DD), not a time, and not in the past. It is the date you ask for. Xcel schedules production, and the campaign's statuses show where the order is.
Metadata and your own reference
metadata works as on Lob: up to 20 keys of 1 to 40 characters, each with a string value of up to 500 characters. external_ref is one more field for your own order id. Both are set on create and come back on every campaign response, results and campaign webhook. Lists filter by external_ref (GET /v1/campaigns?external_ref=lob_cmp_123), not by metadata. Never put customer data in either. Every campaign and campaign webhook also carries your id for the dealer (dealer_external_id) and the template its current creative prints (template_code, template_version).
Idempotency
Send an Idempotency-Key header on POST /v1/campaigns (optional), POST /v1/templates (optional), the dealer import (optional), the audience import (optional) and submit (required). The same key with the same body within 24 hours returns the stored response with Idempotent-Replayed: true; the same key with a different body is refused with 409 idempotency_key_reused. Keys are scoped to your partner and the key's mode (Idempotency).
Listing and paging
| List | Cursor parameter | Cursor in the answer |
|---|---|---|
GET /v1/campaigns |
starting_after |
next_cursor (null on the last page) |
GET /v1/dealers |
after |
next_after |
GET /v1/campaigns/{id}/results (leads) |
leads_after |
leads.next_after |
limit sets the page size (leads_limit for leads). There is no before cursor for paging back and no include, and only the dealer list returns a total: page until has_more is false (campaigns) or the cursor is null. A template's versions list newest first and page with before = next_before, as a dealer's profile versions do.
Webhooks and events
Register an endpoint with POST /v1/webhooks (url, optional event_types). Deliveries are signed with HMAC-SHA256: X-Xcel-Signature: t=<unix seconds>,v1=<hex> over <t>.<raw body>, keyed with the endpoint's secret (Webhooks).
Events are per campaign, not per piece:
| You want to know | Event |
|---|---|
| The order moved (in production, at USPS, in the postal network, delivery estimated, completed) | campaign.status_changed |
| The audience file was processed | audience.completed |
| A person approved or rejected the order | approval.decided |
| Responses and matched sales or service came in | campaign.results_updated, campaign.lead_results_updated |
A piece was scanned in transit, or sorted for its carrier (in_transit, processed_for_delivery) |
campaign.usps_tracking_updated, a batch of pieces per poll |
Lob event names such as postcard.delivered are refused at registration. The USPS statuses rest on processing scans for the campaign's pieces; they are not proof of delivery to a mailbox. GET /v1/events lists your events for a time window, and a delivery can be replayed (Webhooks). GET /v1/campaigns/{id} and GET /v1/campaigns/{id}/results always give the current state.
Address verification
There is no address verification endpoint yet. At upload, each row is checked for the required fields, a valid state and ZIP, duplicates and your suppression list, and the report gives a reason code per rejected row number (Audiences). On live orders, Xcel runs CASS and NCOA before production; pieces removed by address processing are not billed. In the sandbox every address passes.
Proofs, approval and submit
A proof here shows customer records, so it never comes back through the API. The approver sees it on the review page, and request_approval binds the approval to that exact print file. To show a person the design, send the preview_url that GET /v1/templates and POST /v1/templates/{code}/preview return: it opens in a browser for an hour with no key, and shows a sample recipient, never a customer.
Only a person at the dealer approves spend. In live mode Xcel emails the review link to the dealer's registered approver; in the sandbox request_approval returns it as review_url so you can try the page. max_spend_cents is the most you were told to spend, and a submit over it, or over the dealer's monthly spend cap, is refused. A quote shows what is left of the cap (dealer_spend_remaining_cents).
Cancelling
There is no cancel endpoint yet. A campaign costs nothing until it is submitted, so an order you do not want can stay unsubmitted. To stop a submitted order, contact Xcel ops. DELETE /v1/campaigns/{id} answers 405 method_not_allowed with this advice.
Fields this API does not take
An unknown field is refused, never ignored: 400 invalid_request, with the field in field and, for Lob's names, the field meant in fix. A request that differs from an earlier one only in such a field is refused too, never replayed.
{
"error": {
"code": "invalid_request",
"message": "Unknown field `send_date`: unknown fields are refused, not ignored.",
"fix": "Send `requested_mail_date` instead of `send_date` (YYYY-MM-DD). Accepted: dealer_id, product_code, name, requested_mail_date, envelope, external_ref, metadata. Then retry. See /openapi.json for the request schema.",
"field": "send_date"
}
}| Lob field | Send instead |
|---|---|
to |
Audience rows (POST /v1/campaigns/{id}/audience) |
from |
Nothing: the dealer's profile |
front, back, template_id |
template_code (or html, or artwork: one PDF, or a PNG or JPEG per side as artwork.front and artwork.back) on the creative |
file, pdf, pdf_url, file_url, artwork_url, image |
artwork on the creative (Print-ready artwork) |
engine: "handlebars" |
Nothing: blocks use the Handlebars syntax already |
merge_variables |
copy on the creative, and audience columns |
send_date |
requested_mail_date on the campaign |
mail_type |
mail_class on the quote |
size |
product_code on the campaign |
description |
name on the campaign, or metadata |
use_type |
Nothing |
after on GET /v1/campaigns |
starting_after |
Not available yet
- An event per scan. A piece's USPS stage comes in
campaign.usps_tracking_updated, a batch of pieces per poll, andGET /v1/campaigns/{id}/leadshas each piece's scans (Who was mailed). There is no delivered event: USPS scans are not proof of delivery. - An address verification endpoint.
- A cancel endpoint.
- SDKs on npm. A pre-release TypeScript SDK,
@updash/mail-api, maps Lob's calls to typed methods and verifies webhooks;/openapi.jsondescribes every endpoint (OpenAPI 3.1).