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.
Test in a separate company. API keys are scoped to a company, so the cleanest way to experiment is to add a new company in your Swipe account (e.g. “API Testing”), switch to it, and generate your API key from its API Integration section. Everything you create with that key stays in the test company, leaving your real books untouched. When you go live, generate a key in your actual company and swap it in.
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.