Skip to main content
This guide takes you from zero to a real invoice PDF using two API calls. All you need is a Swipe account.
API calls run against your live Swipe account — documents you create here are real. You can cancel a test document at any time using its hash_id.
1

Get your API key

Sign in to Swipe and open the API Integration section of your dashboard. Generate an API key and store it securely — it is sent as a Bearer token with every request. See Authentication for details.
2

Create your first invoice

Send a POST request to /v2/doc with a minimal payload — a date, a document type, a customer, and one line item. Replace YOUR_API_KEY with the key from step 1.
The customer CUST001 and item ITEM001 don’t need to exist yet — Swipe creates them automatically from the details you send, and reuses them the next time you send the same IDs. See Create a document for every available field.
3

Grab the hash_id from the response

A successful call returns the document’s identifiers. The hash_id is the document’s address in every other API call — fetching, editing, cancelling, and downloading the PDF.
4

Download the invoice PDF

Pass the hash_id to the PDF endpoint — the response is the PDF file itself.
5

See it in your dashboard

The invoice also appears in your Swipe dashboard alongside documents created in the app — the API and the dashboard work on the same data.

Next steps

API conventions

Response format, error codes, dates, list endpoints, and rate limits.

Create a document

The full document payload — taxes, discounts, serial numbers, and more.

Webhooks

Get notified in real time when documents or inventory change.

E-Invoices

Generate GST-compliant e-invoices with IRN and QR codes.