# Concepts

The objects in the UpDash Mail API, how they relate, and the rules that bind them.

## Object map

```mermaid
flowchart LR
    P[Partner] -->|holds| K[API keys<br/>test and live]
    P -->|owns| D[Dealers]
    D --> PV[Profile versions<br/>partner-owned]
    D --> BK[Disclosures<br/>Xcel-managed]
    D --> AP[Registered approvers<br/>Xcel-managed]
    P -->|creates| C[Campaign<br/>one dealer, one product]
    P -->|saves| SO[Standing order<br/>one repeating mailing]
    SO -->|each run makes| C
    C --> AV[Audience versions]
    C --> CV[Creative versions]
    C --> Q[Quotes]
    Q --> A[Approvals]
    A --> S[Submission<br/>at most one]
    C --> E[Events]
    E --> W[Webhook deliveries]
```

## Partners and API keys

A **partner** is a company that orders mail through the API: a CDP, an agency, or an operator of AI agents. A self-serve sandbox sign-up creates one, and Xcel creates the rest; going live turns on live ordering for that same partner ([Going live](going-live.md)). A partner has a name and an `ordering_enabled` switch that gates live submissions.

A partner's people can also use the [partner console](console.md) at `/console`, signing in with an emailed link. Each has a role (admin, member or viewer) and may be limited to some dealers.

A partner holds one or more **API keys**:

| Prefix | Mode | What it can do |
| --- | --- | --- |
| `xm_test_` | Sandbox | Everything, with simulated address processing and production. Nothing prints. |
| `xm_live_` | Live | Real orders. Submissions go to Xcel's ops queue. |

