Idempotent Requests
Our API supports an optional idempotency key for safely retrying requests without performing a repeat operation. If a request is idempotent, we will return the original response body with a 409
HTTP status. We match the body of the request so only identical requests will be treated as idempotent.
Request
curl "https://api-us1.stannp.com/v1/letters/create" \
-u {API_KEY}: \
-d "test=true" \
-d "idempotency_key=e367c03e-3082-4c8e-b647-d6810761dcd4" \
-d "background=https://www.stannp.com/assets/samples/letter-heading.webp" \
-d "pages=Hello {firstname}, <br><br>This is my first letter." \
-d "recipient[title]=Mr" \
-d "recipient[firstname]=John" \
-d "recipient[lastname]=Smith" \
-d "recipient[address1]=123 Sample Street" \
-d "recipient[address2]=Sampleland" \
-d "recipient[town]=Sampletown" \
-d "recipient[postcode]=AB12 3CD" \
-d "recipient[country]=CA"
Response
{ "success": true, "data": { "pdf": "https:\/\/www.stannp.com\/assets\/samples\/letter-sample.pdf", "id": "0", "created": "2020-12-17T15:42:22+00:00", "format": "letter", "cost": "0.78", "status": "test" } }