Get an API key

Self-serve, no sign-up form and no email to anyone. The CLI login opens your browser, you sign in and approve access, and the backend mints an API key bound to your account.

npm i -g @postbotcz/cli
posta auth
# the key is saved as apiKey in ~/.config/postbot/credentials.json

Quickstart

Preview first, then send the same body. The hosted API has no Sandbox: /api/v1/preview is the free dry run, and every /api/v1/send mails a real letter. To run a whole send without mail, use the Sandbox below.

cat > letter.json <<'EOF'
{"to": {"name": "Jan Novák", "street": "Dlouhá", "houseNumber": "5", "zip": "110 00", "city": "Praha"},
 "document": {"text": "Dear Mr. Novák, ..."},
 "service": "obycejne"}
EOF

# 1. Preview: exact PDF + firm price. No charge, nothing mailed.
curl -X POST https://postbot.cz/api/v1/preview \
  -H "content-type: application/json" -d @letter.json

# 2. Send: charged from prepaid credit, mailed by Česká pošta.
curl -X POST https://postbot.cz/api/v1/send \
  -H "authorization: Bearer $POSTBOT_API_KEY" \
  -H "content-type: application/json" -d @letter.json

Sandbox

The hosted API at postbot.cz has no Sandbox. Its free dry run is POST /api/v1/preview: it returns the exact PDF and the firm price, charges nothing, and mails nothing. To run a whole send without mail, self-host the @postbotcz/mcp server against the Česká pošta Sandbox.

claude mcp add postbot \
  -e POSTBOT_TEST=1 -e POSTBOT_CP_USER=dreplech -e POSTBOT_CP_PASSWD=dreplech \
  -- npx -y @postbotcz/mcp

REST API

JSON endpoints under https://postbot.cz/api/v1. The request body for sending and previewing is the same as the MCP send_letter_cz tool's input.

POST /api/v1/send

Send a letter

Prints, envelopes, and mails a letter via Česká pošta. Charged against the account's prepaid CZK credit; the price is computed from the rendered PDF (postage band + print).

POST /api/v1/preview

Preview + firm price

Renders the exact PDF that would be printed and returns it with the firm price. No side effects — use before /api/v1/send or /api/v1/oneoff to show a human what will mail.

POST /api/v1/topup

Top up credit

Funds the account's prepaid CZK balance via Stripe. Returns a Stripe Checkout URL.

POST /api/v1/oneoff

Pay for one letter, no account

One-off card payment for a single letter. Prices the rendered PDF and returns a pay URL.

GET /api/v1/balance

Prepaid balance

The CZK balance /api/v1/send draws from. Needs an API key. The CLI equivalent is posta balance.

GET /api/v1/orders

List your letters

Your letters, newest first, one page at a time: limit (1–100, default 20) and cursor. The answer carries data, next_cursor and has_more. For the next page, send next_cursor back unchanged as cursor. It never returns the letter content. Needs an API key. On the hosted /mcp, the list_letters tool does the same (OAuth with the letters:read scope).

GET /api/v1/orders/{orderId}

Letter status

Status, Česká pošta order code, and tracking number of one of your letters. Needs an API key. The CLI equivalent is posta status.

Authentication and payment (401 / 402)

Versioning

The API version is in the path. The versioned base URL is https://postbot.cz/api/v1. Unversioned /api/* paths serve the same v1 surface, so existing clients keep working.

POST https://postbot.cz/api/v1/send
POST https://postbot.cz/api/send     # same endpoint, same v1 contract

Errors

Every error is JSON: a stable error code, a message that says what to fix, and the matching HTTP status. openapi.json types it as the Error schema.

{"error": "invalid_letter", "message": "to: Invalid input"}

Rate limits

The three public endpoints below are limited per client IP in a fixed one-minute window. The counters run per edge instance, best effort: treat them as a backstop, not as a quota to plan against.

RateLimit-Limit: <requests allowed in the window>
RateLimit-Remaining: <requests left in the window>
RateLimit-Reset: <seconds until the window resets>
Retry-After: <seconds to wait>   # on 429 only

CLI

The @postbotcz/cli terminal client calls the same core as REST and MCP.

Install

npm i -g @postbotcz/cli
# or: bun add -g @postbotcz/cli

Usage

posta send letter.md --to-name "Jan Novák" --to-street "Dlouhá" --to-house "5" --to-city "Praha" --to-zip "110 00"
posta status 3f9a2b7c-1d4e-4a8b-9c2f-6e5d0a1b2c3d

MCP self-host

Hosted server (no install)

Add https://postbot.cz/mcp to your agent as a remote MCP server (Streamable HTTP) — nothing to install.

Self-host (stdio)

npx -y @postbotcz/mcp

For the full 3-step agent-connection recipe (install, first letter, credit), see For agents.

Agent discovery

Machine-readable entry points for agents that discover Postbot on their own.

Pricing

Current live minimums and the price formula live on the Pricing.