A key is the prefix plus 32 base62 characters, for example `xm_test_` followed by 32 letters and digits. Send it as `Authorization: Bearer <key>` on every REST request and on the MCP connection (REST also takes it as the HTTP Basic user name with an empty password, as Lob does), or paste it once on the MCP OAuth consent page so an agent gets its own token instead ([MCP server](mcp.md#connect-by-oauth)). The key decides the partner and the mode; nothing in a request body can change either. See [Security](security.md#api-keys).

## Dealers

A **dealer** is a car dealership the partner orders for. Partners create dealers (`POST /v1/dealers`, the `upsert_dealer` tool or a CSV import), and Xcel sets up dealers too. A dealer has:

| Field | Meaning |
| --- | --- |
| `id` | Xcel's dealer id (UUID). |
| `external_id` | The partner's own id for the dealer, unique among its dealers. Anywhere a request takes `dealer_id`, either id works. |
| `name`, `address` | From the current profile. Printed on the mail. |
| `profile_version` | The dealer's current profile version. |
| `spend_cap_cents` | Cap on submitted spend per calendar month (UTC), or `null` for no cap. Set by Xcel. |
| `registered_approvers` | Masked emails of the people who may approve live orders, for example `j***@dealer.com`. The partner names them and they confirm by email ([Approvers](dealers.md#approvers)); Xcel can register them too. |
| `live_ready` | `true` once an approver is registered; live approval and submit need it. |
| `test_only` | `true` for a [test dealer](dealers.md#test-dealers): one a test key created, which exists in test mode only. |
| `updash_linked` | Whether Xcel linked the dealer to its UpDash record, so profile changes are pushed there. |

Dealers are shared by a partner's test and live keys, except test dealers, which only test keys see. Everything below the dealer (campaigns, quotes, approvals, submissions, webhooks) is separate per mode. Another partner's dealer answers 404.

### Dealer profiles

Each dealer has a **profile** that the partner owns and keeps current: name, legal name, alias, pronunciation, dealer group, OEM codes and makes, address and return address, service-area ZIPs, phones, contact, notification emails, time zone, hours and exceptions, links, brand colors, logos and lead routing. Read it with `GET /v1/dealers/{id}/profile`; change it with `PUT` (replace) or `PATCH` (merge), and upload a logo with `POST /v1/dealers/{id}/logo`.

Every change writes a new, immutable **profile version** that records the changed field names, who made the change and when. The version is the profile's ETag: send it as `If-Match` and a stale write is refused with 412 `version_conflict`. Because test and live keys share dealers, a sandbox key's write to a shared dealer only validates: it answers `"validated_only": true` and saves nothing ([Test keys only validate](dealers.md#test-keys-only-validate)). Its writes to its own test dealers save.

Xcel keeps the fields that protect the approval guarantee: the registered approvers (which the partner nominates, see [Approvers](dealers.md#approvers)), the disclosures, the dealer license number, the spend cap and the partner's live-ordering switch. A partner request that sends one is refused with `xcel_managed_field`. See [Dealers](dealers.md).

A partner-created dealer can be quoted in test and live, but until an approver is registered, a live `request_approval` or submit is refused with `no_registered_approver`.

## Brand values

A creative prints the dealer's name, address, logo, colors and phone from the dealer's profile, and the required disclosures from Xcel. The phone (`phones.main`, or the department phone a design calls for) prints where the order prints the store's own line; a live order prints a tracking number in its place ([Calls](#calls)). `GET /v1/dealers/{id}/brand` or the `get_dealer_brand` tool shows what a new creative would print.

These are locked inputs to a creative. The server fills them in; a creative request cannot supply or override them. Sending `brand` or `dealer` in a creative request, or a copy key that names a brand field or starts with `brand`, `dealer`, `recipient` or `fcra`, is refused with `locked_field`. Change the profile instead. To change the disclosures or the approver list, ask Xcel.

**A creative prints the profile version it was made with.** Its proof, print file and order keep using that version when the profile changes later, so an approved or submitted order never changes. To print a changed profile, generate the creative again; as with any new creative, the campaign returns to `draft` and needs a new proof, quote and approval.

When Xcel has locked the dealer's disclosures, every creative must include `{{brand.disclaimers}}`, or preflight reports `locked_disclosure_missing`. See [Creative](creative.md#locked-brand-inputs).

A **print-ready artwork** creative (a PDF, or a PNG or JPEG per side) is the exception: the art is static and carries its own logo, colors and phone, and only the return address prints from the profile. Locked disclosures must be in the art word for word, which preflight cannot read (the warning `locked_disclosure_unverified`).

## Calls

Every live order can print its own phone number, so each call is counted and tied to the person who called. What the pieces print is chosen at two levels, and a tracking number is the default:

| `print` | What the pieces print | Calls |
| --- | --- | --- |
| `tracking` (default) | An UpDash tracking number: a local number in the area code of the line it rings, one per order. | Each call rings the store and comes back as a phone response on the order's leads, matched to the caller on the mailing list. |
| `store` | The store's own phone from the profile. | Not counted. |
| `own` | A number you provide, `own_number`, exactly as given. | Yours to count. |

- **The dealer's setting** is the profile's `calls`: `print`, `own_number`, `ring` and `service_ring` ([Dealer profiles](dealers.md#the-profile)). `ring` is the line a tracking number rings: `main`, `sales`, `service`, `parts` (that profile phone) or another ten-digit number; null rings the line the design prints. `service_ring` is the same for service mail (service reminders, recalls and other service templates) and falls back to `ring`. In the console it is the dealer's Calls section, which only an admin changes.
- **The order's choice** is `calls` on `generate_creative`: `print`, with `own_number` or `ring`. Later creative versions of the order keep it until you send another; `null` goes back to the dealer's setting. In the console it is "Phone on the mail" on the order form.
- **A phone you send in `copy`** (`cta_phone` or any phone slot) always prints as sent, and no tracking number is set up.
- **Where it prints:** the tracking or own number replaces the design's first phone, every other phone that prints the same line, and `{{brand.phone}}`. A phone for another department keeps that department's line. `{{brand.store_phone}}` always prints the store's own line, for a spot a rule says must show it.
- **When the number is set:** at the proof, never with the design: a live order gets its number when `render_proof` makes its proof and its list mails at least 500 pieces. Until then the design's phone holds `{{brand.phone}}`, and the creative's `calls.fallback` is `pending`. The order keeps the number for later creatives and proofs, even if the list shrinks. Test orders never get one: their proofs print the store's line, and `calls.fallback` is `test`.
- **Orders under 500 pieces** print the store's line, and the proof says so: `calls.fallback` is `below_minimum`, and the proof warns `call_tracking_below_minimum`. A partner holds at most 100 numbers at once; past that, proofs print the store's line with `cap_reached` (`call_tracking_cap_reached`). Ask Xcel to raise either.
- **The proof** prints the tracking number where it will print. The proof's `calls`, the order page and the approver's review page name the number and the line it rings, and approving the proof confirms both.
- **How long it rings:** until 90 days after the last in-home date and 30 days without a call. Then UpDash releases it.
- **An order that never mails gives its number back:** the day after it is cancelled or its approval is rejected, or 30 days after the number was set up when it is not submitted and no approval is open. Its proof goes back to draft; the next proof gets a new number.
- **After the mail drops:** the order's page in the console shows the number, the line it rings, its calls so far and the day it stops ringing. From there a member can change the line it rings (mail already out rings the new line from the next call) or keep it 90 more days: once per order, while it still took a call in the last 30 days. A week before it stops ringing, the members who see the dealer get an email.
- **Test the line first:** the dealer's Calls section can place a short automated test call to the line a tracking number rings, and shows whether a person or the store's phone system answered.
- **Cost:** included in the piece price.
- If UpDash cannot set up a number, the proof prints the store's line and warns `call_tracking_unavailable`; make the proof again to retry.

## Products and templates

A **product** is a mail format with fixed geometry and mailing rules. Xcel offers three: `postcard_6x9`, the 9 x 6 postcard; `letter_8_5x11_10win`, the 8.5 x 11 letter tri-folded into a #10 envelope with no window; and `card_8_5x11_6x9env`, an 8.5 x 11 sheet of card stock folded in half and mailed in a 6 x 9 closed-face envelope. The 8.5 x 14 legal letter (`letter_8_5x14`) and the 6 x 11 postcard (`postcard_6x11`) are no longer offered; campaigns already made with them keep their spec. See [Products](products.md).

A **template** is Xcel's HTML layout for one product, with named, typed **copy slots** that you fill (each with a sample) and compliance rules that preflight applies. Templates carry a version. Xcel offers twenty-four: fourteen for the postcard, five for the letter and five for the fold card, from two birthday pieces designed as a wrapped gift to a trade-in postcard, a declined-service postcard, a recall postcard, a service appointment reminder, a warranty letter, a payment review letter and a holiday card ([The templates](creative.md#the-templates)). Each is tagged with its **use cases** (such as `birthday`, `service_retention` or `conquest`), lists the audience columns it reads, and says whether it needs a prescreened list. Image merge fields print the dealer's make logos, vehicle photos and QR codes ([Image fields](creative.md#image-fields)). Copy can print text only for some recipients with `{{#if}}` blocks ([Conditional blocks](creative.md#conditional-blocks)). You write the copy, or send a `brief` and Claude drafts it ([AI-written copy](creative.md#ai-written-copy)). Find a template with `GET /v1/templates` (by product, use case or a query) and render any of them with your copy before you create a campaign ([Preview a template](creative.md#preview-a-template)); a preview's **preview link** opens it in a browser for an hour with no key ([Preview links](creative.md#preview-links)). You can also save your own HTML as a **saved template** with typed slots (`POST /v1/templates`, codes starting `p_`): each save is a new immutable version, only your partner sees it, and your test and live keys share it ([Your own templates](creative.md#your-own-templates)). Instead of a template, a creative can be your own HTML, or a designer's **print-ready PDF** (`artwork`): static art with one page per printed side, which Xcel prints with the address block over it ([Print-ready artwork](creative.md#print-ready-artwork)). See [Creative](creative.md#templates).

## Campaigns

A **campaign** is one mailing for one dealer and one product. It has a `name` (1 to 120 characters), an optional `requested_mail_date` (`YYYY-MM-DD`, not in the past, at most 180 days out), for a letter its `envelope` ([below](#a-letters-envelope)), your optional `external_ref` and `metadata` ([below](#your-reference-on-a-campaign)), a `status`, and pointers to its current creative and audience versions.

Campaign ids are UUIDs. An id that is not a UUID, or that belongs to another partner or the other mode, answers 404 `not_found`. `GET /v1/campaigns` (MCP: `list_campaigns`) finds campaigns without their id: by dealer, status, `external_ref` or creation time, a page at a time ([List campaigns](api-reference.md#list-campaigns)). Each campaign names its dealer by both ids (`dealer_id`, `dealer_external_id`) and the template its current creative prints (`template_code`, `template_version`; `null` before the first creative and for your own HTML or print-ready art).

### A letter's envelope

The letter mails in a #10 envelope with no window unless the campaign asks for the window: `POST /v1/campaigns` (MCP: `create_campaign`) takes which one as `envelope`. The product code stays the same either way.

| `envelope` | How it mails |
| --- | --- |
| `closed_face` (the default) | A #10 with no windows. The printer prints each envelope from the mailing list: the dealer's return address, the recipient's address with the Intelligent Mail barcode (IMb), and the postage indicia. Page 1 still prints the household's name and address as the inside address, without an IMb, and the printer matches each letter to its envelope by the row key. The quote adds a per-piece `closed_face_envelope` line. |
| `double_window` | Only when the campaign sends it. The return and recipient addresses print in the address block on page 1 and show through the envelope's two windows. |

A fold card (`card_8_5x11_6x9env`) mails only in its 6 x 9 closed-face envelope, so it needs no choice: `envelope` reads `closed_face`, and `double_window` is refused. Every campaign response and campaign webhook carries `envelope`: the letter's choice, the card's closed face, or `null` for a postcard, which has no envelope. Sending `envelope` for a postcard, or any other value, is 400 `invalid_request` with `field` `envelope`. It is set once, on create: to change it, create a new campaign. The proof, the review page and the printer's files say which envelope the order mails in, and a closed-face proof ends with the envelope face ([Proofs](creative.md#proofs)). The geometry of both envelopes is in [Products](products.md#letter).

### Your reference on a campaign

Two optional fields on `POST /v1/campaigns` and `create_campaign` tag an order with your own identifiers, so you can find it again and join it to your records without keeping Xcel's campaign id.

| Field | Rules | Returned |
| --- | --- | --- |
| `external_ref` | Your id for the order (for example your campaign or job id). A string of 1 to 100 characters after trimming, without line breaks or tabs. Not unique: two campaigns may share one. | On every campaign object (`null` when none), on `GET /v1/campaigns/{id}/results` and on every campaign webhook. Filter with `GET /v1/campaigns?external_ref=` (exact match). |
| `metadata` | Labels, as on Lob: an object of up to 20 keys, each 1 to 40 characters, each value a string of up to 500 characters. No nested objects, numbers or booleans; no line breaks or tabs. | On every campaign object (`{}` when none), on results and on every campaign webhook. |

**Never put customer data in either field**: no names, addresses, emails, phone numbers or VINs. They are echoed on every response and webhook and stored with the order, outside the audience file's retention rules. Use your own ids and labels only. Both are set once, on create; there is no update.

Most responses that change state include `next_step`, a plain sentence saying what to call next: creating a campaign, starting an audience upload, completing an audience, generating a creative, rendering a proof, getting a quote and requesting approval. Submitting, the sandbox advance and registering a webhook do not. `GET /v1/campaigns/{id}` always returns it, so read it there when a response has none.

### Campaign state machine

```mermaid
stateDiagram-v2
    [*] --> draft: create
    draft --> proof_ready: render proof
    proof_ready --> awaiting_approval: request approval
    awaiting_approval --> approved: approver approves
    awaiting_approval --> proof_ready: approver rejects
    proof_ready --> draft: new creative or audience
    awaiting_approval --> draft: new creative or audience
    approved --> draft: new creative or audience
    approved --> submitted: submit
    submitted --> in_production
    in_production --> at_usps
    at_usps --> in_postal_network
    in_postal_network --> delivery_estimated
    delivery_estimated --> completed
    submitted --> cancelled: Xcel ops
    in_production --> cancelled: Xcel ops
    completed --> [*]
    cancelled --> [*]
```

| Status | Label | Meaning |
| --- | --- | --- |
| `draft` | Draft | Building the campaign: audience, creative, proof. |
| `proof_ready` | Proof ready | A proof exists for the current creative and audience. |
| `awaiting_approval` | Awaiting approval | A human must approve the proof, quantity and total on the review page. |
| `approved` | Approved | Approved by a human; ready to submit. |
| `submitted` | Submitted | Order received by Xcel; queued for production. |
| `in_production` | In production | Printing and lettershop. |
| `at_usps` | Accepted at USPS (processing scan) | USPS acceptance scan recorded. Processing scan only; not proof of delivery. |
| `in_postal_network` | In postal network (processing scans) | Pieces are scanning through USPS processing facilities. Not proof of delivery. |
| `delivery_estimated` | Delivery window estimated (from processing scans) | Estimated in-home window derived from processing scans. Not proof of delivery. |
| `completed` | Completed | Mailing finished. USPS data does not confirm delivery to each address. |
| `cancelled` | Cancelled | Cancelled; nothing will mail. |

Rules the state machine enforces:

- After `submitted`, a campaign only moves forward. Xcel ops (live) or the sandbox advance endpoint (test) may skip statuses, for example from `submitted` straight to `at_usps`. A live order can also skip `at_usps` and go from `in_production` to `in_postal_network`, so a tracker must not expect every step. `completed` is set by Xcel, and results keep updating for 90 days after it.
- Only `submitted` and `in_production` campaigns can be cancelled after submission. The API has no cancel endpoint for partners; ask Xcel.
- `completed` and `cancelled` are final.
- Statuses with `status_evidence: "usps_processing_scan"` rest on USPS processing scans. Do not present them to a dealer as delivered.
- The creative and audience can change only in `draft`, `proof_ready`, `awaiting_approval` and `approved`. Later, a change is refused with `campaign_locked`.

A move that the state machine does not allow is refused with `invalid_status_transition`. Two requests racing on the same campaign can produce `campaign_changed`; fetch the campaign and retry.

## Standing orders

A **standing order** saves one repeating mailing for one dealer: the product, the template creative and its copy, the mail class, the most one mailing may cost (`max_spend_cents`, a figure a person set), the approver, a skip window, and optionally a `source_url` and a schedule. Each **run** turns a new list into an ordinary campaign through the same steps you would call one by one (audience, creative, proof, quote, approval request), after removing everyone the standing order mailed within its window (reason code `already_mailed`). A list can also arrive by email: a CDP or CRM that emails audience reports on a schedule sends them to the dealer's inbound address, and the standing order whose `inbound_subject` is in the subject runs. Every run's order still waits on a registered approver at the dealer, and an approved order submits itself or waits for your submit (`submit_on_approval`). See [Standing orders](standing-orders.md).

## Creative and audience versions

A campaign keeps every creative and audience it has had as numbered **versions**. Each `POST /creative` creates the next creative version. Each `POST /audience` creates the next audience version, which becomes current when it completes.

Changing either one voids everything that was bound to the old versions:

- the campaign returns to `draft` (from `proof_ready`, `awaiting_approval` or `approved`),
- every pending approval expires,
- an existing approval or quote for the old versions can no longer be used to submit.

So after any change, render the proof again, get a new quote and request approval again.

## Quotes

A **quote** prices the campaign's current mailable count. It records the creative version and audience version it covers, the mail class, line items, notes and an expiry (7 days by default, an Xcel setting). The price per piece comes from the price list and your monthly volume tier (the console's [Pricing](/console/pricing) page). See [Quotes and approvals](quotes-and-approvals.md).

## Approvals

An **approval** is a request for a human decision. It is bound to:

| Bound to | Checked again at submit |
| --- | --- |
| The campaign | Yes |
| The creative version | Yes (`approval_stale_creative`) |
| The audience version | Yes (`approval_stale_audience`) |
| The quote, and through it the quantity and total | Yes (`approval_quote_mismatch`, `quote_expired`) |
| The print-ready PDF (its sha256), where the proof was printed to PDF | Yes (`proof_pdf_changed`; also checked when the approver approves) |
| `max_spend_cents`, the ceiling the approver accepts | Yes (`max_spend_exceeded`) |
| Live: one registered approver's email | The review link goes only to that person |

An approval is `pending`, then `approved` or `rejected` by the human, or `expired`. It expires after 7 days by default (an Xcel setting) or when its quote expires, whichever is first. Requesting a new approval expires any earlier pending one, so at most one is pending per campaign.

The approval decision happens on the review page, not through the API. A caller's claim that a dealer approved is never an input. See [Quotes and approvals](quotes-and-approvals.md#the-approval-flow).

## Submissions

A **submission** is the order. A campaign has at most one. `POST /v1/campaigns/{id}/submit` takes the `approval_id` and an `Idempotency-Key`, re-checks everything the approval is bound to, the dealer's spend cap and (live) the partner's `ordering_enabled`, then moves the campaign to `submitted`.

## Idempotency

Submit is the one operation that spends money, so it requires an idempotency key. Creating a campaign takes one too, optionally, so a retried create returns the first campaign instead of a second one; saving a template, the dealer import and the audience import do the same.

- REST: send the `Idempotency-Key` header. MCP: pass `idempotency_key` to `submit_campaign`, `create_campaign` or `save_template`. On `POST /v1/campaigns/{id}/approval` it is optional, and a retry sends no second email. On `POST /v1/keys` it is required, and a retry answers `key: null`, since no stored answer holds a secret.
- A key is 1 to 255 printable ASCII characters with no spaces, and cannot start with `scoped:`. A UUID works.
- Keys are scoped to the partner and the mode: a sandbox key never replays a live response, nor the reverse, and the same key can name one sandbox and one live submission. A key limited to some dealers has its own namespace too ([Keys for one dealer](partners.md#keys-for-one-dealer)). Use one key per order. Create, template save, submit, the dealer import and the audience import share one key namespace, so do not reuse a create key for a submit (`idempotency_key_reused`).
- A repeat with the same key and the same request (for submit, the same campaign and `approval_id`; for create, the same body, in any key order) returns the stored response. REST adds `Idempotent-Replayed: true`; MCP adds `"idempotent_replay": true`. A create without a key answers no `idempotent_replay` field and always makes a new campaign.
- The same key with a different request is refused with `idempotency_key_reused`.
- While the first request is still running, a repeat gets `idempotency_in_progress`; wait and retry with the same key. The running request holds the key for at most 60 seconds, so if it crashed, the key frees up within a minute and a retry runs the submit again (the submit itself cannot happen twice).
- Refusals are not stored. If a submit is refused, fix the cause and retry with the same key.
- Over REST the body is checked before the key: a body that is not JSON, or fails its schema (a submit without `approval_id`, a create without `name`), is refused with `invalid_json` or `invalid_request` and the key is not used. A body with a field the endpoint does not declare is refused the same way (`invalid_request`), so a retry that differs only in such a field is never replayed.
- Stored responses are kept for 24 hours. After that, retrying a submission that went through returns `already_submitted`, and retrying a create makes another campaign; read the campaign status, or find the order with `GET /v1/campaigns?external_ref=`.

## Spend caps

A dealer's `spend_cap_cents` limits the total of submitted orders per calendar month in UTC. `request_approval` checks it first, so nobody is asked to approve an order over the cap, and the review page checks it again when the approver approves ([The approval flow](quotes-and-approvals.md#the-approval-flow)). A quote and `validate_campaign` show what is left (`dealer_spend_remaining_cents`). The check that counts runs at submit time, inside the submit transaction under a per-dealer lock, so two orders submitted at once cannot both use the same room under the cap: the sum of this month's submissions for the dealer, in the same mode and excluding cancelled campaigns, plus this order's total must not exceed the cap. Otherwise request approval, the approve on the review page or submit is refused with `dealer_spend_cap_exceeded`. Test and live submissions are counted separately. `null` means no cap. Xcel sets the cap.

## Events

Every status change and every important step writes an **event** to the campaign's history and queues a delivery to each matching webhook. Event payloads hold ids, statuses, counts and your own `external_ref` and `metadata`, never customer data. See [Webhooks](webhooks.md) for the event types. `GET /v1/events` lists the events webhooks carry for a time window, in the same envelope, so you can [reconcile a window you missed](webhooks.md#reconcile-a-window-you-missed).

## Results and attribution

After an order mails, Xcel's tracking system (UpDash) records what happens: USPS processing scans, responses (QR scans, web visits and PINs given, and appointments and showroom visits when someone records them in UpDash) and the dealer sales and service that its matcher ties to the mail. The Mail API brings these back and `get_campaign_results` (`GET /v1/campaigns/{id}/results`) returns them:

| Part | Holds |
| --- | --- |
| `results` | Aggregates: the UpDash job, drops, `delivery_percent` (pieces with USPS processing scans), responses by channel, matched sales and repair orders, and how many leads have results. `null` until the first results arrive. |
| `leads` | A page of per-lead results, each with your `external_id`, the `row_key`, its responses (type, label, time) and its matches (sale or service, date, new or used, `gross_cents` and `revenue_cents`). Never a name or an address. Page with `leads_after` and `leads_limit`. Narrow the page with `external_id` (one person, exact) or `updated_after` (leads whose results changed after that time). |

How results arrive:

- **Live orders.** Xcel links the order to its UpDash campaign when it goes into production, and `campaign.results_linked` says so. A job then polls UpDash every 6 hours, from `submitted` until 90 days after the order is `completed`, so late responses and matches still come in, and `completed` does not mean final. Until the link exists, `results` stays `null`. `results_status` says where it stands: `not_submitted`, `waiting_for_xcel_link`, `linked_waiting_for_first_poll` or `reporting`, and on a sandbox order `not_simulated_yet` before `in_postal_network`.
- **`responses`** has a count per channel, `total` (all responses), `leads` (the leads UpDash has for the order) and `unique_responders` (distinct people who responded). `leads` and `unique_responders` can differ.
- **Counts can fall.** A match can be withdrawn or reclassified (a sale that turns out to be a repair order, say), so totals can go down as well as up. Keep the newest snapshot; never add events up.
- **`data_warnings`** names results that cannot be right for this order as it stands, such as a drop or response dated before it was submitted. The values still come back: treat them as unconfirmed and ask Xcel.
- **Calls.** A live order's pieces print an UpDash tracking number in place of the store's phone unless the dealer or the order says otherwise ([Calls](#calls)), and each call comes back as a phone response, on the lead of the person who called when their number is on your list. Until Xcel switches call tracking on for your account ([changelog](changelog.md)), the store's line prints and the creative's `calls.fallback` is `off`.
- **Matches need the dealer's sales and service data.** UpDash's matcher reads it from the dealer's dealer management system (DMS). When that data reaches UpDash, matched sales and repair orders come back on the order. When it does not, responses, drops and delivery still come back, and the matched counts stay at zero. That zero means nothing was measured, not that nothing sold, and no field tells the two apart yet. The API cannot send this data and does not say whether a dealer's is current, so ask Xcel before you promise a dealer matched sales.
- **Print-ready art** has no PIN or response QR code, so expect totals and matched sales and service, with few or no per-lead responses (`per_lead_responses_expected: false`).
- **What a response holds.** Each is a type, a label and a time, and each match a date, kind, new or used and dollar figures. Call recordings, message text, page visits, vehicles and repair-order numbers are not exposed, and no expected in-home window comes back. Each piece's USPS scans come back on `GET /v1/campaigns/{id}/leads` instead ([Who was mailed](#who-was-mailed)). `responses.total` can exceed what the leads show: a response with no row key counts in the totals only.
- **Sandbox orders.** The sandbox advance endpoint (MCP `advance_test_campaign`) simulates results from `in_postal_network` on: realistic shape, invented values (the same each time for the same campaign), `"simulated": true`. It simulates every channel but calls, so your code meets each shape; a live order reports only what happens. The totals start at `in_postal_network`, the first per-lead responders at `delivery_estimated` and the matched sales and repair orders at `completed`. Sandbox time runs as fast as you advance: the order mails, lands and gets its responses when you advance it, so the drop's `home_date` and every response and match date follow the timeline, never the quote's `timing`. To test date logic such as a response window, measure from the timeline's `at_usps` or `delivery_estimated` entry.
- Each change sends a `campaign.results_updated` or `campaign.lead_results_updated` webhook, only when something changed ([Webhooks](webhooks.md#event-types)). The webhook names the changed leads. To read one, call results with its `external_id`, so you never page the whole campaign. To catch up on changes, send `updated_after`: a lead's `updated_at` moves only when its responses or matches change, and one poll stamps its leads with one time while it writes them over a few seconds, so overlap your windows by a few minutes.
- **A window you missed.** `GET /v1/events` lists your events by time, in the webhook envelope ([Reconcile a window you missed](webhooks.md#reconcile-a-window-you-missed)).
- **Retention.** 365 days by default after an order completes or is cancelled, its row keys and per-lead results are deleted; `results` stays and `leads` is empty from then on. Copy what you need before then ([Retention](audiences.md#retention)).

Results also move a live order's status forward, never back:

| UpDash shows | Status |
| --- | --- |
| A drop with the printer (pending at vendor, at vendor, ready to deploy, completed) | `in_production` |
| Any pieces with USPS processing scans | `in_postal_network` |
| 80% or more of pieces with processing scans | `delivery_estimated` |

The poller never sets `at_usps`, `completed` or `cancelled`; Xcel ops do. Scans are processing evidence, not proof of delivery to a mailbox.

Per-lead matches carry the dealer's own sales and service figures from its dealer management system (`gross_cents` and `revenue_cents`, integer cents like every amount in the API). Xcel shares them with the partner under the partner agreement, and only on the partner's own campaigns; treat them as the dealer's confidential data. Matches are made by Xcel's matcher, so a match is evidence that a mailed customer bought or came in, not proof that the mail caused it.

### Who was mailed

`GET /v1/campaigns/{id}/leads` pages every mailable row of the current audience: `row_key`, `external_id`, `audience_version`, `result_status` (`matched`, `responded` or `null`), `result_updated_at` and `usps`, the piece's USPS tracking. Ids only, never a name, address, phone or email. Page with `after` and `limit`, or read one shopper's rows with `external_id`. A new audience version has new row keys, so a cursor from before it is refused with 400: read from the first page.

`GET /v1/leads?external_id=` answers the same question across campaigns, for a CDP that shows a shopper's mail history: every campaign that shopper is on, in this key's mode and dealers, newest first, with `campaign_id`, `dealer_id`, `dealer_external_id`, `external_ref`, `status`, `mailed`, `row_key`, `audience_version` and `campaign_created_at`. An optional `dealer_id` narrows it to one store, when your stores' ids overlap. A campaign counts when the shopper has a row on its current audience, whatever its status, so read `status` and `mailed`.

An empty list means no current audience holds that id: the shopper was rejected, was never sent, or retention deleted the row keys. The audience's `reconciliation.rejected_rows` tells the first from the second: it names a rejected row's `external_id`. `GET /v1/campaigns/{id}/results` cannot tell you any of this: an empty page there means no results yet, not that nobody was mailed. Join the rows to your records by `external_id` to mark each shopper.

Mailable is not mailed:

- **`mailed`** turns true once the order reaches USPS (`at_usps` or later). It rests on a processing scan, not proof of delivery. A draft or a cancelled order lists its rows with `mailed: false`.
- **`address_processing`** gives the rows CASS and NCOA removed from a live order as counts (`cass_failed`, `ncoa_moved`), and the rows left out because their address is on the do-not-mail list (`do_not_mail`; not mailed, not billed). They do not say which rows, so up to that many of the rows listed may not have printed.
- **`usps`** is the piece's tracking from the scans USPS made of its Intelligent Mail barcode, read with the results every 6 hours once Xcel links a live order: `stage` (`in_transit` after any scan, `processed_for_delivery` once USPS sorted the piece for its carrier, which usually means it arrives within a day or two), `scans`, `first_scan_at`, `last_scan_at`, `last_op_code`, `last_facility` (USPS often sends only its ZIP) and `processed_for_delivery_at`. It is null before the piece's first scan, and a piece that never scans stays null: USPS does not scan every piece. Scans are not proof of delivery. `campaign.usps_tracking_updated` names the pieces whose stage moved ([Webhooks](webhooks.md#event-types)). Sandbox orders get simulated scans from `in_postal_network` on.
- **Retention.** Once the row keys are deleted the list is empty, `lead_data_purged_at` is set and `mailable_count` stays. An audience version never submitted loses its row keys with its files.

MCP has no tool for these lists. `get_campaign_results` takes `external_id` and `updated_after`.

## Test and live

The key's mode decides everything:

| | Test | Live |
| --- | --- | --- |
| Address processing | Simulated: every address passes, audience is `ready` at once | Manual CASS and NCOA by Xcel: audience is `pending_address_processing` until ops mark it done |
| Approval delivery | `review_url` returned with `sandbox_only: true` | Emailed to a registered approver; never returned |
| Approver check | None; any `approver_email` or none | Must be a registered approver |
| Spend cap | Counts test submissions only | Counts live submissions only |
| `ordering_enabled` | Not checked | Required |
| After submit | `POST /v1/test/campaigns/{id}/advance` (MCP `advance_test_campaign`) simulates production and, from `in_postal_network`, results | Xcel ops produce the order and move its status; results come from UpDash once ops link the order |
| Ops queue | Never appears | Appears from `submitted` until `completed` or `cancelled` |
