# Audiences

How to prepare and upload the mailing list, what the server does to it, and how it reports what it rejected.

An **audience** is one CSV of recipients for one campaign. Send it in one call, as a link Xcel fetches once (`source_url`) or as the request body, or PUT it to a signed upload URL ([Upload flow](#upload-flow)). Either way the file goes to private storage, and the API answers with counts, reason codes and spreadsheet row numbers only. Rows never come back in a response and never reach a log. Over MCP they never pass through the model: `upload_audience` takes a link, or hands out a signed URL for your host to PUT the file to.

## Sample file

```csv
external_id,first_name,last_name,address1,address2,city,state,zip,vin,vehicle_year,vehicle_make,vehicle_model,service_advisor
crm-1001,Maria,Lopez,412 Cedar Ln,,Springfield,IL,62704,1HGCV1F30LA012345,2020,Honda,Accord,Dana
crm-1002,James,O'Brien,88 Lake Shore Dr,Apt 3B,Chicago,IL,60611-2201,,2018,Ford,Escape,
crm-1003,Priya,Shah,1200 W Main St,,Peoria,IL,61606,,2022,Toyota,RAV4,Ravi
```

`external_id` is your own id for the record; send it on every row (see [Lead identity](#lead-identity)). If your export calls it something else (`customer_id`, `contact_id`, `lead_id`), name it in [`column_map`](#column-mapping-column_map) when you complete the upload: `{"customer_id": "external_id"}`. Without it every per-lead result comes back with `external_id: null`. `service_advisor` is a custom column. A creative can print it as `{{recipient.service_advisor}}`.

Phone and email columns are optional. UpDash uses them to match the responses and sales that follow a mailing to the piece; they are never printed and never returned ([Column warnings](#column-warnings)). Never send dates of birth: for a birthday mailing, select this month's birthdays on your own side and send only those people. A file may leave out `city` and `state` when every row has a valid ZIP ([City and state from the ZIP](#city-and-state-from-the-zip)).

## Columns

### Required

| Column | Accepted values |
| --- | --- |
| `first_name` | Any text, at most 100 characters. |
| `last_name` | Any text, at most 100 characters. |
| `address1` | Street address, at most 100 characters. |
| `city` | At most 100 characters. Filled from the ZIP when blank or when the file has no `city` column ([City and state from the ZIP](#city-and-state-from-the-zip)). |
| `state` | Two-letter USPS code or the full name (`IL`, `Illinois`, `N.Y.`). Territories `PR`, `GU`, `VI`, `AS`, `MP` and military `AA`, `AE`, `AP` are accepted. Filled from the ZIP like `city`. |
| `zip` | ZIP or ZIP+4: `62704`, `62704-1234` or `627041234`. A 3- or 4-digit ZIP gets its leading zeros back (`2134` becomes `02134`). |

### Optional

| Column | Accepted values |
| --- | --- |
| `address2` | Apartment, suite or unit. |
| `vin` | 17-character VIN. An invalid VIN is blanked, not rejected. |
| `vehicle_year` | Four digits from 1900 to two years ahead. An invalid year is blanked, not rejected. |
| `vehicle_make` | Text. |
| `vehicle_model` | Text. |
| `external_id` | Your own id for the record (a CRM or CDP id), at most 128 characters; a longer value rejects the row with `field_too_long`. Strongly recommended: per-lead results come back keyed by it, and without it you cannot join a result to your record. Use an opaque id, never an email address, phone number or name: it is stored apart from the file, kept after the files are deleted, and returned in results and webhooks. A value that looks like an email address or a formatted phone number (for example `(555) 010-0100` or `+15550100100`) is blanked with the warning `external_id_contact_info_blanked` and the row still mails; a bare run of digits is kept, since numeric CRM ids are common. A duplicate or a blank is a warning (`duplicate_external_id`, `external_id_blank`), not a rejection. The header `externalid` is accepted too. |

### City and state from the ZIP

When a row has a valid ZIP but a blank `city` or `state`, or the file has no such column, the intake fills them from a table of US ZIP codes bundled with the API. So a CDP export with `first_name,last_name,address1,zip` is enough.

- A blank `state` is filled from any ZIP the table knows. A blank `city` is filled only when the row's state is the ZIP's own (or blank), so a row never gets a city from one state beside another.
- A ZIP the table does not know fills nothing: the row is rejected as `missing_city` or `missing_state`, as before. A blank city or state beside a missing or invalid ZIP is rejected as `missing_zip` or `invalid_zip`, since the ZIP is what to fix.
- A state the row sends is never replaced, and an unknown one is still `invalid_state`.
- The filled place is the first one the table lists for the ZIP, which can differ from the name a recipient uses: `02134` fills `Allston`, where USPS prefers `Boston`. Military ZIPs fill `APO`, `FPO` or `DPO` with `AA`, `AE` or `AP`. A filled city keeps the table's spelling.
- The report names the filled rows: the info warning `city_state_filled_from_zip` in `column_warnings`, with their spreadsheet rows (up to 1,000) and the count in `warnings` ([Column warnings](#column-warnings)).
- CASS corrects the whole last line (city, state and ZIP+4) before a live order prints ([Address processing](#address-processing)), so a filled city only has to be close. Send your own `city` and `state` to print them on the proof.

The table has about 41,500 ZIPs, from the [GeoNames](https://www.geonames.org) US postal code file (`US.zip`), licensed under [Creative Commons Attribution 4.0](https://creativecommons.org/licenses/by/4.0/). Xcel keeps one place per ZIP and leaves out codes the intake does not accept.

### A CDP export as it comes

An audience export from a CDP or CRM usually mails with no `column_map`. The intake reads these shapes on its own, and the report counts each one:

- **One column for the whole address.** A file with no `zip` column whose `address1` (or `address`) holds `123 Main St, Apt 4, Springfield, IL 62704` is split on each row into `address1`, `address2`, `city`, `state` and `zip` (`address_split_from_one_column`). It reads when most of the file's addresses end in a real state and ZIP; a row that does not is rejected as `missing_zip`. An `address1` like that beside its own `city`, `state` and `zip` columns gives up only the street: those columns win.
- **One column for the whole name.** A file with no `first_name` or `last_name` column whose `name`, `full_name` or `customer_name` column holds `THOMAS DONNELLY` is split on each row into `first_name` and `last_name` (`name_split_from_one_column`), then cased as any name is. A name of two to four words takes the first word and the last: a middle name or initial is dropped, a suffix (`Jr`, `Sr`, `II`, `III`, `IV`) stays with the last name, and a title (`Mr`, `Dr`) is dropped. One comma reverses it: `Donnelly, Thomas` is Thomas Donnelly. A business or a household (`Lakeside Motors LLC`, `Smith Family Trust`, `Ann and Bo Lee`), one word, or a name the rules cannot read has no first name and keeps the whole value as `last_name`, so the row mails and a template prints its wording for no first name.
- **Whole address beside a street column.** A header named `Address` next to `Street Address` (or any other `address1` spelling) keeps its value as the custom column `full_address`, and the street column is `address1`.
- **A dash for nothing.** A cell holding only `-`, `–` or `—` is blank, so a missing name or address is rejected with its reason, never printed.
- **The record id.** `shopper_id` is read as `external_id`, when the file has no `external_id` column.
- **The vehicle in the customer's history.** A file with no `vehicle_year`, `vehicle_make` or `vehicle_model` column takes each row's vehicle from the first of these that has one: `latest_owned_vehicle`, then `last_sold_vehicle`, then `last_serviced_vehicle`. Each holds the vehicle as `2023 Toyota Camry`, or as parts: `last_sold_vehicle_year`, `last_sold_vehicle_make`, `last_sold_vehicle_model`, also without the word `vehicle`, and `sold_vehicle_year` and the like. The VIN comes from that same source (`latest_owned_vin`, `last_sale_vin`, `last_service_vin`, `last_serviced_vin`, `sold_vehicle_vin` and the like: the table below), so a row never prints one car with another's VIN (`vehicle_from_history_columns`). A file's own `vin` column wins.

The source columns stay in the file as custom merge fields. A vehicle of interest and a trade-in are never read, because a piece that says "your vehicle" must not name a car the customer does not own. The last sold vehicle may be one they have since sold, so export the latest owned vehicle when you have it.

**Choosing the vehicle.** A service mailing means the car they service, and a file with both prints the sold one first. Send `vehicle_source` with the import or the completion, with no change to the file. `"owned"`, `"sold"` or `"serviced"` puts that history first, and the others stay as the fallback, so a shopper with no service history keeps the car they bought:

```json
{ "audience_id": "6a1c…", "vehicle_source": "serviced" }
```

On a CSV body it goes in the query: `POST .../audience/import?vehicle_source=serviced`. MCP: `vehicle_source` on `upload_audience`, with `source_url` or `uploaded_audience_id`. Left out, the order is owned, sold, serviced. The report's `vehicle_sources` counts the rows that took their vehicle from each history, and `vehicle_source` says what was sent. Sent again with another value on a processed audience, the same file is processed again as a new version with no new PUT, keeping its `column_map`, and a later `column_map` keeps the `vehicle_source`. A file's own `vehicle_year`, `vehicle_make` or `vehicle_model` column wins over any history. That, or a file without the history you named, adds the column warning `vehicle_source_unused`.

| `vehicle_source` | The whole vehicle (`2022 Honda Accord`) | Its VIN | Its parts |
| --- | --- | --- | --- |
| `owned` | `latest_owned_vehicle`, `last_owned_vehicle`, `owned_vehicle` | `latest_owned_vin`, `last_owned_vin`, `owned_vin`, `latest_owned_vehicle_vin` and the like | `latest_owned_vehicle_year`, `_make`, `_model`, also without the word `vehicle` |
| `sold` | `last_sold_vehicle`, `last_sale_vehicle`, `sold_vehicle` | `last_sold_vin`, `last_sale_vin`, `sold_vin`, `sold_vehicle_vin` and the like | `last_sold_vehicle_year`, `_make`, `_model`, also without the word `vehicle` |
| `serviced` | `last_serviced_vehicle`, `last_service_vehicle`, `serviced_vehicle` | `last_serviced_vin`, `last_service_vin`, `serviced_vin`, `serviced_vehicle_vin` and the like | `last_serviced_vehicle_year`, `_make`, `_model`, also without the word `vehicle` |

Headers match in any case and spacing, so `Last Service VIN` reads as `last_service_vin`. Two maps do harm, so leave them out:

- **A computed name as a target.** `vehicle`, `vehicle_photo`, `make_logo` and `address_block` are names the API builds for each recipient, so a column mapped to one would never print. `column_map` refuses them with 422 `column_map_invalid`, and the `fix` says what to send. To name a column yourself, map a whole vehicle to `latest_owned_vehicle` and its VIN to `latest_owned_vin`, or the parts to `vehicle_year`, `vehicle_make` and `vehicle_model`.
- **One VIN alone.** `{"Last Service VIN": "vin"}` beside the sold car pairs that car with the serviced car's VIN, since a file's own `vin` wins. Send `vehicle_source` instead.
 Consent columns such as `Contact by Email` are about email and text, not mail, and the intake does not act on them: leave out anyone who asked not to get mail, or send them in a [suppression list](#suppression-list).

### Custom merge fields

Every other column is kept as a custom merge field for the creative. Rules:

- After header normalization the name must start with a letter and use only lower-case letters, digits and underscores, at most 40 characters.
- At most 50 custom columns, and 500 columns in all. Standard columns do not count as custom. Past 50, drop the columns the creative does not use.
- Values may be up to 500 characters.
- A column named `source_row` is reserved and ignored.
- `ResponseCode`, `response_code` and `row_key` (after normalization) are reserved, because the Mail API adds each row's key as `ResponseCode`. A file that has one is refused with `audience_file_invalid`; send your own id as `external_id`, or rename the column with `column_map` (`{"ResponseCode": "partner_code"}`).
- `external_id` counts as a custom column (toward the 50) and appears in the report's `columns`.

### Header normalization

Headers are trimmed, lower-cased, and every run of other characters becomes `_`. So `First Name` becomes `first_name`. These aliases map to the standard names:

| Standard column | Also accepted |
| --- | --- |
| `first_name` | `firstname`, `first`, `fname` |
| `last_name` | `lastname`, `last`, `lname`, `surname` |
| `address1` | `address`, `address_1`, `addr1`, `street`, `street_address`, `address_line_1`, `address_line1` |
| `address2` | `address_2`, `addr2`, `address_line_2`, `address_line2`, `unit`, `apt` |
| `state` | `st`, `state_code`, `province` |
| `zip` | `zip_code`, `zipcode`, `postal_code`, `postalcode`, `zip5` |
| `vehicle_year` | `year`, `model_year` |
| `vehicle_make` | `make` |
| `vehicle_model` | `model` |

These spellings are also accepted, but only when no other header already names that column and only one header could. So a file with both `city` and `town` keeps `town` as a custom column, and a file with both `town` and `city_name` but no `city` maps neither; name one in `column_map`.

| Standard column | Also accepted |
| --- | --- |
| `first_name` | `given_name`, `f_name`, `first_nm`, `forename` |
| `last_name` | `family_name`, `l_name`, `last_nm` |
| `address1` | `addr`, `addr_1`, `addr_line_1`, `address_line`, `address_one`, `street1`, `street_1`, `street_line_1`, `street_address_1`, `line1`, `line_1` |
| `address2` | `addr_2`, `addr_line_2`, `address_two`, `street2`, `street_2`, `street_line_2`, `street_address_2`, `line2`, `line_2`, `apartment`, `apt_no`, `apt_number`, `apt_suite`, `suite`, `unit_number` |
| `city` | `town`, `city_name`, `address_city` |
| `state` | `state_abbr`, `state_abbreviation`, `state_province`, `state_name`, `address_state` |
| `zip` | `postcode`, `post_code`, `zip_postal`, `zip_postal_code`, `zip_code_5`, `zipcode5`, `address_zip` |
| `vin` | `vin_number`, `vin_no`, `vehicle_vin`, `vehicle_identification_number` |
| `vehicle_year` | `veh_year`, `vehicle_model_year` |
| `vehicle_make` | `veh_make`, `make_name` |
| `vehicle_model` | `veh_model`, `model_name` |

Under the same rule, a camelCase header is read as words (`FirstName`, `AddressLine1`, `ZIPCode`, `VehicleYear`), and a person or address column may carry a CRM prefix: `customer_`, `cust_`, `contact_`, `owner_`, `buyer_`, `primary_`, `mailing_`, `mail_`, `home_`, `recipient_`, `person_`, `lead_`, `prospect_` or `client_` (`customer_first_name`, `mailing_address`, `mailing_zip`). A custom camelCase column keeps its plain name (`serviceAdvisor` is `serviceadvisor`). Spellings such as `First Name`, `Address 1`, `Zip Code`, `Postal Code`, `State Code` and `Model Year` already normalize to an alias and need no map.

The same column twice in the header (after normalization) is refused.

### Column mapping (`column_map`)

Send `column_map` with `POST /v1/campaigns/{id}/audience/complete` (MCP: the second `upload_audience` call) to rename the file's columns to ours before the file is checked. Keys are your headers, values are our columns:

```json
{
  "audience_id": "6a1c…",
  "column_map": {
    "customer_id": "external_id",
    "addr1": "address1",
    "postal_code": "zip",
    "lease_maturity_date": "lease_end_date"
  }
}
```

- A value is a standard column (`first_name`, `last_name`, `address1`, `address2`, `city`, `state`, `zip`, `external_id`, `vehicle_year`, `vehicle_make`, `vehicle_model`, `vin`) or a custom merge column name (the rules in [Custom merge fields](#custom-merge-fields)), for example a column a template reads such as `lease_end_date`. A value goes through the same aliases as a header, so `"postal_code"` as a value means `zip`.
- A key matches a header exactly, or in any case and spacing (`"Customer ID"`, `"customer_id"` and `"CUSTOMER-ID"` are the same key).
- The map is applied before validation, so it can supply a missing required column (`{"mail_line_one": "address1"}`), rename a reserved column away (`{"ResponseCode": "partner_code"}`) or swap two columns.
- It is not applied to the suppression list.
- At most 100 entries; keys up to 200 characters, values up to 64.
- To change the map after a completion, complete the same `audience_id` again with the new map ([Rules](#upload-flow)): the uploaded file is processed again, with no new PUT.

These are refused with 422 `column_map_invalid` (`field` is `column_map.<key>`), and the audience version stays `awaiting_upload`, so you can complete the same upload with a corrected map:

| Problem | Example message |
| --- | --- |
| A key the file does not have | `column_map names a column the file does not have: "cust_id". The file's columns: "customer_id", "first_name", "last_name", "street_address", … "lease_maturity_date".` |
| A reserved target (`ResponseCode`, `response_code`, `row_key`, `source_row`) | `column_map maps "customer_id" to "row_key", which is reserved: the Mail API adds each row's key as ResponseCode.` The fix: map your record id to `external_id`. |
| Two columns into one | `column_map maps both "customer_id" and "lead_id" to external_id; one column can fill it.` |
| The same column twice | `column_map names the same column twice: "customer_id" and "Customer ID".` |
| A target another column already has | `column_map renames "postcode2" to zip, but the file already has a column that becomes zip ("zip").` |
| A target that is not a column name | `column_map maps "customer_id" to "9lives", which is not usable as a column name.` |
| A name the API computes (`vehicle`, `vehicle_photo`, `make_logo`, `address_block`) | `column_map maps "Last Serviced Vehicle" to vehicle, a name the Mail API computes, so that column would never print.` The fix names `vehicle_source` (or `address1`). |
| A key that matches two headers | `column_map key "zip" matches 2 columns of the file.` |

The message lists the file's headers only when the first row looks like a header row; if it looks like a customer (an address, a ZIP, an email), nothing from it is echoed.

The report's `column_map` shows the map applied, keyed by the lower-case header (`{"customer_id": "external_id"}`).

### File format and limits

- CSV as RFC 4180: comma-separated, fields with commas, quotes or line breaks in double quotes, `""` for a literal quote.
- UTF-8. A byte-order mark is fine. CRLF, LF and CR line ends are all fine.
- The first row is the header.
- At most 250,000 data rows (`audience_too_large`) and 50 MB (the storage bucket's limit), however the file is sent. The hosted API takes a request body of at most 4.5 MB, so send a larger file by `source_url` or the signed upload.
- Blank rows are skipped and not counted.

## Upload flow

There are three ways to send the file. All of them store it in the same place and process it the same way, with the same report, warnings and retention.

| Way | Calls | Best for |
| --- | --- | --- |
| `source_url` | One: `POST /v1/campaigns/{id}/audience/import` with `{"source_url": "https://..."}` (MCP: `upload_audience` with `source_url`) | An agent or backend whose system can give a link to the export, such as a presigned storage link |
| CSV body | One: `POST /v1/campaigns/{id}/audience/import` with `Content-Type: text/csv` | A backend that holds the file, up to 4.5 MB |
| Signed upload | Three: start, PUT the file, complete | Large files, and a suppression list |

### Import in one call

`POST /v1/campaigns/{id}/audience/import` takes the file and processes it in the same call. It answers 201 with what the completion returns: `audience`, `campaign_status` and `next_step`.

By link:

```bash
curl -s -H "$H" -H 'content-type: application/json' $API/v1/campaigns/$C/audience/import \
  -d '{"source_url": "https://exports.example.com/audiences/nov.csv?X-Amz-Signature=...", "column_map": {"customer_id": "external_id"}}'
```

- The URL must be `https` and serve the file to anyone for a few minutes, with no sign-in. A presigned link from S3, Google Cloud Storage or Azure works.
- Xcel fetches it once: a public address only (no local or private network), no redirects, at most 50 MB, and it gives up after 30 seconds without data.
- The answer must be CSV: `text/csv`, `text/plain`, `application/vnd.ms-excel` or a generic binary type (`application/octet-stream`, which storage services give a file with no type). An HTML page (often a sign-in page or an expired link's error), JSON, a PDF or a spreadsheet is refused with 415 `audience_not_csv`. Export as CSV (UTF-8), not `.xlsx`.
- The URL is never stored and never logged, so a token in it stays private. Error messages never quote it.

As the body:

```bash
curl -s -H "$H" -H 'content-type: text/csv' --data-binary @audience.csv \
  "$API/v1/campaigns/$C/audience/import?column_map=%7B%22customer_id%22%3A%22external_id%22%7D"
```

- `column_map`, if any, goes in the query as URL-encoded JSON (here `{"customer_id": "external_id"}`); with curl, `--url-query 'column_map={"customer_id":"external_id"}'` encodes it for you.
- The body is never logged. A file that is not CSV text (a zip or `.xlsx`, a PDF, UTF-16 text) is refused with `audience_not_csv`; save it as CSV UTF-8. A body over 4.5 MB is 413 `payload_too_large`: on the hosted API the platform refuses it before it reaches the code, so that 413 may not be the JSON error. Send a larger file by `source_url` or the signed upload.

Both ways:

- Each import is a new audience version, as each upload start is. A suppression list needs the signed upload.
- Send an `Idempotency-Key` to make a retry safe: the same key and request within 24 hours return the first answer with `Idempotent-Replayed: true`, without fetching or processing again; another file with that key is refused with `idempotency_key_reused`. A `source_url` counts without its query string, so a retry may send a freshly signed link to the same file. A CSV body counts by its contents and `column_map`.
- When the file cannot be processed (missing columns, a bad header), the error's `fix` names the `audience_id` the file was stored as. To fix it with a `column_map`, complete that `audience_id` (`POST .../audience/complete`; MCP: `upload_audience` with `uploaded_audience_id`), with no new import. To send a corrected file, import again.
- A link that cannot be fetched or is not CSV makes no audience version.

### Signed upload

```mermaid
sequenceDiagram
    participant P as Partner
    participant API as UpDash Mail API
    participant S as Private storage
    P->>API: POST /v1/campaigns/{id}/audience
    API-->>P: audience_id, upload_url (valid 2 hours)
    P->>S: PUT upload_url (Content-Type: text/csv)
    P->>API: POST /v1/campaigns/{id}/audience/complete with audience_id
    API->>S: read source.csv
    API->>API: parse, normalize, dedupe, suppress
    API->>S: write mailable.csv
    API-->>P: counts, reason codes, row numbers
```

1. `POST /v1/campaigns/{id}/audience` with an empty body, or `{"include_suppression_list": true}` to also get `suppression_upload_url`. Returns `audience_id`, `version` and `upload_url`. It also returns `template_columns`: the merge columns the campaign's current creative reads from each row beyond the name and address, that is its custom columns and, when it prints the vehicle, `vehicle_year`, `vehicle_make` and `vehicle_model` (`null` before the campaign has a creative). Name those columns so in the file, or map yours to them in `column_map`. Its `next_step` says the file comes from your own system and how to name or map the id column.
2. `PUT` the CSV to `upload_url` with `Content-Type: text/csv`. Do not send your API key to that URL; it carries its own token. The URL expires after 2 hours (`upload_expires_in_seconds: 7200`). Or give a person `upload_page_url`: they open it in a browser and choose the CSV or Excel file (an Excel workbook's first sheet, at most 4 MB), and it is stored where the `PUT` would store it, without date-of-birth columns. The page needs no key and works for 2 hours (`upload_page_expires_at`); it shows the count of rows and the column names, never a row, and takes no new file once the upload is completed.
3. If you asked for a suppression list, `PUT` it to `suppression_upload_url` the same way.
4. `POST /v1/campaigns/{id}/audience/complete` with `{"audience_id": "..."}`, plus `column_map` when your columns have other names. It returns `audience`, `campaign_status` and `next_step`: complete again with `reconciliation.suggested_column_map` when there is one (the sentence holds the exact map), then the creative, or, when the campaign already has one, `validate_campaign` and the proof. With no mailable rows, `next_step` says to correct the file and start a new upload. Read `reconciliation.column_warnings` before you go on.

The upload response's `optional_columns` lists `external_id`; send it on every row if you want results per lead.

With MCP, call `upload_audience` with `campaign_id` and `source_url` to import a link in one call. Without a link, call it with `campaign_id`, then give the person `upload_page_url` to choose their file in a browser (an app such as claude.ai cannot `PUT` a file), or PUT the file yourself; then call `upload_audience` again with `uploaded_audience_id` (and `column_map` if your columns have other names; `column_map` belongs on that second call). Never paste rows into a tool argument.

Rules:

- Each start or import creates a new audience version. Completing an older version after a newer one started is refused with `audience_superseded`.
- Completing before the PUT is refused with `audience_file_missing`. PUT the file and complete again.
- An upload URL cannot replace a file that is already there: a second PUT to the same URL is refused by storage. To send a corrected file, start a new upload (`POST .../audience` or `upload_audience` again) and PUT to the new URL.
- Completing twice returns the stored result. Completing again with a **different** `column_map` processes the same uploaded file again, with no new PUT: a `rejected` version is processed in place (same `audience_id`); a processed version (`ready` or `pending_address_processing`) gets a new audience version with a copy of the file, a new `audience_id`, new row keys and `reconciliation.reprocessed_from_version` set, because its quote, proof and approval stay bound to the old version. A retry of that request returns the same new version. Completing the old version with yet another map is refused with `audience_superseded`, whose `fix` names the newest `audience_id`. A version whose files the retention job deleted is refused with 410 `audience_purged`.
- A file that cannot be processed (missing required columns, a bad header, an unclosed quote, too many rows) is refused with a 422 code, and that audience version becomes `rejected`. When `column_map` can fix it (missing or reserved columns, a duplicate or unusable column name), complete the same `audience_id` again with the map; otherwise fix the file and start a new upload. A refused `column_map` (`column_map_invalid`) does not reject the version.
- A completed audience becomes the campaign's current audience. If the campaign was past `draft`, it returns to `draft`; see [Concepts](concepts.md#creative-and-audience-versions).
- After submission the audience cannot change (`campaign_locked`).

## Audience statuses

| Status | Meaning |
| --- | --- |
| `awaiting_upload` | The version exists; the file has not been processed. |
| `rejected` | The file could not be processed. Complete it again with a `column_map`, or start a new upload. |
| `pending_address_processing` | Live only. Processed and mailable; Xcel has not run CASS and NCOA yet. |
| `ready` | Processed and address-checked (sandbox: simulated). |

## What the server does to each row

Rows are checked in this order. The first failure decides the row's reason code.

A cell holding only a dash counts as blank in every step ([A CDP export as it comes](#a-cdp-export-as-it-comes)).

1. A row with non-empty cells beyond the header's columns: `wrong_column_count`.
2. A standard field over 100 characters, or a custom field over 500: `field_too_long`.
3. An empty required field, in the order `first_name`, `last_name`, `address1`, `city`, `state`, `zip`: `missing_<column>`. A blank `city` or `state` is first filled from a valid ZIP ([City and state from the ZIP](#city-and-state-from-the-zip)); when the ZIP is missing or invalid, the reason is `missing_zip` or `invalid_zip`.
4. A state that is not a USPS code or state name: `invalid_state`.
5. A ZIP that is not 3 to 5 digits with an optional 4-digit extension, or is `00000`: `invalid_zip`.
6. The same person at the same address as an earlier row: `duplicate`. The first row wins.
7. A match on the suppression list, or on the dealer's [lasting do-not-mail list](#when-a-person-asks): `suppressed`.
8. A campaign of a [standing order](standing-orders.md#the-skip-window) only: someone the standing order mailed within its skip window, or holds in another open run: `already_mailed`.

Rows that pass are normalized:

- Control characters become spaces; runs of whitespace collapse; values are trimmed.
- Names and cities that arrived all upper case or all lower case are title-cased (`JAMES` becomes `James`). Mixed case is kept, and so is a city filled from the ZIP.
- Vehicles print as a person writes them. A make the [make list](creative.md#make-logos) knows prints by its name (`JEEP` is `Jeep`, `CHEVY` is `Chevrolet`, and `RAMT`, as some DMS exports code Ram trucks, is `Ram`); another make arrived in capitals is title-cased. A model in capitals is title-cased word by word, keeping codes (`GRAND CHEROKEE L` is `Grand Cherokee L`; `CR-V`, `F-150`, `SILVERADO 2500HD` and `MDX` stay; `4RUNNER` is `4Runner`, `528I` is `528i`). Mixed case is kept as given. A template preview's `recipient` is cleaned the same way.
- `estimated_trade_value` and `mileage` given as a plain number print as `$37,250` and `29,121`. Any other text (a range, `37k`) is kept as given.
- `state` becomes the two-letter code. `zip` becomes `12345` or `12345-6789`.
- `vin` is upper-cased; an invalid VIN is blanked (`invalid_vin_blanked`). An invalid `vehicle_year` is blanked (`invalid_vehicle_year_blanked`).

## Dedupe

Two rows are duplicates when their name key and address key match:

- **Name key:** first and last name, letters only in any script (accents read as plain letters), upper case. A father and son at one address stay two people.
- **Address key:** `address1` and `address2` together, upper case, accents and full-width characters read as plain letters and digits, an apostrophe removed and any other mark read as a space, single letters joined and joined to a number beside them (`N.W.` is `NW`, `12-B` is `12B`; two numbers never join), with standard words shortened (`STREET` to `ST`, `AVENUE` to `AVE`, `NORTH` to `N`, and so on) and unit words (`APT`, `UNIT`, `SUITE`, `#`) made the same, plus the 5-digit ZIP.

So `12 Elm Street, Apt 4` and `12 ELM ST. #4` at the same ZIP are the same address. Two different people at the same address are not duplicates.

## Suppression list

A suppression list is a do-not-mail CSV for this upload: past opt-outs, current customers, employees. It lasts for this upload only. For someone who should never get this dealer's mail, use the dealer's [lasting do-not-mail list](#when-a-person-asks), which every upload applies.

- Required columns: `address1` and `zip`, and a file whose `address1` holds whole addresses needs no `zip`. Optional: `first_name`, `last_name`, `address2`. The same header aliases apply.
- A row with a name suppresses that person at that address. A row without a name suppresses everyone at that address.
- Rows that can never match are ignored: no `address1`, no valid ZIP, one word for a name, or a whole address with no comma to split it. `suppression_list_rows` counts the rows used.
- Matching uses the same keys as the [lasting list](#when-a-person-asks): dedupe's address key, the hyphenated house number tried both ways, and names compared as their letters.
- A suppression list missing `address1` or `zip` is refused with `suppression_missing_columns`; one that is empty, has no header or repeats a column with `suppression_file_invalid`. An unclosed quote or more than 250,000 rows in the suppression list reports `audience_file_invalid` or `audience_too_large`, like the audience file.

## Reconciliation report

`POST .../audience/complete` returns the audience with a `reconciliation` object. It holds counts, codes, row numbers and your own external ids, never another value from the file.

| Field | Meaning |
| --- | --- |
| `submitted` | Non-blank data rows in the file. Always `mailable + rejected`. |
| `mailable` | Rows that passed. This is the quantity a quote uses. |
| `rejected` | Rows that failed. |
| `rejected_by_reason` | Count per reason code. |
| `rejected_rows` | `{row, reason}` for each rejected row, up to 1,000, with `external_id` when the row has one, so you can tell which shopper was not mailed. `row` is the spreadsheet row: the header is row 1, the first data row is row 2. `external_id` is left out when the value looks like an email address or phone number, is over 128 characters, or sits on a row whose cell count differs from the header's, where it may be another column's value. It is deleted with the audience's files. |
| `rejected_rows_truncated` | `true` when more than 1,000 rows were rejected. The counts are still complete. |
| `warnings` | Count per warning code (see below). A column warning counts the mailable rows it affects. |
| `columns` | The output columns, standard first, then custom. These are the `{{recipient.*}}` fields a creative can use. |
| `blank_counts` | For each optional and custom column, how many mailable rows have it blank. Preflight uses this. |
| `suppression_list_rows` | Rows used from the suppression list, or 0. |
| `dealer_suppression_removed` | Rows removed because they are on the dealer's [lasting do-not-mail list](#when-a-person-asks), or 0. Each also counts under `suppressed` in `rejected_by_reason`. A row on both that list and this upload's suppression list counts here, and is rejected once. |
| `address_processing` | CASS and NCOA status (see below). |
| `column_map` | The map applied: the file's column (lower case, other characters as `_`) to ours. `{}` when none. |
| `column_warnings` | Warnings about the file's columns, each with `code`, `severity`, `message`, `fix`, `columns` and the `column_map` entries it proposes (or `null`); `city_state_filled_from_zip` also has `rows`. See [Column warnings](#column-warnings). |
| `suggested_column_map` | The whole map to send to apply every proposal: the applied map plus the proposals. Complete the same `audience_id` again with it. `null` when nothing is proposed. |
| `reprocessed_from_version` | The version whose file this version processed again with a new map or `vehicle_source`; `null` for a direct upload. |
| `vehicle_source` | The history read first, as sent; `null` for the default order. |
| `vehicle_sources` | Mailable rows that took their vehicle from each history: `{"owned": 0, "sold": 1, "serviced": 2}`. Counts only. `null` on a report from before this field. |

### Reject reason codes

| Code | Cause | Fix |
| --- | --- | --- |
| `missing_first_name` | `first_name` is empty. | Fill it, or drop the row. |
| `missing_last_name` | `last_name` is empty. | Fill it, or drop the row. |
| `missing_address1` | `address1` is empty. | Fill it, or drop the row. |
| `missing_city` | `city` is empty, and the row's ZIP is one the ZIP table does not know or lies in another state than the row's. | Fill it, or drop the row. |
| `missing_state` | `state` is empty, and the row's ZIP is one the ZIP table does not know. | Fill it, or drop the row. |
| `missing_zip` | `zip` is empty. | Fill it, or drop the row. |
| `invalid_state` | Not a USPS state code or state name. | Use the two-letter code. |
| `invalid_zip` | Not a 5-digit ZIP or ZIP+4 (3 and 4 digits are padded). | Correct the ZIP. Format the column as text in spreadsheets. |
| `field_too_long` | A standard field over 100 characters, or a custom field over 500. | Shorten the value. |
| `wrong_column_count` | The row has more non-empty cells than the header has columns. | Quote fields that contain commas, or fix the row. |
| `duplicate` | Same person at the same address as an earlier row. | Nothing to do; the first row is kept. |
| `suppressed` | Matched the suppression list or the dealer's lasting do-not-mail list. | Nothing to do. |
| `already_mailed` | A campaign of a [standing order](standing-orders.md#the-skip-window) only: the standing order mailed this person within its skip window (by name and address, or by `external_id`), or another of its runs waiting on approval holds them. | Nothing to do; shorten `skip_mailed_within_days` to mail sooner. |

### Warning codes

| Code | Meaning |
| --- | --- |
| `zip_leading_zero_restored` | A 3- or 4-digit ZIP was padded with leading zeros. Spreadsheets strip them from New England and New Jersey ZIPs. |
| `invalid_vin_blanked` | A VIN was not 17 valid characters, so it was blanked. |
| `invalid_vehicle_year_blanked` | A vehicle year was not a four-digit year from 1900 to two years ahead, so it was blanked. |
| `address_split_from_one_column` | A row's `address1` held the whole address, so it was split into its parts ([A CDP export as it comes](#a-cdp-export-as-it-comes)). |
| `name_split_from_one_column` | A row's name came from one whole-name column, split into `first_name` and `last_name`, or kept whole as `last_name` for a business or household ([A CDP export as it comes](#a-cdp-export-as-it-comes)). |
| `vehicle_from_history_columns` | A row's vehicle came from its purchase or service history columns ([A CDP export as it comes](#a-cdp-export-as-it-comes)). |
| `duplicate_external_id` | An `external_id` appeared on more than one mailable row. Both rows mail; their results share the id, so you cannot tell them apart. |
| `external_id_blank` | The file has an `external_id` column and a mailable row left it empty. That row's results come back with `external_id: null` (its `row_key` still identifies it). |
| `external_id_contact_info_blanked` | An `external_id` looked like an email address or a formatted phone number, so it was blanked (in the mailable file too). The row mails, and its results come back with `external_id: null`. Send an opaque record id instead. |
| `external_id_column_missing` | The file has no `external_id` column (after `column_map`), so every per-lead result comes back with `external_id: null`. Counts every mailable row. `column_warnings` names the likely id columns and proposes a map. |
| `contact_columns_present` | The file has email or phone columns. They are kept so UpDash can match responses and sales to the piece, never printed and never returned. Counts the mailable rows with a value in one. |
| `birth_date_columns_present` | The file has a date-of-birth column. No piece needs one, and none may print one: leave it out of the export. Counts the mailable rows with a value in one. |
| `template_columns_missing` | The campaign's current creative reads columns the file lacks, so every piece prints the template's fallback text (or nothing) there. Counts every mailable row. |
| `city_state_filled_from_zip` | A mailable row's blank or absent city or state was filled from its ZIP. Counts those rows; `column_warnings` lists them. |
| `vehicle_source_unused` | You sent a `vehicle_source` the file cannot honor: it has its own vehicle columns, or no such history ([A CDP export as it comes](#a-cdp-export-as-it-comes)). Counts every mailable row. |

### Column warnings

`column_warnings` explains the six column warnings and says what to do about each. They hold column names, counts and row numbers, never a value from the file. `severity` is `warning` when the file should change (`external_id_column_missing`, `birth_date_columns_present`, `template_columns_missing`) and `info` when the intake only tells you what it did (`contact_columns_present`, `city_state_filled_from_zip`); older reports have no `severity`. For this CDP export

```csv
customer_id,first_name,last_name,street_address,city,state_code,postal_code,model_year,make,model,email,mobile_phone,lease_maturity_date
```

completed for a campaign whose creative (your own HTML) reads `{{recipient.lease_end_date|soon}}` and `{{recipient.months_remaining|a few}}`, the report has:

```json
{
  "warnings": { "external_id_column_missing": 400, "contact_columns_present": 400, "template_columns_missing": 400 },
  "column_map": {},
  "column_warnings": [
    {
      "code": "external_id_column_missing",
      "severity": "warning",
      "message": "The file has no external_id column, so all 400 per-lead results come back with external_id: null and cannot be joined to your records. Likely id columns: customer_id.",
      "columns": ["customer_id"],
      "column_map": { "customer_id": "external_id" },
      "fix": "Complete this audience again with column_map {\"customer_id\":\"external_id\",\"lease_maturity_date\":\"lease_end_date\"} (it maps customer_id to external_id; the same file is processed again as a new version, no new PUT), or name the column external_id in your export."
    },
    {
      "code": "contact_columns_present",
      "severity": "info",
      "message": "The file has contact columns: email, mobile_phone. They are kept so UpDash can match responses and sales to the piece, and are never printed or returned.",
      "columns": ["email", "mobile_phone"],
      "column_map": null,
      "fix": "Nothing to do. UpDash matches the responses and sales that follow a mailing to the piece by phone and email. Xcel's templates never print these columns, your own HTML may not print them either (preflight audience_identifier_printed), and results and webhooks never return them. They stay in the stored audience files, including the mailable file that Xcel ops can download, until those files are deleted 90 days after the upload started (later while a live order is in production). A live order's printer packet carries only the columns the piece prints, so they never reach a printer. To keep them out of Xcel's systems, leave them out of the export."
    },
    {
      "code": "template_columns_missing",
      "severity": "warning",
      "message": "The campaign's creative (custom HTML, creative version 1) reads lease_end_date, months_remaining, which the file does not have, so every piece prints the template's fallback text there.",
      "columns": ["lease_end_date", "months_remaining"],
      "column_map": { "lease_maturity_date": "lease_end_date" },
      "fix": "Complete this audience again with column_map {\"customer_id\":\"external_id\",\"lease_maturity_date\":\"lease_end_date\"} (it maps lease_maturity_date to lease_end_date; no new PUT), and add months_remaining to the file."
    }
  ],
  "suggested_column_map": { "customer_id": "external_id", "lease_maturity_date": "lease_end_date" }
}
```

How each is found:

- **`external_id_column_missing`** looks for id-like custom columns: `customer_id`, `contact_id`, `lead_id`, `crm_id`, `cdp_id`, `person_id`, `record_id`, `customer_number`, `account_id`, `household_id`, `dms_id`, `id`, the same names run together as DMS and CRM exports write them (`CustNo`, `CustomerID`, `ContactID`), and others ending in `_id`, `_key`, `_ref`, `_number` or `_no`, but not ones that name the store, the list, the vehicle, a deal or an address part (`dealer_id`, `campaign_id`, `stock_number`, `vin_no`, `unit_number`). It proposes the first one that has a value on at least half the mailable rows, is distinct on at least 90% of them, and holds nothing that looks like an email address or phone number. Otherwise it lists the candidates without a proposal.
- **`contact_columns_present`** flags a custom column named like email, phone, mobile, cell, telephone, SMS or fax that holds an email address or phone number, or any custom column where at least half the values are email addresses or formatted phone numbers. A consent flag such as `sms_opt_in` with `Y`/`N` is not flagged. Nothing strips these columns, on purpose: UpDash's mailing-list import reads the phone and email columns to attribute calls and match sales to the piece, which is how results prove the mailing's return. They are stored with the file until [Retention](#retention) deletes it, and a live order's printer packet leaves them out: it carries only the name, the address, the row key and the fields the piece prints. Xcel's templates never print them, your own HTML may not print them (preflight `audience_identifier_printed`), and results and webhooks never return them.
- **`birth_date_columns_present`** flags a custom column named for a date of birth: `dob`, `birth_date`, `birthdate`, `date_of_birth`, `birthday`, `bday`, or the same with a prefix such as `customer_dob`. A `birth_month` column is not flagged. Never send a date of birth: for a [birthday card](creative.md#birthdays-and-dates-of-birth), select this month's birthdays on your own side and send only those people. Nothing strips the column, so leave it out of the export; until then it stays in the stored audience files like any other column. No template prints it, your own HTML may not print it (preflight `audience_identifier_printed`), results and webhooks never return it, and Claude is never offered it as a merge field.
- **`city_state_filled_from_zip`** lists the mailable rows whose city or state came from the ZIP ([City and state from the ZIP](#city-and-state-from-the-zip)): `columns` names the ones filled, `rows` their spreadsheet rows (the first 1,000), and the message the first five. When the file has no `city` (or `state`) column but one other column looks like it (`town_of_residence`), the warning proposes it as `column_map`, so the file's own value prints. For a file of `customer_id,first_name,last_name,address1,zip`:

  ```json
  {
    "code": "city_state_filled_from_zip",
    "severity": "info",
    "message": "The file has no city or state column. City and state were filled from the ZIP on 2 mailable rows (rows 2, 3).",
    "columns": ["city", "state"],
    "column_map": null,
    "rows": [2, 3],
    "fix": "Nothing to do: Xcel's address processing (CASS) corrects the city and state before a live order prints. The filled place is the first one GeoNames lists for the ZIP, which can differ from the name a recipient uses; to print your own, send city and state on every row."
  }
  ```

- **`template_columns_missing`** reads the campaign's current creative (template or your own HTML, with its copy) for recipient fields: printed fields, `@recipient.x` fallbacks and `{{#if recipient.x}}` conditions, minus `external_id`, the address columns, `vin` and the computed `address_block`, `vehicle_photo` and `make_logo` (preflight checks the images itself: `vehicle_photo_missing`, `make_logo_missing`). The vehicle columns count: one the creative prints directly (`{{recipient.vehicle_year}}`) is missing when the file lacks it, and `{{recipient.vehicle}}`, which prints whatever part of the vehicle a row has, warns only when the file has none of `vehicle_year`, `vehicle_make` and `vehicle_model` (a vehicle locator card would print its fallback, "your vehicle", on every piece). It proposes a file column whose name shares most of its words, counting look-alikes as one word (maturity, expiration and end; pmt and payment; apr and rate; left and remaining; mos and months); names with opposite words, such as `lease_start_date` for `lease_end_date`, never match. Otherwise the fix proposes no map and says to add the column in a new export, naming a column that shares a word only as a possibility ("If X holds Y, send column_map ..."). At audience completion it runs when the campaign already has a creative. In the usual order (audience, then creative), the same check runs as a preflight warning at `generate_creative`, `validate_campaign` and `render_proof`: its fix names the whole `column_map` to send and the `audience_id` to complete again (MCP: `upload_audience` with `uploaded_audience_id`), and the same file is processed again with no new PUT.

### File-level errors

These refuse the whole file (HTTP 422) and mark the version `rejected`, except `column_map_invalid`, which leaves it `awaiting_upload`:

| Code | Cause |
| --- | --- |
| `audience_missing_columns` | A required column is missing. `field` lists them, for example `address1,zip`. `city` and `state` count only when the file has no `zip` column either, since the ZIP fills them. The `fix` names the file's headers when the first row is a header row. It proposes a `column_map` only for a header that looks like a missing column (`town_of_residence` for `city`); when no header does, it says to add the column in a new export. A whole-name column (`name`, `full_name`) is never missing: the intake splits it into `first_name` and `last_name` itself ([A CDP export as it comes](#a-cdp-export-as-it-comes)). |
| `audience_file_invalid` | Empty file or header, a duplicate column, more than 50 custom columns or 500 columns in all, a custom column name that is not usable as a merge field, or a quoted field that never closes (the message names its row). |
| `audience_too_large` | More than 250,000 data rows. Split the audience into several campaigns. |
| `suppression_missing_columns` | The suppression list lacks `address1` or `zip`. |
| `suppression_list_unavailable` | The dealer's [lasting do-not-mail list](#when-a-person-asks) cannot be read right now, so nothing was processed (503). Retry: the upload is still there. |
| `suppression_file_invalid` | The suppression list is empty, has no header or has a duplicate column. (An unclosed quote or too many rows in it reports `audience_file_invalid` or `audience_too_large`.) |
| `column_map_invalid` | `column_map` names a column the file lacks (the `fix` lists the file's headers), maps two columns to one, names a column twice, maps onto a column the file already has, or maps to a reserved or unusable name. The version stays `awaiting_upload`. |

## Lead identity

If your id column has another name, map it with `column_map` (`{"customer_id": "external_id"}`); the report warns `external_id_column_missing` when there is none.

Every mailable row gets a **row key**: `xm` followed by 16 lower-case base32 characters (18 in all, for example `xmdr6kslk45b2rkegz`), random and unique in the campaign. The Mail API stores a map from each row key to your `external_id` and the source row number, and nothing else from the row.

- The row key is the last column of the mailable file, named `ResponseCode`, in the stored file, its spreadsheet-safe copy and the printer packet. UpDash's mailing-list import stores it, so the responses and matched sales Xcel tracks for that piece come back keyed by it.
- `get_campaign_results` returns each lead's `row_key` and `external_id`, never a name or address, so you join results to your own records by `external_id` ([Results and attribution](concepts.md#results-and-attribution)).
- A new audience version gets new row keys.
- Row keys and per-lead results are deleted 365 days by default after the order completes or is cancelled; the result totals stay. Row keys of an audience version that was never submitted are deleted with its files ([Retention](#retention)).

## Address processing

**CASS** standardizes each address against USPS data and checks that it is deliverable. **NCOA** (NCOALink) updates addresses for people who filed a change of address. USPS requires address checks like these (CASS coding and a Move Update method such as NCOALink) for commercial presorted and automation prices.

| | Sandbox | Live (Phase 1) |
| --- | --- | --- |
| Processor | `sandbox_pass_all` | `manual_accutrace` |
| Audience status after complete | `ready` | `pending_address_processing` |
| What happens | Every address passes at once; `cass_failed` and `ncoa_moved` are 0. | Xcel ops run CASS and NCOA in Accutrace by hand, then mark the audience done in the ops dashboard with the number of CASS failures and NCOA moves. The audience becomes `ready`. |

A live audience can be quoted, approved and submitted while it is still `pending_address_processing`; Xcel runs address processing after submit and before production, and it has no date of its own. `audience.address_processed` reports counts only: the API returns no per-row result and no new addresses. The quote is for the mailable count before CASS and NCOA, and pieces removed by address processing are not billed. The billing adjustment happens outside the API in Phase 1, and `ordered` and the drop quantity stay at the original count: read `cass_failed` and `ncoa_moved` to see what was removed.

`address_processing` in the report looks like this before and after ops finish:

```json
{ "status": "pending", "processor": "manual_accutrace", "note": "Xcel ops run CASS and NCOA (Accutrace) by hand before production. The mailable count can drop; removed pieces are not billed." }
```

```json
{ "status": "processed", "processor": "manual_accutrace", "note": "CASS and NCOA run by Xcel ops in Accutrace.", "processed_at": "2026-11-04T16:20:00.000Z", "cass_failed": 12, "ncoa_moved": 31 }
```

When ops mark processing done, an `audience.address_processed` event carries the two counts. `mailable_count` on the audience is not reduced.

**PAF.** USPS requires a signed NCOALink Processing Acknowledgement Form (PAF) from the list owner before NCOA processing. The API does not collect or track PAFs. In Phase 1 Xcel arranges the PAF with the dealer outside the system.

## Retention

Each audience version records `retention_expires_at`: when its files are deleted. It is set when the upload starts or the import arrives, 90 days later by default. The files are the original upload, the suppression list and the normalized mailable file, all in a private bucket under `<partner_id>/<campaign_id>/v<version>/`, and the proof PDFs printed from that audience version, which are stored beside them.

A scheduled job runs daily at 03:17 UTC:

- It deletes the files of every audience past its retention date, with its proof PDFs, sets the audience's `purged_at` and records an `audience.purged` event.
- If the audience is the current one of a live order still in production (`submitted` to `delivery_estimated`), it keeps the files and moves `retention_expires_at` out by 7 days instead, so Xcel never loses a file mid-job. Sandbox audiences are purged on schedule whatever the campaign's status.
- Counts, reason codes and the reconciliation report stay on the audience for good. They hold no customer values, and the job deletes the `external_id`s in `rejected_rows` with the files.
- When it deletes an audience version that was never submitted, it deletes that version's row keys too.
- It deletes the row keys and per-lead results of every order that completed or was cancelled more than 365 days ago by default, in one transaction, and records `results.lead_data_purged` on the campaign's timeline (not sent to webhooks). The campaign's result totals (`results` in `get_campaign_results`) stay; `leads` is empty from then on.
- With them it deletes the order's artwork files: every PDF its [artwork creatives](creative.md#print-ready-artwork) stored, and each side's PNG or JPEG as sent. A closed order prints nothing again. Art holds no customer data, so until then it is kept whatever the audience's retention date. The files go first: when a delete fails, the order's results stay too and the next run tries again.
- It deletes the art of every campaign that was never submitted and has not been updated for 90 days, test or live: every file its artwork creatives stored. The campaign, its creatives and its timeline stay, and the job records no event. Any later change to the campaign (a new creative, or this job moving it off a deleted audience) starts the 90 days again; a creative whose art is gone answers 409 `artwork_missing` at `render_proof`, so send the art to `generate_creative` again. A run deletes each draft's art once; when a delete fails, the next run tries again.
- It deletes artwork uploads 7 days after each file arrived: the files PUT to an upload from `POST /v1/artwork` or `POST /v1/campaigns/{id}/creative/artwork`, and the art an [artwork preview](creative.md#preview-artwork) kept. A creative never depends on an upload, because `generate_creative` stores its own copy of every file it reads; an `artwork_id` past its 7 days answers 409 `artwork_not_uploaded`, except on a campaign that already made a creative from it.
- It deletes the renders [preview links](creative.md#preview-links) serve once every link that could open them has expired.

You can delete a version's files before its date: [Remove a list early](#remove-a-list-early).

After a purge, `purged_at` is set on the audience (`GET /v1/campaigns/{id}` shows it while it is that campaign's audience, and the delete call answers it), the ops download links (files and PDFs) answer 410 (`audience_purged`), the review page offers no PDF, and an HTML proof falls back to fictional sample rows. The current audience of a campaign not yet submitted leaves that campaign a `draft` with no audience, as [a delete call](#remove-a-list-early) does. To mail the same list again, upload it again.

## When a person asks

Someone asks not to get a dealer's mail, or asks that their record go. The dealer is the business the person has the relationship with, so settle the request with the dealer. This section says what the API then does, and what it does not. It does not say what any law asks of the dealer or of you.

### Stop their mail

`POST /v1/dealers/{id}/suppressions` adds to the dealer's lasting do-not-mail list. Every audience upload for that dealer then removes those people, beside any list sent with the upload itself, so nobody has to send them again.

```bash
curl -s -X POST "$API/v1/dealers/dlr-1042/suppressions" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: text/csv" \
  --data-binary @do-not-mail.csv
```

```json
{ "dealer_id": "...", "external_id": "dlr-1042", "mode": "live", "rows_read": 3, "added": 2, "already_on_list": 0, "ignored": 1, "next_step": "..." }
```

- **The file.** The columns of a [suppression list](#suppression-list): `address1` and `zip`, with optional `first_name`, `last_name` and `address2`. A row with a name covers that person at that address; a row without one covers everyone there. Rows with no `address1`, no valid ZIP or one word for a name are `ignored`. Send it as a `text/csv` body (the hosted API takes up to 4.5 MB), or JSON `{"source_url": "https://..."}`, fetched once, as an [import](#import-in-one-call) does.
- **The match.** The same keys as [dedupe](#dedupe), so `12 Elm Street, Apt 4` and `12 ELM ST. #4` at the same ZIP are the same address. A mark reads as a space (`Apt-4` and `Apt 4`, `St.Paul` and `St Paul`), an apostrophe falls away (`O'Brien` and `OBrien`), and single letters read together, and with a number beside them (`N.W.` and `NW`, `P.O. Box` and `PO Box`, `12-B` and `12B`). Two numbers never join in dedupe: `6-8 Elm St` and `68 Elm St` are different addresses. A do-not-mail list errs toward not mailing, so on a list a house number with a hyphen also matches the number joined: `45-10 Main St` matches `4510 Main St`, and `6-8 Elm St` matches `68 Elm St`. Accents and full-width characters read as plain letters and digits, and a fraction stays apart from the number before it (`69¾` is `69 3/4`). A row whose name or address differs by more than that is a different row: send every spelling your records hold.
- **Names.** A row names a person with both names, and two cells with the same word (`Mohamed`, `Mohamed`) are a first and a last name. One cell also works: `Jan Ten`, `Ten, Jan` or `John Smith, Jr.`. On a list a name is compared as its letters, with no line between first and last, so `Maria De La Cruz` matches however a file splits it; accents, titles and suffixes do not count, so `Dr José García Jr` covers Jose Garcia at that address. One word alone can never match an audience row, so that row is `ignored`.
- **A whole address.** An `address1` that ends in a state and ZIP gives up its street, as on an audience, and a file of them needs no `zip` column. With no comma between the street and the city it cannot be split, so that row is `ignored`.
- **The most a list holds.** 1,000,000 entries, or 100,000 on a test key. Past that, the whole file answers 422 `suppression_list_full` and adds nothing.
- **The report.** A removed row has the reason `suppressed`, as a per-upload match does, and `dealer_suppression_removed` counts them. It never reaches the mailable file or gets a row key.
- **What is stored.** Only keyed hashes (HMAC-SHA256 under a key held on the server), one per entry, never a name or an address. A hash covers the dealer and the mode, so one person's hash differs from one dealer to the next.
- **One list per dealer, per mode.** A test key's list saves and works on sandbox orders, on a dealer shared with your live key too, and never reaches a live key's list. A key limited to some dealers reaches those dealers' lists alone.
- **Every dealer has its own.** Someone who deals with two of your stores needs a row on each list.

`GET /v1/dealers/{id}/suppressions` answers `count` and `last_changed_at`, never an entry. No call lists the entries or checks one person, so keep your own record of who asked and when. The list speaks about a person only on a file you send for that dealer with their name and address: `already_on_list` when you add them, and a `suppressed` row when you upload them.

**What it does not change.** An audience already processed is not touched: upload it again and the list applies. A submitted order is not recalled ([What the API does not do yet](#what-the-api-does-not-do-yet)).

**Clearing it.** `DELETE /v1/dealers/{id}/suppressions` empties the list in this key's mode. Mail can then go to people who asked not to get it, so it needs an `Idempotency-Key` header or `?confirm=true`; with neither it answers 400. With a key, a retry within 24 hours replays the first answer and clears nothing added since. Xcel records who cleared it, and how many entries, in a `dealer.suppressions_cleared` event on its own records; that event goes to no webhook and is not in `GET /v1/events`.

A list the server cannot read answers 503 `suppression_list_unavailable` to the add, the read and every upload for that dealer, rather than mail past it. Retry, or contact Xcel.

### Remove a list early

`DELETE /v1/campaigns/{id}/audience/{audience_id}` deletes one version's stored files now, as the [retention](#retention) job would on its date: the original upload, the upload's suppression list, the mailable file and the proof PDFs printed from it. It sets `purged_at`, sends `audience.purged` with `reason: "request"`, and answers the audience, `campaign_status` and `next_step`. A second call answers the same.

- **Refused while it is printing.** The version an order was submitted with answers 409 `audience_in_production` until the order is `completed` or `cancelled`, in the sandbox too. Delete it then.
- **Any other version may go, in any status.** Deleting the current audience of a campaign not yet submitted moves the campaign to `draft` with no audience: its proof, quote and approval were bound to that version, and a pending approval expires. `validate_campaign` then reports `No completed audience.`, `render_proof` and `get_quote` answer 409 `audience_required`, and a new upload picks up from there.
- **Row keys.** A version no order was submitted with loses its row keys too. A submitted version keeps them, because its results read them.
- **Each version has its own files.** Processing a file again with a new `column_map` makes a new version with its own copy: delete that one too. A delete that lands during the copy removes the copy, and the request answers 410 `audience_purged`.
- **A delete that fails.** `purged_at` is set first, then the files go. If removing them fails, the call answers 500, and a repeat call or the daily job tries again until it succeeds.
- **A signed upload URL cannot be recalled.** It stays open for its 2 hours. A file PUT to it after the delete is never processed, and the daily job deletes it.

### What stays

- Counts, reason codes, row numbers and the reconciliation report, on the audience for good. They hold no value from the file.
- For an order that was submitted, row keys, `external_id` and per-lead results, until 365 days by default after the order closes ([Retention](#retention)). Results and webhooks can name those ids until then.
- Campaigns, quotes, approvals, submissions and events, which hold ids, counts and your own `external_ref` and `metadata`.
- The hashes on the lasting list, until you clear it.
- A file already sent for a job follows [the print partners' rules](vendor-review.md#print-partners), and UpDash production has [its own periods](vendor-review.md#updash-production).

### What the API does not do yet

- **Remove one person from a stored file.** A version's files go whole. To take one person out, add them to the lasting list, upload the file again, then delete the old version.
- **Remove someone from an order already printing.** A submitted order is not recalled. Reply to your Xcel thread at once: Xcel can cancel before production on request, and after that what has printed may mail.
- **Find one person across dealers or campaigns**, or export what is held about them. The API stores no index of people, and rows never come back through it.
- **Stop mail by phone or email.** The list matches a name and a postal address.

## PII rules

- Never put customer rows in a JSON field, a query string or an MCP tool argument. Send the file by `source_url`, as a `text/csv` body or to the signed URL.
- A `source_url` is never stored or logged, and a CSV body is never logged.
- API responses, MCP results, events, webhook payloads, error messages and server logs carry ids, counts, reason codes and row numbers only. `external_id` is your own opaque id, and one that looks like an email address or phone number is blanked or left out.
- The proof shows real rows, so it is never returned through the API. The approver sees it on the review page; Xcel ops see it in the ops dashboard.
- The stored mailable file is kept raw, exactly as it will print, so a cell that starts with `=`, `+`, `-` or `@` is not escaped (a `'` prefix would print on the piece). Only the columns the piece prints leave the system, in the printer packet, for Accutrace and the printer's merge software. The files people open in spreadsheets escape such cells: the ops dashboard's spreadsheet-safe audience downloads, the printer CSV and the job ticket.

See [Security](security.md#customer-records-pii) for the full list.
