Create a single postcard
This request will create a postcard and perform a mail merge to put the address and any variable data in place.
Request
curl "https://api-us1.stannp.com/v1/postcards/create" \
-u {API_KEY}: \
-d "test=true" \
-d "size=A6" \
-d "front=https://www.stannp.com/assets/samples/a6-postcard-front.webp" \
-d "back=https://www.stannp.com/assets/samples/signature-example.webp" \
-d "message=hello world" \
-d "recipient[title]=Mr" \
-d "recipient[firstname]=John" \
-d "recipient[lastname]=Smith" \
-d "recipient[address1]=123 Sample Street" \
-d "recipient[city]=Sampletown" \
-d "recipient[postcode]=AB12 3CD" \
-d "recipient[country]=GB" \
-d "tags=used.for.reporting" \
-d "addons=first_class"
Response
{ "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" } }
Get a single postcard
Obtain the mailpiece object for the postcard id specified.
Request
curl "https://api-us1.stannp.com/v1/postcards/get/:id" \
-u {API_KEY}:
Response
{ "success": true, "data": { "id": "16818211", "timestamp": "2019-10-30 00:14:04", "status": "cancelled", "type": "postcard", "format": "A6", "pdf_file": "https:\/\/dash.stannp.com\/api\/v1\/storage\/get\/port\/1550016843\/pdfs\/sample.pdf", "dispatched": null, "country": "GB", "cost": "0.00", "addons": "", "tags": "", "postcode": "AB12 3CD", "address": "123 Sample Street" } }
Cancel a postcard
You can cancel a postcard if we haven't started processing it yet.
Request
curl "https://api-us1.stannp.com/v1/postcards/cancel" \
-u {API_KEY}: \
-d "id=12345"
Response
{ "success": true }