Invoices API
Base path: https://gateway.useyona.com/i/v1/invoices
Create invoice
POST /i/v1/invoices
Create a draft invoice.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
sellerId | string (UUID) | Yes | Registered seller ID |
buyerId | string (UUID) | Yes | Registered buyer ID |
invoiceNumber | string | Yes | Unique per organization, max 100 chars |
invoiceType | string | No | standard | credit_note | debit_note | prepayment. Default: standard |
invoiceDate | string | Yes | ISO date, e.g. 2026-04-30 |
dueDate | string | No | ISO date |
currency | string | No | NGN | USD | EUR | GBP. Default: NGN |
lineItems | array | Yes | At least one line item required |
allowanceAmount | number | No | Document-level discount, min 0 |
chargeAmount | number | No | Document-level surcharge, min 0 |
paymentStatus | string | No | unpaid | partially_paid | paid | overdue. Default: unpaid |
paymentTerms | string | No | Max 500 chars |
notes | string | No | Free text |
originalInvoiceNumber | string | No | For credit/debit notes, max 100 chars |
Line item fields
| Field | Type | Required | Description |
|---|---|---|---|
description | string | Yes | Max 500 chars |
hsnCode | string | Yes | Tax classification code, max 20 chars |
quantity | number | Yes | Min 0.001 |
unitCode | string | Yes | Unit of measure: EA, KGM, HUR, LTR, etc. Max 10 chars |
unitPrice | number | Yes | Price per unit, min 0 |
discountAmount | number | No | Line-level discount, min 0 |
taxPercent | number | Yes | Tax rate 0-100 (e.g. 7.5 for 7.5%) |
| Status | Code | Trigger |
|---|---|---|
| 400 | VAL001 | Missing or invalid fields |
| 400 | INV001 | Invalid invoice format |
| 400 | BIZ001 | Insufficient credits |
| 404 | RES001 | Seller or buyer not found |
| 409 | RES002 | Invoice number already exists for this organization |
List invoices
GET /i/v1/invoices
List invoices with filters and pagination.
Query parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
status | string | No | — | Filter: draft, queued, pending, accepted, rejected, failed, cancelled |
invoiceType | string | No | — | Filter: standard, credit_note, debit_note, prepayment |
paymentStatus | string | No | — | Filter: unpaid, partially_paid, paid, overdue |
currency | string | No | — | Filter: NGN, USD, EUR, GBP |
sellerId | string | No | — | Filter by seller UUID |
buyerId | string | No | — | Filter by buyer UUID |
invoiceDateFrom | string | No | — | ISO date, inclusive |
invoiceDateTo | string | No | — | ISO date, inclusive |
search | string | No | — | Search invoice number and notes |
page | number | No | 1 | Page number |
limit | number | No | 20 | Items per page |
sortBy | string | No | createdAt | Sort field |
sortOrder | string | No | DESC | ASC or DESC |
Get invoice
GET /i/v1/invoices/:id
Retrieve a single invoice by ID. Returns the full invoice object including line items.
| Status | Code | Trigger |
|---|---|---|
| 404 | RES001 | Invoice not found |
Update invoice
PATCH /i/v1/invoices/:id
Update a draft invoice. Only invoices in draft status can be updated. Fields sellerId, buyerId, and invoiceNumber are immutable after creation.
| Status | Code | Trigger |
|---|---|---|
| 400 | INV003 | Invoice is not in draft status |
| 400 | VAL001 | Invalid field values |
| 404 | RES001 | Invoice not found |
Delete invoice
DELETE /i/v1/invoices/:id
Delete a draft invoice. Only invoices in draft status can be deleted.
| Status | Code | Trigger |
|---|---|---|
| 400 | INV003 | Invoice is not in draft status |
| 404 | RES001 | Invoice not found |
Submit invoice
POST /i/v1/invoices/:id/submit
Queue an invoice for submission to the tax authority. The invoice must be in draft status. In production, submission is irreversible.
| Status | Code | Trigger |
|---|---|---|
| 400 | BIZ004 | Invoice is not in draft status |
| 400 | INV002 | Invoice already submitted |
| 400 | BIZ001 | Insufficient credits |
| 404 | RES001 | Invoice not found |
Batch submit
POST /i/v1/invoices/batch-submit
Submit multiple invoices at once. Maximum 100 invoices per request.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
invoiceIds | string[] | Yes | Array of invoice UUIDs, 1-100 items |
Retry failed submission
POST /i/v1/invoices/:id/retry
Retry a failed invoice submission. Only invoices in failed status can be retried. Maximum 5 retry attempts.
| Status | Code | Trigger |
|---|---|---|
| 400 | BIZ004 | Invoice is not in failed status |
| 404 | RES001 | Invoice not found |
Cancel invoice
POST /i/v1/invoices/:id/cancel
Cancel an accepted invoice. Creates a credit note automatically. Only invoices in accepted status can be cancelled.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
reason | string | Yes | Cancellation reason |
notes | string | No | Additional notes |
| Status | Code | Trigger |
|---|---|---|
| 400 | BIZ004 | Invoice is not in accepted status |
| 404 | RES001 | Invoice not found |
Get invoice status
GET /i/v1/invoices/:id/status
Get current invoice status from the local database. Fast and suitable for polling.
Query real-time status
POST /i/v1/invoices/:id/query-status
Query real-time status directly from the tax authority. Slower than getStatus — use sparingly. Best for verifying final acceptance or investigating rejections.
| Status | Code | Trigger |
|---|---|---|
| 404 | RES001 | Invoice not found |
| 502 | TAX001 | Tax authority connection error |
Validate invoice
POST /i/v1/invoices/validate
Validate invoice data without creating it. Uses the same request body as create invoice. Useful for pre-validation before submission.
| Status | Code | Trigger |
|---|---|---|
| 400 | VAL001 | Missing or invalid fields |
| 400 | INV001 | Invalid invoice format |
| 404 | RES001 | Seller or buyer not found |
Download invoice
GET /i/v1/invoices/:id/download
Get a download URL for the invoice PDF. Only accepted invoices can be downloaded.
Query parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
format | string | pdf | pdf | xml. Default: pdf |
Get statistics
GET /i/v1/invoices/statistics
Get invoice counts and totals grouped by status.
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
startDate | string | No | ISO date, filter from |
endDate | string | No | ISO date, filter to |
jurisdiction | string | No | ISO 2-letter country code |
Search HSN codes
GET /i/v1/invoices/hsn-codes
Search HSN/tax classification codes by keyword.
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
search | string | No | Keyword search |
category | string | No | Filter by category |
HSN code categories
GET /i/v1/invoices/hsn-codes/categories
List all available HSN code categories with their code counts.
Get invoice resources
GET /i/v1/invoices/resources
Returns all reference data needed for building invoice forms: countries, currencies, tax categories, payment means, invoice types, service codes, tax exemptions, and product codes.
Get resource by type
GET /i/v1/invoices/resources/:type
Retrieve a single resource type instead of all resources at once.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | countries | currencies | tax-categories | payment-means | invoice-types | service-codes | tax-exemptions | product-codes |
| Status | Code | Trigger |
|---|---|---|
| 400 | VAL001 | Invalid resource type |
Look up tax ID
GET /i/v1/invoices/lookup/tax-id/:value
Look up a taxpayer by their tax identification number. Returns registration status and basic business information from the tax authority.
| Status | Code | Trigger |
|---|---|---|
| 400 | VAL001 | Invalid tax ID format |
| 502 | TAX001 | Tax authority connection error |
Validate reference
POST /i/v1/invoices/reference/validate
Validate an invoice reference number against the tax authority. Useful for verifying that a reference is legitimate before processing payments.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
reference | string | Yes | Invoice reference to validate |
businessId | string | Yes | Business registration ID |
externalReference | string | No | External reference for correlation |
| Status | Code | Trigger |
|---|---|---|
| 400 | VAL001 | Missing or invalid fields |
| 502 | TAX001 | Tax authority connection error |
Submit tax report
POST /i/v1/invoices/:id/tax-report
Submit a tax report for an invoice to the tax authority. This generates a formal tax declaration based on the invoice transaction details.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
invoiceReference | string | Yes | Invoice reference number |
supplierTaxId | string | Yes | Supplier tax identification number |
buyerTaxId | string | Yes | Buyer tax identification number |
baseAmount | number | Yes | Pre-tax amount |
taxAmount | number | Yes | Tax amount |
taxRate | number | Yes | Tax rate percentage (e.g. 7.5) |
totalAmount | number | Yes | Total including tax |
currency | string | Yes | Currency code: NGN, USD, EUR, GBP |
transactionDate | string | Yes | ISO date of the transaction |
itemDescription | string | Yes | Description of goods or services |
integratorServiceId | string | No | Integrator service identifier |
otherTaxes | number | No | Additional tax amounts |
taxStatus | string | No | Tax status override |
| Status | Code | Trigger |
|---|---|---|
| 400 | VAL001 | Missing or invalid fields |
| 404 | RES001 | Invoice not found |
| 502 | TAX001 | Tax authority connection error |