Stannp | Direct Mail Marketing Platform
package icon
Choose the right postage when sending on the API Are you sending personal information, or marketing content? Before you send your mail, know the key difference between First-Class and USPS Marketing Mail. Read our blog to find out more.

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.

[POST]
https://api-us1.stannp.com/v1/letters/create

Request Example

        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[city]=Sampletown" \
-d "recipient[zipcode]=12345" \
-d "recipient[country]=US"
    

Response Example

{
  "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"
  }
}