This request will create a postcard and perform a mail merge to put the address and any variable data in place.
| Parameter | Details | Description |
|---|---|---|
| size | body str required | Either "A6" or "A5" or "A5-ENV". Download our A6 design guide. Download our A5 design guide. Download our A5-ENV design guide. |
| test | body bool optional | If test is set to true then a sample PDF file will be produced but the item will never be dispatched and no charge will be taken. |
| template | body int optional | An ID of a template already set up on the platform. Otherwise use front and back parameters. |
| recipient | body object required | Either an ID of an existing recipient or a new recipient array. e.g., recipient[title], recipient[company], recipient[firstname], recipient[lastname], recipient[address1], recipient[address2], recipient[city], recipient[postcode], recipient[country] and recipient[*] to use any custom data. |
| front | body file optional | An image for the front. This can be either a URL, a file, or a base64 encoded string. This must be supplied if a template is not being used. Supported file types are JPG or PDF. |
| back | body file optional | An image for the back. This can be either a URL, a file, or a base64 encoded string. Supported file types are JPG or PDF. |
| padding | body int optional | A white border is added to the front of the postcard by default. Set padding = 0 to remove the border if you want an edge-to-edge design. |
| post_unverified | body bool optional | Default is true. If set to false, we will not post the item if the recipient address could not be verified. |
| clearzone | body bool optional | True or False. If true, we will overlay clear zones with a white background. Clear zones must be clear to keep a mailpiece machine-readable. Defaults to false. |
| tags | body str optional | Comma-separated tags for your reference, which you can search by in reporting. |
| addons | body str optional | Use addon codes to upgrade your postcard. E.g., FIRST_CLASS for first-class mailing. |
curl -X POST "https://api-eu1.stannp.com/v1/postcards/create" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"test": true,
"size": "A6",
"front": "https://www.stannp.com/assets/samples/a6-postcard-front.webp",
"back": "https://www.stannp.com/assets/samples/a6-postcard-back.webp",
"recipient": {
"title": "Mr",
"firstname": "John",
"lastname": "Smith",
"address1": "123 Sample Street",
"city": "Sampletown",
"postcode": "AB12 3CD",
"country": "GB"
},
"tags": "used.for.reporting",
"addons": "first_class"
}'
{
"success": true,
"data": {
"pdf": "https://www.stannp.com/assets/samples/a6-postcard-sample.pdf",
"id": "0",
"created": "2020-12-17T15:42:22+00:00",
"format": "A6",
"cost": "0.78",
"status": "test"
}
}Obtain the mailpiece object for the postcard id specified.
| Parameter | Details | Description |
|---|---|---|
| id | path int required | The ID of the postcard to retrieve. |
curl -X GET "https://api-eu1.stannp.com/v1/postcards/get/16818211" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"success": true,
"data": {
"id": "16818211",
"timestamp": "2019-10-30 00:14:04",
"status": "cancelled",
"type": "postcard",
"format": "A6",
"pdf_file": "https://api-eu1.stannp.com/v1/storage/get/port/1550016843/pdfs/sample.pdf",
"dispatched": null,
"country": "GB",
"cost": "0.00",
"addons": "",
"tags": "",
"postcode": "AB12 3CD",
"address": "123 Sample Street"
}
}You can cancel a postcard if we haven't started processing it yet.
| Parameter | Details | Description |
|---|---|---|
| id | body int required | The ID of the postcard to cancel. |
curl -X POST "https://api-eu1.stannp.com/v1/postcards/cancel" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"id": "12345"
}'
{
"success": true
}