# Submissions

Submissions are collections of records that are submitted against a campaign. \
The records are made up of the required recipient information and the relevant campaign specific fields that have been configured in the [ZAP APP](https://app.zappost.com)\
\
The POST endpoints allow users to submit either an entire self contained collection of records intended to be sent together on a specific date or they can submit individual records after an appropriate event has occurred.&#x20;

### Record Batching

Its very important to note that low volumes of records submitted to the ZAPI will be compiled into larger submissions at the end of each day. This is to reduce the total volume of submissions created against a campaign and make monitoring a much easier task for regularly scheduled campaigns. \
\&#xNAN;*This means you won't be able to query for any updates on records submitted until the day after submission when they've been batched.*&#x20;

{% hint style="info" %}
A common use case for the records endpoint would be to submit an individual record when a basket is abandoned for an e-com journey or for a customer quote request
{% endhint %}

## POST /api/v1/records

> For more information visit the \<a href="<https://apidocumentation.zappost.com/api-endpoints/submissions>" target="\_blank">documentation\</a>

```json
{"openapi":"3.0.1","info":{"title":"ZAPI","version":"1.0.0"},"security":[{"Basic":[]}],"components":{"securitySchemes":{"Basic":{"type":"http","scheme":"basic"}},"schemas":{"PartSubmissionRequest":{"required":["campaignId","scheduledSendId","submissions"],"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"onlyValidRecords":{"type":"boolean"},"scheduledSendId":{"type":"string","format":"uuid","nullable":true},"submissions":{"type":"array","items":{"type":"object","additionalProperties":{}},"nullable":true}},"additionalProperties":false},"PartSubmissionResponse":{"type":"object","properties":{"validRecords":{"type":"array","items":{"type":"object","additionalProperties":{}},"nullable":true},"invalidRecords":{"type":"array","items":{"type":"object","additionalProperties":{}},"nullable":true},"duplicateIgnoredRecords":{"type":"array","items":{"type":"object","additionalProperties":{}},"nullable":true},"responseMessage":{"type":"string","nullable":true},"submissionId":{"type":"string","format":"uuid","nullable":true}},"additionalProperties":false}}},"paths":{"/api/v1/records":{"post":{"tags":["PartSubmissions"],"description":"For more information visit the <a href=\"https://apidocumentation.zappost.com/api-endpoints/submissions\" target=\"_blank\">documentation</a>","requestBody":{"content":{"application/json":{"schema":{"required":["campaignId","scheduledSendId","submissions"],"allOf":[{"$ref":"#/components/schemas/PartSubmissionRequest"}]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartSubmissionResponse"}}}},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized"},"404":{"description":"Not Found"}}}}}}
```

{% hint style="info" %}
A common use case for the Submissions endpoint would be when adding a collection of related records such as a group of renewal reminders for a monthly send or a list of lapsed customers
{% endhint %}

## POST /api/v1/submissions

> For more information visit the \<a href="<https://apidocumentation.zappost.com/api-endpoints/submissions>" target="\_blank">documentation\</a>

```json
{"openapi":"3.0.1","info":{"title":"ZAPI","version":"1.0.0"},"security":[{"Basic":[]}],"components":{"securitySchemes":{"Basic":{"type":"http","scheme":"basic"}},"schemas":{"SubmissionRequest":{"required":["campaignId","scheduledSendId","submissions"],"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"clientId":{"type":"string","format":"uuid"},"submissionId":{"type":"string","format":"uuid"},"onlyValidRecords":{"type":"boolean"},"scheduledSendId":{"type":"string","format":"uuid","nullable":true},"submissions":{"type":"array","items":{"type":"object","additionalProperties":{}},"nullable":true},"consumeCredits":{"type":"boolean"},"overrideSendDateCutoff":{"type":"boolean"},"cleanseCreditsUsed":{"type":"integer","format":"int32","nullable":true}},"additionalProperties":false},"SubmissionResponse":{"type":"object","properties":{"validatedSubmissions":{"type":"array","items":{"type":"object","additionalProperties":{}},"nullable":true},"responseMessage":{"type":"string","nullable":true},"submissionId":{"type":"string","format":"uuid","nullable":true},"invalidSubmissions":{"type":"array","items":{"type":"object","additionalProperties":{}},"nullable":true}},"additionalProperties":false}}},"paths":{"/api/v1/submissions":{"post":{"tags":["Submissions"],"description":"For more information visit the <a href=\"https://apidocumentation.zappost.com/api-endpoints/submissions\" target=\"_blank\">documentation</a>","requestBody":{"content":{"application/json":{"schema":{"required":["campaignId","scheduledSendId","submissions"],"allOf":[{"$ref":"#/components/schemas/SubmissionRequest"}]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmissionResponse"}}}},"400":{"description":"Bad Request"},"401":{"description":"Unauthorized"},"404":{"description":"Not Found"}}}}}}
```

### Useful information

#### Scheduled Send Date selection

Any records or submissions sent to the ZAP API will be automatically included on the soonest available scheduled send if one is not specified. Unless you wish to use a specific send in the future it's most likely you don't need to specify the scheduled send on the request.

#### The OnlyValidRecords property

When creating a submission users have the option to set 'OnlyValidRecords' to true or false. When true the records in the submission will only be accepted if every record is valid. If 'OnlyValidRecords' is set to false, then any records that pass validation will be accepted and any that fail will not and will be returned in the usual response format detailing the validation failures.&#x20;

#### Expected Values

Expected values are configured against fields on the campaign. If any expected values exist, then the API will only accept the values within that list. \
For example, I might configure a DayOfTheWeek field on my campaign. If I do this I may configure the expected values "Monday","Tuesday","Wednesday","Thursday","Friday","Saturday" and "Sunday". \
Any records that fail because of an expected value will have the list of valid values returned in the error provided on submission.

#### Validation Expressions

Validations are regex expressions and paired messages. When a record is received against the campaign ZAP will validate that all validation expressions are passed. If any fail, a list of errors will be compiled with the relevant message configured for the validation expression. \
This piece of functionality provides more advanced validation as the regex expressions can get quite complex.&#x20;

#### Custom Data

The custom data object is used for custom fields that are created for a campaign. Each customField property should match the 'label' given to the matching custom field. Querying the GET campaign/{CampaignId} endpoint will return a list of all custom fields for the campaign.

#### Records endpoint duplicate customer ids within separate submissions:

We now support people submitting the same customer id more than once over separate requests to the "/records" endpoint. As a submission will only allow a single customer id, we will retain the data for the first record with that customer id and return a new "duplicateIgnoredRecords" object on any following requests that lists any records from the current submission that have not been accepted due to duplicates.

#### Default Field Validation

<table><thead><tr><th width="139">Property</th><th width="120">Mandatory</th><th width="327">ErrorMessage</th><th>Max Text Length</th></tr></thead><tbody><tr><td>CustomerId</td><td>Yes</td><td>Must be unique</td><td>100</td></tr><tr><td>Email</td><td>No</td><td> be in standard email address format.</td><td>255</td></tr><tr><td>Company Name</td><td>No*</td><td>Must be alphanumeric, space, -, (, ), full-stop and ' only.</td><td>120 total**</td></tr><tr><td>Salutation</td><td>No*</td><td>Must be alphanumeric, full-stop and space only.</td><td>120 total**</td></tr><tr><td>Firstname</td><td>No*</td><td>Must be alphanumeric, space, -, (, ), full-stop and ' only.</td><td>120 total**</td></tr><tr><td>Surname</td><td>No*</td><td>Must be alphanumeric, space, -, (, ), full-stop and ' only.</td><td>120 total**</td></tr><tr><td>Address1</td><td>No***</td><td>Must contain alphanumeric, space, ', ., &#x26;, -, /, \, ), ( and , characters only.</td><td>150 total****</td></tr><tr><td>Address2</td><td>No***</td><td>Must contain alphanumeric, space, ', ., &#x26;, -, /, \, ), ( and , characters only.</td><td>150 total****</td></tr><tr><td>Address3</td><td>No***</td><td>Must contain alphanumeric, space, ', ., &#x26;, -, /, \, ), ( and , characters only.</td><td>150 total****</td></tr><tr><td>City</td><td>No***</td><td>Must contain alphanumeric, space, ', ., &#x26;, -, /, \ and , characters only.</td><td>150 total****</td></tr><tr><td>Postcode</td><td>No***</td><td>Must be alphanumeric, - and spaces only.</td><td>150 total****</td></tr><tr><td>Country</td><td>Yes</td><td>Must contain letters, space, -, (, ), full-stop, &#x26; and ' only.</td><td>255</td></tr><tr><td>Currency</td><td>No</td><td>Must contain letters only.</td><td>3</td></tr><tr><td>Language</td><td>No</td><td>Must contain letters only.</td><td>10</td></tr></tbody></table>

\* The delivery name cannot be null, some combination of Salutation, First Name, Surname and Company Name is required.

\*\* Since the name can be comprised of multiple fields the 120 character maximum applies cumulatively across the following fields Salutation, First Name, Surname and Company name

\*\*\* We will allow you to submit any combination address fields however we do require an address to deliver to. Your submission can be made up or one of more of the following fields: Address1, Address2, Address3, City, Postcode. \
Since some of our clients don't usually hold customer addresses, their data isn't always standardised. This makes it easier to submit the data you do have and we'll do the clean up.&#x20;

\*\*\*\* Since the name can be comprised of multiple fields the 150 character maximum applies cumulatively across the following fields: Address1, Address2, Address3, City, Postcode


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://userguide.zappost.com/zap-api/api-endpoints/submissions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
