Introducing the DocuPost v2 API

A frosted-white glass API console with cyan-to-magenta method badges and abstract endpoint rows, glowing along the bottom edge, on a pale lavender background.
In this article

    If you send letters, postcards, or checks from your own software, you want an API that is straightforward to build against: JSON in and out, clear errors, and a way to check the price before anything is mailed.

    That is now available as the DocuPost v2 API. The base URL is https://api.docupost.com/v2. You can send mail, look it up, cancel it before it goes to print, check your account balance, and get a price first. Your existing API token works, and the previous API (v1) keeps working.

    A new docs portal

    The official developer reference is now at api.docupost.com/docs. It covers authentication, every endpoint, errors, and a migration guide from v1. An OpenAPI spec is available from the same site if you want to generate a client.

    Our help center articles for generating an API token, sending letters, and sending postcards now point to this portal, so you are not bouncing between outdated examples and the live API.

    What you can send and follow

    v2 is a JSON API. Send your token in an Authorization: Bearer header — tokens in URLs are not accepted. Generate or copy that token in Account Settings → API, and turn on Sandbox Mode while you build. Sandbox mail is never printed, mailed, or billed.

    • Letters. POST /v2/letters sends a letter from a public PDF link or from HTML. You can choose USPS First Class, Standard, Priority, Priority Express, or FedEx Overnight, plus options such as color, certified mail, and a return envelope.
    • Postcards. POST /v2/postcards sends a 4×6 or 6×9 postcard from two image URLs, by USPS First Class.
    • Checks. POST /v2/checks sends a printed check drawn on a bank account you have added and verified in the dashboard. DocuPost support provides the account’s bank_account_id. The cost is DocuPost’s fee for printing and mailing; the check amount is paid by your bank when the check is deposited.

    Every piece gets an ID with a type prefix, such as letter_, postcard_, or check_. You can fetch a piece with GET /v2/letters/{id} and the matching postcard and check URLs, and cancel one that has not gone to print with POST /v2/letters/{id}/cancel.

    To list mail you have already submitted, use GET /v2/letters. It returns your letters newest first, including letters sent from the dashboard, the v1 API, and integrations. Only submitted letters are listed; keep the created_after window reasonably recent for faster results.

    Once a piece is accepted, the response includes its cost, a link to it in the DocuPost app, and a delivery object you can follow as it moves from preparing to in transit or delivered.

    Check the price, and catch invalid options, before you send

    Use GET /v2/prices/letters, GET /v2/prices/postcards, or GET /v2/prices/checks to see what a piece will cost before you send it. Pass the same options you would send, as query parameters. Nothing is mailed or charged, and the prices are the same ones the DocuPost dashboard shows. The response includes a unit price, a total, and an estimated delivery window.

    For letters, you pass a pages count to get the quote. When you actually send the letter, the cost is worked out from the PDF or HTML you provide.

    Invalid options come back as 422 with validation_failed, and every problem is listed in details — the same response you would get if you tried to send that combination. That includes mail-class limits and combinations that cannot be mailed, such as a return envelope with Priority Mail or FedEx Overnight. Unrecognized fields are also rejected, so a typo in a request does not go unnoticed.

    Built to take a burst of sends

    Every send request is checked immediately. If it is valid, it is queued and you get 202 Accepted right away, even during a burst of thousands of requests. DocuPost then submits queued mail for printing at a steady pace. Large batches are never rejected for volume; they take a little longer to work through.

    A queued piece is not charged yet. When it is accepted, your balance is charged and you can open it in the dashboard. If it fails, it is not charged, and the response includes the reason — for example, insufficient funds.

    Add an Idempotency-Key header to every request that creates mail. If the request times out and you retry with the same key and body, you get the original object back. Nothing is sent twice. Funds are checked when a piece is submitted, so if your balance runs out partway through a batch, the remaining pieces fail and you can top up and send those again.

    You can also check your balance at any time with GET /v2/account.

    If you already use the v1 API

    v1 keeps working, and the same API token works on both. In v2, the token goes in a header, parameters are one JSON body, errors use real HTTP status codes, every piece gets an ID, and sends are queued. Everything under /v2 stays backward compatible; we may add fields or values, so write clients that tolerate them.

    Familiar v1 calls map directly: sendletter becomes POST /v2/letters, sendpostcard becomes POST /v2/postcards, sendcheck becomes POST /v2/checks, viewletter becomes GET /v2/letters/letter_X, viewletters becomes GET /v2/letters, cancelletter becomes POST /v2/letters/{id}/cancel, and getbalance becomes GET /v2/account. Mail you already sent from the dashboard or v1 can be fetched and canceled in v2 as letter_<dashboard_id>, and the same pattern for postcards and checks.

    The docs include a full field-by-field migration table, including renamed address fields, mail classes, and check parameters.

    Prefer to send mail by asking, not by writing code?

    You can also connect DocuPost to Claude, ChatGPT, and other AI assistants and send mail in plain English, with no code. That uses the same platform, through our MCP server. We wrote about how to set it up in Send physical mail from your AI assistant.

    Ready to build against v2

    Generate your API token in Account Settings → API, turn on Sandbox Mode while you experiment, and open the docs. We’ll take care of the printing, postage, and the trip to the post office.

    Read the v2 API docs

    Share this article

    Start sending today

    Send your first letter in minutes.

    No stamps, no printer, no trip to the post office. Create a free account, add a $10 balance, and DocuPost handles the printing and mailing.