Skip to content

Developers

API and webhooks

Connect your own software to your invoices with API keys, and get told about new payments and documents through signed webhooks.

The API lets your own software read and change your customers, documents and payments. Webhooks tell your software when something happens, for example when an invoice is paid. Both are included on Pro and Business.

The full reference, with examples in several languages, is at /docs/api.

Make a key

  1. Open Settings and then Developers.
  2. Under API keys press New key.
  3. Give it a Name, for example the software that uses it.
  4. Choose the Mode. Test works only with test documents and the key starts with sk_test_. Live works with your real documents and money and starts with sk_live_.
  5. Under What this key may do, leave Full or choose Only some things and set each area to look or change.
  6. Press Make key. Copy the secret now. You see it once. Press I saved it.

Send it as Authorization: Bearer <key>. Replace makes a new key and the old one keeps working for 24 hours. Stop key ends it at once.

Idempotency-Key

Every POST needs an Idempotency-Key header with a unique value, for example an order number. If the network fails and you try again with the same key, you get the first answer and nothing happens twice. Answers are kept for 24 hours.

Add a webhook

  1. Under Webhooks press New endpoint.
  2. Type the Address. It must start with https://.
  3. Pick the Events, or Everything that happens.
  4. Press Add endpoint. Save the signing secret (it starts with whsec_). It is shown once.

Calls follow the Standard Webhooks format. Each one has webhook-id, webhook-timestamp and webhook-signature headers. Compute an HMAC-SHA256 of the id, the timestamp and the raw body, and compare it with the signature. Reject calls older than 5 minutes and ignore a webhook-id you have seen before.

Use Send a test to check your endpoint. Under Deliveries you see each attempt, Send again failed ones, and New secret rotates the secret with 24 hours overlap. After 24 hours of failures we give up.

Tips

  • Build and test with an sk_test_ key first.
  • Never put a secret key in a web page or a mobile app.
  • Under Recent requests you can see what your keys did.

Start free in a minute

Create an account in a minute. No card needed.