# Quotes and approvals

How a quote is built, how a human approves the spend, and every reason a submit is refused.

## Quotes

`POST /v1/campaigns/{id}/quote` (MCP: `get_quote`) prices the campaign as it stands. The body is optional:

```json
{ "mail_class": "first_class" }
```

`mail_class` is `first_class` or `marketing_mail`. A postcard mails First-Class only. Leave it out and a letter or fold card is quoted Marketing Mail.

**Prices come from your price list** (the console's [Pricing](/console/pricing) page): per piece, by product, mail class and your monthly volume tier. Quotes say `placeholder_pricing: false`. A quote made before 0.9.36 says `true` and was priced from the pilot's placeholder table: quote it again before you show it to anyone.

**The answer shows the dealer's spend cap.** Beside `quote`, the answer has `dealer_spend_cap_cents` (the dealer's monthly cap, set by Xcel) and `dealer_spend_remaining_cents` (what is left of it this calendar month, UTC, after the orders submitted so far in the same mode); both are null when the dealer has no cap. Orders approved but not yet submitted do not count until they submit. When `total_cents` is over what is left, `next_step` says so: `request_approval`, the approver's decision and submit refuse the order with `dealer_spend_cap_exceeded`, so reduce the audience and quote again, wait for the month to end (it names the date), or ask Xcel to raise the cap.

### How a quote is built

