Continua
Tutte le integrazioni

API

Disponibile

A REST API with an OpenAPI description, signed webhooks, a test mode that runs the whole chain, and clients for Node and Python.

Questa pagina è in inglese.

Cosa può farci

  • POST /api/v1/letters with text, a base64 PDF, or a URL to a PDF.
  • Webhooks on submitted, printed, posted, delivered, failed and refunded.
  • Test keys run everything, webhooks included, without printing or charging.

Come collegarla

  1. Create a test key beginning sk_test_ under Account > Developer. Grant only the permissions your application needs.
  2. Use POST /api/v1/letters/prepare with text or a PDF, both addresses and a stable idempotencyKey. It renders the document and returns the exact total without dispatching.
  3. Review the PDF with GET /api/v1/letters/{id}/pdf and have the document and totalCents approved. Then call POST /api/v1/letters with the same input and key plus expectedTotalCents.
  4. Node and Python support prepare and exact-price confirmation from version 1.2.0. Install with npm install sendletter or pip install --upgrade sendletter.
  5. Retry with the same key after a timeout. Track letters with GET /api/v1/letters/{id} or signed webhooks. Switch to a live key only after the complete test chain works.