Create an invoice
const url = 'https://api.brrndops.com/v1/invoices';const options = { method: 'POST', headers: { 'Idempotency-Key': '7f1c0f54-3a2b-4d5e-8f9a-0b1c2d3e4f5a', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"currency":"NGN","customer":{"name":"Bola Ade","email":"bola@example.com"},"line_items":[{"description":"Design work","quantity":2,"unit_amount":1500000}],"tax_percent":7.5,"due_date":"2026-10-31","external_ref":"order_123","metadata":{"order_id":"123"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.brrndops.com/v1/invoices \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: 7f1c0f54-3a2b-4d5e-8f9a-0b1c2d3e4f5a' \ --data '{ "currency": "NGN", "customer": { "name": "Bola Ade", "email": "bola@example.com" }, "line_items": [ { "description": "Design work", "quantity": 2, "unit_amount": 1500000 } ], "tax_percent": 7.5, "due_date": "2026-10-31", "external_ref": "order_123", "metadata": { "order_id": "123" } }'Creates an invoice. Totals are calculated for you from line_items, tax_percent and discount_percent.
If you don’t pass number, the next number is assigned (INV-001, INV-002…; sandbox uses TEST-INV-001…).
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Header Parameters
Section titled “Header Parameters”Example
7f1c0f54-3a2b-4d5e-8f9a-0b1c2d3e4f5aA unique string (1–255 printable ASCII characters) that makes retries safe.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Must be unique in the account. Leave out to auto-number.
ISO 4217. Three-decimal currencies (KWD, BHD…) aren’t supported.
Who you’re billing. name is required on create.
object
ISO 3166-1 alpha-2
Who the invoice is from. Defaults to your business details.
object
ISO 3166-1 alpha-2
object
Price per unit in minor units.
At most two decimal places.
Defaults to today (UTC).
Defaults to issue_date.
Bank or payment instructions printed on the invoice (max 8KB).
object
Must be https.
Your own ID for this invoice; filter lists by it.
Up to 50 keys of your own data.
object
Example
{ "currency": "NGN", "customer": { "name": "Bola Ade", "email": "bola@example.com" }, "line_items": [ { "description": "Design work", "quantity": 2, "unit_amount": 1500000 } ], "tax_percent": 7.5, "due_date": "2026-10-31", "external_ref": "order_123", "metadata": { "order_id": "123" }}Responses
Section titled “ Responses ”The created invoice.
object
object
ISO 3166-1 alpha-2
object
ISO 3166-1 alpha-2
object
Quantity × unit_amount.
Subtotal + tax_amount − discount_amount.
object
Must be https.
object
Example
{ "id": "inv_8f3c0e7e-5d2a-4c1b-9f43-2c1d0a9b7e11", "object": "invoice", "number": "INV-001", "status": "draft", "customer": { "country_code": "NG" }, "issuer": { "country_code": "NG" }, "line_items": [ { "id": "li_…", "object": "line_item" } ], "branding": { "primary_color": "#2388ff", "secondary_color": "#f7f8fc" }}The request was invalid: a missing or malformed field (param says which), an unknown field, or a rule such as a disallowed status change.
object
object
The request field the error relates to.
Example
{ "error": { "type": "authentication_error", "code": "parameter_missing" }}Missing, invalid, expired or revoked API key.
object
object
The request field the error relates to.
Example
{ "error": { "type": "authentication_error", "code": "parameter_missing" }}Production key on an account without an active plan (subscription_inactive). Sandbox keys keep working.
object
object
The request field the error relates to.
Example
{ "error": { "type": "authentication_error", "code": "parameter_missing" }}The key lacks the required scope (insufficient_scope), or the business isn’t verified yet (account_not_verified, production keys only).
object
object
The request field the error relates to.
Example
{ "error": { "type": "authentication_error", "code": "parameter_missing" }}invoice_number_taken, or request_in_progress when a request with the same Idempotency-Key is still running.
object
object
The request field the error relates to.
Example
{ "error": { "type": "authentication_error", "code": "parameter_missing" }}Request body over 2MB.
object
object
The request field the error relates to.
Example
{ "error": { "type": "authentication_error", "code": "parameter_missing" }}The Idempotency-Key was already used with a different request.
object
object
The request field the error relates to.
Example
{ "error": { "type": "authentication_error", "code": "parameter_missing" }}