1. **Quantity** is the current audience's `mailable_count`: rows that passed intake, before CASS and NCOA.
2. **Mail class** is the one you asked for, or the product's default: First-Class for a postcard (its only class), Marketing Mail for a letter or fold card. The product must offer it (`mail_class_unavailable` otherwise). Below the Marketing Mail presort minimum, the small-run rule below applies.
3. **Tier.** Your volume tier: Standard, Volume or Scale, from the live pieces your account mailed last calendar month (UTC) or this month so far, whichever is higher (the console's [Pricing](/console/pricing) page). The size of the order does not change its price. A note says which tier priced it and why.
4. **Line items.** Two per-piece lines: `print_and_lettershop` and `postage` (a fixed price per mail class, the same in every tier). Both envelopes of a letter, and the fold card's, are in the print line ([A letter's envelope](concepts.md#a-letters-envelope)). Each has `quantity`, `unit_price_cents` and `total_cents`. From December 19, 2026, a design that uses an add-on adds its own line for every piece: `handwriting` when it sets a note or signature in a handwriting face, and `vehicle_photo` when it prints each customer's own vehicle (`{{recipient.vehicle_photo}}`); the console's Pricing page has their prices, and a vehicle named in a copy slot is no add-on. The quote's `unit_price_cents` is the lines' sum per piece; `total_cents` is the sum of the lines.
5. **Cost check.** Xcel never quotes below its cost. If a configured price is below Xcel's cost floor, or a product and mail class has no floor, the quote is refused with 500 `price_below_cost`. That is a configuration error at Xcel; nothing in your request needs to change.
6. **Notes** explain anything unusual: the small-run switch, the volume tier that priced the quote, and that pieces removed by address processing are not billed.
7. **Expiry.** The quote expires after 7 days by default (an Xcel setting).

The quote records the creative version and audience version it covers. Changing either makes it stale: `request_approval` refuses it with `quote_stale`, and an approval built on it fails at submit with `approval_stale_creative` or `approval_stale_audience` (or `approval_expired`, because the change also expires a pending approval).

A quote needs a creative (`creative_required`), a completed audience (`audience_required`) with at least one mailable row (`audience_empty`), and an editable campaign (`campaign_locked` after submission). It does not need a proof, but `request_approval` does.

### Small runs

USPS Marketing Mail needs at least 200 pieces per presorted mailing; Presorted First-Class Mail needs 500.

| Situation | What the quote does |
| --- | --- |
| Marketing Mail, 200 pieces or more | Marketing Mail at your tier's price. |
| Marketing Mail, under 200 pieces, with Xcel's small-run setting at First-Class (the default) | Switches to First-Class Mail and adds a note. |
| Marketing Mail, under 200 pieces, with Xcel's small-run setting at the weekly pooled run | Stays Marketing Mail with `pooled_weekly: true`: the order joins Xcel's weekly pooled run with other mailers' pieces, and the mail date may move to the next pool date. |
| First-Class Mail, under 500 pieces | The same price per piece as a larger run. |
| First-Class Mail requested explicitly | Stays First-Class at any quantity. |

The small-run setting is Xcel's, not a request field. `validate_campaign` tells you in advance which way a small run will go.

## The approval flow

`POST /v1/campaigns/{id}/approval` (MCP: `request_approval`):

```json
{ "quote_id": "0e0f8f4d-902c-40d1-ac8e-c47e14cb0758", "max_spend_cents": 450000, "approver_email": "gm@dealer.example" }
```

| Field | Rules |
| --- | --- |
| `quote_id` | A quote for the campaign's current creative and audience versions, not expired. |
| `max_spend_cents` | The most the approver agrees to spend, in cents: a positive integer, at least the quote total, at most 10,000,000,000. It is a figure a person gave: an agent never sets its own estimate or a higher number, and asks when no figure was given. A backend with nobody in the conversation may use a figure a person set in advance, such as the dealer's campaign budget in your system; the quote total alone is not one. The approver still sees and approves the order. |
| `approver_email` | Live: one of the dealer's registered approvers; omit it when exactly one is registered. Sandbox: any address, or omit it. |

Preconditions: the campaign must be `proof_ready` or `awaiting_approval` (call `render_proof` first; `proof_required` from `draft`), and its preflight must have no errors.

**The spend cap is checked before anyone is asked.** Xcel sets each dealer's monthly spend cap. When the quote total is more than what remains of the cap after this calendar month's submitted orders (UTC, same mode, cancelled orders excluded), `request_approval` is refused with 409 `dealer_spend_cap_exceeded`, the code submit uses. No approval is created and nobody is emailed, so a person never approves an order that submit would refuse. Reduce the audience and get a new quote, wait until next month, or ask Xcel to raise the cap. The cap is checked again when the approver approves on the review page and at submit, because other orders can be submitted, and Xcel can change the cap, while an approval waits ([Spend caps](concepts.md#spend-caps)). On the review page an approve that no longer fits is refused with the same code and nothing is approved; the approver can still reject. `validate_campaign` shows the same check in advance (`spend_cap`).

The new approval binds the campaign, the creative version, the audience version, the quote and `max_spend_cents`, and, where the proof was printed to PDF, the print-ready PDF's sha256. On a prescreened credit offer it also says that the approver will confirm the list ([Prescreened offers](#prescreened-offers)). It expires after 7 days by default (an Xcel setting) or when the quote expires, whichever is first. It expires any earlier pending approval, and moves the campaign from `proof_ready` to `awaiting_approval`.

### Live

```mermaid
sequenceDiagram
    participant P as Partner or agent
    participant API as UpDash Mail API
    participant M as Email (Mailgun)
    participant A as Registered approver
    P->>API: POST /approval (quote_id, max_spend_cents, approver_email)
    API->>API: check approver is registered
    API->>M: send review link
    M->>A: email with /review/{token}
    API-->>P: approval_id, status pending, masked email, total, expiry (no link)
    A->>API: open the review page, check the proof
    A->>API: approve or reject
    P->>API: GET /v1/campaigns/{id} (poll) or receive approval.decided webhook
    P->>API: POST /submit with approval_id and Idempotency-Key
```

- You name each dealer's approvers; each confirms by email before being registered, at once or after Xcel checks the address ([Approvers](dealers.md#approvers)). No REST endpoint or MCP tool writes the list directly. `GET /v1/dealers/{id}/brand` shows them masked.
- The link goes only to the approver by email. It is never returned to the API or MCP caller and never written to a log. Click tracking is off, so the link is not rewritten.
- The response is:

  ```json
  {
    "approval_id": "96706396-e7df-4043-a724-a640c6e14f3a",
    "status": "pending",
    "approver_email": "g***@dealer.example",
    "total_cents": 380,
    "expires_at": "2026-11-09T15:00:00.000Z",
    "prescreen_attestation": null,
    "next_step": "Xcel emailed the review link to the approver. Poll get_campaign_status until latest_approval.status is approved, then submit_campaign with this approval_id. The link is never given to API callers, and nothing a caller says counts as approval."
  }
  ```

- If email is not configured on the server, the request is refused with 503 `approval_delivery_unavailable` and nothing is created. If the send fails, the new approval is expired at once and the request fails with 502 `approval_delivery_failed`; retry later. A pending approval from an earlier request is expired too, so retry the request to get a new one.

The email subject reads `Approve mail order for <dealer>: <quantity> pieces, <total>` and the body names the product, the quantity, the total, the estimated mail and in-home dates and the link's expiry, and says the total and dates are placeholders.

### Sandbox

- No registry check and no email.
- The response adds `review_url` and `sandbox_only: true`, so the developer testing the integration can open the review page and decide.
- An agent must not open `review_url` itself. Hand it to the human.
- A script or CI job can decide with `POST /v1/test/campaigns/{id}/approval`, with `approval_id` and `decision`. It makes every check the review page makes, and `approval.decided` carries `decided_via: "sandbox_test_route"`. A live key is refused with `test_mode_only`. There is no MCP tool for it, so an agent still hands the link to a person, or opens the proof in the chat with `show_proof`, where the developer can decide ([The proof in the chat](mcp.md#the-proof-in-the-chat)).

### The review page

`/review/{token}` is the only place a live order is approved. Its **Skip to your decision** link jumps past the proof. It shows, under the headings **Order**, **Proof** and **Decision**:

- the dealer, product, quantity, mail class (and the weekly pooled run, if any), the total, the approved maximum, the requested mail date, the status and when the link expires,
- the quote's line items and notes (the **Price breakdown** table),
- the proof: three sample pages and the worst case. Where PDF rendering is on, this is the PDF review proof shown in the page (the print-ready pages with the guides drawn on top), after a one-line text summary of the order and a **Download the proof (PDF)** link; it is the exact file that will print, and the page shows nothing else. Where PDF rendering is off, an HTML preview in a sandboxed frame,
- for a sandbox order, a banner saying nothing will print.

A fold card's proof shows the flat sheet, so page 1 has the cover upside down in its top half. The page says so: "This card prints flat: the upside-down top half of page 1 becomes the cover, and it reads upright once folded."

To approve, the person enters their email in **Your email** (or sees "Deciding as" with the registered approver's email), ticks "I reviewed the proof, the quantity and the total of <total>, and I approve this spend", and chooses **Approve order**. On a prescreened credit offer they also confirm the list and enter its date first ([Prescreened offers](#prescreened-offers)). **Reject order** needs no tick; the optional **Note** (up to 2,000 characters) should say what needs to change. Anyone who holds the link can decide, so the link must stay with the approver.

| Outcome | Campaign status | Event | The page then says |
| --- | --- | --- | --- |
| Approve | `approved` | `approval.decided` with `decision: "approved"` | "Order approved." The sender can now submit. |
| Reject | Back to `proof_ready` | `approval.decided` with `decision: "rejected"` and `has_note` | "Order rejected." A changed order gets a new review link. |

When a link can no longer approve (the creative, audience or quote changed, or the quote expired), the page says so under **Decision**, gives the reason, and shows no form.

A refused decision redirects back with the code in `?error=`. The page never shows the code: it puts "Your decision was not recorded." at the top with plain-English text, ties field problems to the field (with a **Go to the email field**, **Go to the confirmation box**, **Go to the prescreened list box** or **Go to the list date** link), and starts the page title with "Decision not recorded".

| Code | Shown to the approver |
| --- | --- |
| `approver_email_required` | Enter your email address so the order records who decided, then choose Approve order or Reject order again. |
| `invalid_request` | Some of what you entered was not accepted. Check your email address, then try again. |
| `confirmation_required` | To approve, tick the box to confirm you reviewed the proof, the quantity and the total, then choose Approve order again. |
| `prescreen_confirmation_required` | This piece is a prescreened credit offer. To approve, tick the box to confirm the mailing list is a prescreened list from the consumer reporting agency the piece names, then choose Approve order again. If it is not, reject the order. |
| `prescreen_list_date_required` | Enter the date the consumer reporting agency produced the prescreened list, then choose Approve order again. |
| `prescreen_list_date_invalid` | The list date was not accepted. Enter the date the consumer reporting agency produced the list: a real date, not in the future and not more than a year ago. Then choose Approve order again. |
| `approver_mismatch` | This link was sent to a different approver, so it cannot record a decision for your email address. Ask the sender to request approval for your email address. |
| `approval_stale` (and any `approval_stale_*`) | The order changed after this link was sent (its design, mailing list or price), so this link can no longer approve it. Ask the sender for a fresh review link. |
| `approval_expired` | This review link has expired, so it can no longer approve the order. Ask the sender for a fresh review link. |
| `quote_expired` | The price quote for this order has expired, so this link can no longer approve it. Ask the sender for a new quote and a fresh review link. |
| `max_spend_exceeded` | The order total is now more than the maximum this link can approve. Ask the sender to request approval again for the new total. |
| `dealer_spend_cap_exceeded` | Approving this order now would take the dealer over its monthly mail spending limit, because other orders were placed or the limit was lowered after this link was sent. Nothing was approved. Ask the sender to make the order smaller or wait until next month, or ask Xcel to raise the limit. |
| `proof_pdf_changed` | The proof changed after this link was sent, so this link can no longer approve the order. Ask the sender for a fresh review link. The partner renders the proof again and requests a new approval. |
| `approval_already_decided` | A decision was already recorded on this link, so nothing changed. If you did not make it, contact the sender. |
| Any other code | Your decision was not recorded because of a problem on our side. Reload the page and try again. If it happens again, contact the sender. |

The token in the link is 256 bits of randomness, stored only as a hash. The page is `noindex` and sends no referrer.

### Prescreened offers

A prescreened credit offer may be mailed only to a prescreened list: one a consumer reporting agency produced for the offer (FCRA, 15 U.S.C. 1681b(c)). The API cannot tell such a list from a CDP, CRM or DMS customer list, so a person who knows says so, on the record. The piece is a prescreened offer when its template has `requires_prescreened_list: true` (`compliance.prescreen` `always`), or when it prints the FCRA notices, which preflight requires of any copy with pre-approval language ([Compliance checks](creative.md#compliance-checks)). Print-ready art cannot be read, so never send a prescreened offer as artwork.

- **`request_approval` says so.** The answer carries `prescreen_attestation` (null for any other piece) with the agency the piece names (`copy.prescreen_cra`), and its `next_step` says the approver will be asked to confirm the list. Tell the person who orders: if the list is their own customer list, the approver will reject the order.
- **The review page asks.** Under **Prescreened credit offer**, the approver ticks "The mailing list is a prescreened list from <the agency>." and enters **Date the agency produced the list**. Both are needed to approve, in the sandbox too; rejecting needs neither. The date must be a real date, not in the future and not more than a year ago.
- **The server checks.** The decision is refused without them (`prescreen_confirmation_required`, `prescreen_list_date_required`, `prescreen_list_date_invalid`; nothing is approved), and the database refuses an approved prescreened offer without the confirmation.
- **The approval records them.** `latest_approval.prescreen_attestation` on the campaign (`GET /v1/campaigns/{id}`, MCP `get_campaign_status`) and the `approval.decided` webhook show the agency, the list date and when the approver confirmed:

  ```json
  "prescreen_attestation": {
    "required": true,
    "consumer_reporting_agency": "Example Credit Bureau, P.O. Box 0000, Anytown, ST 00000",
    "list_date": "2026-10-15",
    "confirmed_at": "2026-11-03T10:05:00.000Z"
  }
  ```

  Until the approver approves, `list_date` and `confirmed_at` are null.

### When an approval expires

An approval in `awaiting_approval` that expires can be replaced: get a new quote if needed and call `request_approval` again. A new request expires the one before it. Deciding the old one answers 409 `approval_expired`: the sandbox route's `fix` names the newer approval, and the review page sends the person to the newest link.

**A retried request.** Without a key, each call expires the pending approval and, live, emails the approver again. Send an `Idempotency-Key` on `POST /v1/campaigns/{id}/approval` to retry safely: the same key and body within 24 hours answer the first answer (`Idempotent-Replayed: true`), with no second email and the first link still working. The same key with another body is 409 `idempotency_key_reused`, and an email that failed stores nothing, so a retry sends it. A live answer holds no review link, so nor does its stored copy.

An approval that expires after the campaign is `approved` cannot be replaced directly: submit refuses it (`approval_expired` or `quote_expired`), and `request_approval` refuses an `approved` campaign (`invalid_status`). Send the creative again (the same copy is fine) to return the campaign to `draft`, then render the proof, get a quote and request approval. Submit soon after approval to avoid this.

### Request-approval refusals

| Code | HTTP | Cause |
| --- | --- | --- |
| `proof_required` | 409 | The campaign is `draft`. Render the proof first. |
| `invalid_status` | 409 | The campaign is `approved` or later. |
| `preflight_failed` | 422 | The creative has preflight errors. |
| `not_found` | 404 | The `quote_id` does not belong to this campaign. |
| `quote_expired` | 409 | The quote has expired. |
| `quote_stale` | 409 | The quote is for an older creative or audience. |
| `max_spend_too_low` | 400 | `max_spend_cents` is below the quote total. |
| `dealer_spend_cap_exceeded` | 409 | The quote total is over what remains of the dealer's monthly spend cap. Nothing was sent to an approver. |
| `no_registered_approver` | 409 | Live: the dealer has no registered approver. Name one ([Approvers](dealers.md#approvers)). |
| `approver_not_registered` | 400 | Live: `approver_email` is not one of the dealer's registered approvers. |
| `approver_email_required` | 400 | Live: the dealer has several registered approvers; name one. |
| `approval_delivery_unavailable` | 503 | Live: email is not configured; nothing was created. |
| `approval_delivery_failed` | 502 | Live: the email send failed; the approval was expired. |
| `proof_pdf_missing` | 409 | PDF rendering is on and no PDF proof exists for the current creative and audience. Call `render_proof` first. |
| `proof_disclosures_changed` | 409 | Xcel changed the dealer's disclosures after the proof was rendered. Call `render_proof` again; the quote stays good ([Get disclosures before you build](going-live.md#get-disclosures-before-you-build)). |

## Submit

`POST /v1/campaigns/{id}/submit` with `{"approval_id": "..."}` and an `Idempotency-Key` header (MCP: `submit_campaign` with `idempotency_key`). See [Concepts](concepts.md#idempotency) for how keys work.

### Submit refusals

Submit re-checks everything, in this order, and returns the first refusal. Refusals are not stored against the idempotency key, so fix the cause and retry with the same key.

| Code | HTTP | Cause | Fix |
| --- | --- | --- | --- |
| `invalid_request` | 400 | A bad body. | Send `approval_id`. |
| `idempotency_key_required` | 400 | No `Idempotency-Key`. | Send one key per order. |
| `invalid_idempotency_key` | 400 | Not 1 to 255 printable ASCII characters without spaces. | Use a UUID. |
| `invalid_request` | 400 | A key that starts `scoped:`. | Use a UUID for the key. |
| `idempotency_key_reused` | 409 | The key was used for a different request. | Use a new key for a new order. |
| `idempotency_in_progress` | 409 | A request with this key is still running. | Wait and retry with the same key; a crashed request frees the key within 60 seconds. |
| `not_found` | 404 | The campaign does not exist for this key's partner and mode. | Check the id and the key. |
| `already_submitted` | 409 | The campaign was already submitted. | Follow it with `GET /v1/campaigns/{id}`. |
| `approval_not_found` | 404 | No approval with that id for this campaign. | Call `request_approval`. |
| `approval_pending` | 409 | The approver has not decided. | Wait. A caller cannot approve. |
| `approval_rejected` | 409 | The approver rejected the order. | Change the campaign, render a proof, request approval again. |
| `approval_expired` | 409 | The approval expired. | See [When an approval expires](#when-an-approval-expires). |
| `approval_stale_creative` | 409 | The creative changed after the approval was requested. | Proof, quote and request approval again. |
| `approval_stale_audience` | 409 | The audience changed after the approval was requested. | Proof, quote and request approval again. |
| `approval_quote_mismatch` | 409 | The approved quote no longer matches the current versions. | Quote and request approval again. |
| `quote_expired` | 409 | The approved quote expired. | Quote and request approval again. |
| `max_spend_exceeded` | 409 | The quote total is above the approved `max_spend_cents`. | Request approval with a higher ceiling. |
| `campaign_not_approved` | 409 | The campaign is not in `approved` status. | Read `next_step` from the campaign status. |
| `no_registered_approver` | 409 | Live: the dealer no longer has a registered approver. | Name one with `POST /v1/dealers/{id}/approvers`. |
| `ordering_disabled` | 403 | Live: Xcel has not enabled live ordering for your partner. | Use a sandbox key, or ask Xcel. |
| `dealer_spend_cap_exceeded` | 409 | This order plus the dealer's submitted spend this UTC month exceeds the cap. The message gives the remaining amount. The check is repeated inside the submit transaction under a per-dealer lock, so two orders submitted at once cannot both pass the same cap. | Reduce the audience, wait for next month, or ask Xcel to raise the cap. |
| `proof_pdf_changed` | 409 | The stored print-ready PDF no longer matches the sha256 the approval recorded. | Render the proof again and request a new approval. |
| `campaign_changed` | 409 | Another request moved the campaign at the same moment, so the submit did not go through. | Fetch the campaign status and retry with the same key. |

A successful submit returns 201 with the submission, moves the campaign to `submitted` and, for a live order, puts it in Xcel's ops queue (`in_ops_queue: true`).

## Mail dates

**Timing is a placeholder too.** These numbers are estimates for the pilot, not guarantees, and `placeholder_timing: true` says so on every `timing` object. Never show these dates to a store as a promise.

| Step | Placeholder |
| --- | --- |
| Daily cut-off | 10:00 Pacific. A later submit, or one on a weekend, counts from the next business day. |
| With USPS | Within 2 business days of that start. |
| First USPS scans | First-Class Mail: 3 business days after mailing. Marketing Mail: 4 to 5. |
| In homes | First-Class Mail: 5 to 7 business days after mailing. Marketing Mail: 7 to 21. |
| Furthest requested date | 180 days out. Later is refused with 400 `mail_date_too_far`. |

Business days are Monday to Friday, and holidays are not counted.

`timing` comes back on `create_campaign`, on `get_quote` inside `quote`, on `get_campaign_status`, on `submit_campaign` and its `submitted` status event, and on `get_campaign_results`, the same over REST and MCP:

```json
"timing": {
  "mail_class": "first_class",
  "earliest_mail_date": "2026-11-04",
  "mailed_by": "2026-11-04",
  "first_scan_by": "2026-11-09",
  "in_home_from": "2026-11-11",
  "in_home_to": "2026-11-13",
  "placeholder_timing": true
}
```

| Field | Meaning |
| --- | --- |
| `mail_class` | The class the dates use: the quote's, or Marketing Mail before a quote. A small run can quote as First-Class Mail, which changes the dates. |
| `earliest_mail_date` | The soonest the mail can be with USPS. |
| `mailed_by` | The later of `earliest_mail_date` and `requested_mail_date`. A requested date on a weekend moves to the Monday. |
| `first_scan_by` | First USPS scans by this date, at the top of the range above. |
| `in_home_from`, `in_home_to` | The in-home range. |
| `placeholder_timing` | `true` while these are placeholders. |

Before submit the dates count from now, so they move as days pass. Submit fixes them from the submit time. They do not follow production afterward: the status and its events say what really happened. `timing` is null from `delivery_estimated` on, when USPS's scans say more than an estimate can, on a cancelled order, and on results before submit. On a portal, show it beside an open order and hide it when it is null. An order in the weekly pooled run (`pooled_weekly: true`) can mail later than `mailed_by`. In the sandbox the dates show what a live order would get, and nothing mails.

**`earliest_mail_date` is the rule.** There is no other minimum lead time: an earlier "keep at least 7 days" is replaced by these dates. `requested_mail_date` is a request. `validate_campaign` adds a `mail_date` check that fails when the date is before the earliest possible one; the check does not stop a proof, a quote or an approval, and the order then mails on `mailed_by`. Without a date, Xcel mails on the first available one.

## Totals before address processing

A live quote counts the audience before CASS and NCOA, which run after submit. The approver approves that total. Pieces those checks remove are not billed, and the adjustment happens outside the API. An order quoted before 0.9.36 carries `placeholder_pricing: true` on the quote, the submit answer, the `submitted` status event and the status: its total came from the pilot's placeholder table.
