Important:  Ensure that your account funding balance is sufficient and consider turning on auto-refill with a sufficiently high refill amount.  Review pricing and funding options at: https://app.docupost.com/funds 

When testing, make sure that you cancel all test letters after testing your integration.  Cancelling within an hour of testing will ensure that your letter is not mailed, and that your funds will be refunded.

Endpoint: 

https://app.docupost.com/api/1.1/wf/sendletter

Method: POST

Auth: API token in query string

Querystring Parameters:

  • api_token - (string) Your DocuPost account API token is used to authenticate all API requests.  Generate a token here.  Do not share your API token with untrusted applications or users.

  • pdf - (string) A valid PDF URL.  10mb max. 8.5x11 recommended.  Required UNLESS "html" is sent in the request body schema (advanced feature - see below)
     
  • color - (optional) (bool string) Whether the document should be in color. "true" or "false". Defaults to false.
  • doublesided - (optional) (bool string) Whether the document should be printed double-sided. "true" or "false". Defaults to true.
     
  • class - (optional) (string) Must be "usps_first_class" or "usps_standard".  Defaults to "usps_first_class"
     
  • servicelevel - (optional) (string) Only available for "usps_first_class" mailings. Should be blank for non-certified, or "certified" or "certified_return_receipt"

  • return_envelope (optional) (bool string) Whether to include a return envelope. "true" or "false". Defaults to false. If true, a return envelope will be included and the bottom third of the cover letter page will automatically include a perforated return slip with the letter's return address.
     
  • to_name - (string) The name of your recipient (who the letter is being sent to) Must be less than 40 characters.

  • to_company - (string) Optional - an additional company, department or attention line to follow the recipient name. Useful for including additional information. This field is not checked against USPS NCOA. Must be less than 40 characters.

  • to_address1 - (string) The address of your recipient.

  • to_address2 - (optional) (string) The second line address for your recipient.

  • to_city - (string) The city of your recipient.

  • to_state - (string) The 2-letter abbreviation code ONLY for your recipient U.S. state.  Mail will fail to send if an invalid state is supplied.

  • to_zip - (string) The 5-digit postal code for your recipient

  • from_name - (string) Your sender / return address name. Must be less than 40 characters.

  • from_address1 - (string) The address of your sender/return address.

  • from_address2 - (optional) (string) The second line address for your sender/return address.

  • from_city - (string) The city of your sender/return address.

  • from_state - (string) The 2-letter abbreviation code ONLY for your sender's U.S. state.  Mail will fail to send if an invalid state is supplied.

  • from_zip - (string) The 5-digit postal code for your recipient

Request Body Schema (Advanced / Optional)

  • html - (string) Instead of sending a "pdf" querystring parameter with a pdf URL, you may send raw HTML contents (up to 9,000 characters) as part of the request body. This is an advanced feature, as adapting HTML formatting for print can be difficult.

Put together, your POST request would look something like this:

https://app.docupost.com/api/1.1/wf/sendletter?api_token={YOUR_API_TOKEN}&to_name=John Doe&to_address1=123 Test Ln&to_city=Los Angeles&to_state=CA&to_zip=90210&from_name=Sender Corp&from_address1=123 test Rd&from_city=Los Angeles&from_state=CA&from_zip=90210&pdf=https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf

 

Errors and troubleshooting

Your data will be validated at the time of making the API call to ensure your API token is correct and your account balance is sufficient.

If you receive a success message but your mailpiece displays "Error" on your Dashboard, this means there was a problem processing your request.  

Be sure that all of your query string parameters are valid based on the above documentation (for example, character limit and 2-letter state abbreviation codes)

If you are still having problems after troubleshooting, please reach out to us.