Invoice Generation API
Generate invoice PDF profesional secara terprogram dari server Anda sendiri — cocok untuk integrasi dengan sistem internal, marketplace, atau produk SaaS Anda sendiri.
1. Autentikasi
Buat API key di app.invosend.com/settings/api-keys (perlu akun workspace, role owner). Raw key hanya ditampilkan sekali saat pertama dibuat — simpan dengan aman, key tidak bisa dilihat ulang setelahnya (hanya bisa di-revoke dan generate baru).
Sertakan key sebagai Bearer token di header
Authorization pada setiap request:
Authorization: Bearer isk_live_xxxxxxxxxxxxxxxxxxxxxxxx
API key yang hilang, salah format, tidak valid, atau
sudah di-revoke sama-sama ditolak dengan
403. Key juga otomatis ditolak (403) kalau
membership workspace Anda suspended atau expired.
2. Endpoint
Base URL: https://app.invosend.com
3. Request Body
| Field | Tipe | Wajib | Keterangan |
|---|---|---|---|
customer_name |
string | Ya | Nama klien/penerima invoice. |
customer_email |
string | Tidak | Email valid, dipakai untuk tampilan invoice saja (API ini tidak mengirim email). |
items |
array | Ya |
Minimal 1 item valid (deskripsi terisi,
quantity > 0,
price >= 0).
|
items[].description |
string | Ya | Nama produk/jasa. |
items[].quantity |
number | Ya | Jumlah unit. |
items[].price |
number | Ya | Harga per unit. |
items[].discount |
number | Tidak | Potongan per item, default 0. |
currency |
string | Tidak |
Kode mata uang (mis. IDR,
USD). Default IDR.
|
tax_rate |
number | Tidak | Persentase pajak, dihitung dari subtotal setelah diskon. Default 0. |
due_date |
string | Tidak |
Format YYYY-MM-DD. Default 14
hari dari tanggal generate.
|
notes |
string | Tidak | Catatan tambahan yang tampil di invoice. |
Contoh request lengkap:
curl -X POST https://invosend.com/api/invoices/generate-external \
-H "Authorization: Bearer isk_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"customer_name": "Acme Corp",
"customer_email": "[email protected]",
"items": [
{ "description": "Consulting Services", "quantity": 2, "price": 500000 }
],
"tax_rate": 11,
"currency": "IDR",
"notes": "Thank you for your business."
}'
4. Response
200 OK — invoice berhasil dibuat dan PDF
ter-generate:
{
"data": {
"invoice_number": "INV-2026-000123",
"pdf_url": "https://files.invosend.com/invoices/INV-2026-000123.pdf",
"credits_remaining": 24
}
}
credits_remaining bernilai
null kalau workspace Anda punya kuota
unlimited (tier tertentu). Invoice yang dibuat lewat API
ini juga langsung muncul di daftar invoice dashboard
workspace Anda — nomor invoice berasal dari sequence
yang sama dengan invoice yang dibuat manual, bukan
namespace terpisah.
5. Error Codes
| Status | Penyebab |
|---|---|
400 |
Field wajib hilang/tidak valid
(customer_name,
items kosong, atau tidak ada
item valid).
|
402 |
Saldo invoice_credits workspace
habis — top up kredit untuk lanjut.
|
403 |
Header
Authorization hilang/salah
format, API key tidak valid/sudah di-revoke,
atau membership workspace suspended/expired.
|
429 |
Rate limit terlampaui — lihat bagian Rate Limit di bawah. |
6. Rate Limit
| Scope | Batas |
|---|---|
| Per workspace | 10 request / menit |
| Per alamat IP | 30 request / menit |
Butuh volume lebih tinggi untuk kebutuhan produksi? Hubungi kami lewat akun workspace Anda — belum ada model kuota/harga tingkat lanjut yang final saat ini, jadi diskusi kasus per kasus dulu.
Pertanyaan Umum
Bagaimana cara mendapatkan API key Invosend?
Daftar akun gratis di app.invosend.com, lalu buka Settings > API Keys dan klik Generate New Key. Raw key hanya ditampilkan sekali saat dibuat.
Berapa biaya setiap panggilan API generate invoice?
Setiap panggilan sukses memotong 1 invoice credit dari saldo workspace Anda — kuota yang sama dengan invoice yang dibuat lewat dashboard, bukan kuota terpisah.
Apa rate limit API ini?
10 request per menit per workspace, dan 30 request per menit per alamat IP.