Skip to Content

Invoices API

Base path: https://gateway.useyona.com/i/v1/invoices


Create invoice

POST /i/v1/invoices

Create a draft invoice.

Request body

FieldTypeRequiredDescription
sellerIdstring (UUID)YesRegistered seller ID
buyerIdstring (UUID)YesRegistered buyer ID
invoiceNumberstringYesUnique per organization, max 100 chars
invoiceTypestringNostandard | credit_note | debit_note | prepayment. Default: standard
invoiceDatestringYesISO date, e.g. 2026-04-30
dueDatestringNoISO date
currencystringNoNGN | USD | EUR | GBP. Default: NGN
lineItemsarrayYesAt least one line item required
allowanceAmountnumberNoDocument-level discount, min 0
chargeAmountnumberNoDocument-level surcharge, min 0
paymentStatusstringNounpaid | partially_paid | paid | overdue. Default: unpaid
paymentTermsstringNoMax 500 chars
notesstringNoFree text
originalInvoiceNumberstringNoFor credit/debit notes, max 100 chars

Line item fields

FieldTypeRequiredDescription
descriptionstringYesMax 500 chars
hsnCodestringYesTax classification code, max 20 chars
quantitynumberYesMin 0.001
unitCodestringYesUnit of measure: EA, KGM, HUR, LTR, etc. Max 10 chars
unitPricenumberYesPrice per unit, min 0
discountAmountnumberNoLine-level discount, min 0
taxPercentnumberYesTax rate 0-100 (e.g. 7.5 for 7.5%)
bash
curl -X POST https://gateway.useyona.com/i/v1/invoices \
  -H "Authorization: Bearer sk_test_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "sellerId": "c7a1d3e5-8f2b-4a6c-9d0e-1f2a3b4c5d6e",
    "buyerId": "d8b2e4f6-9a3c-5b7d-0e1f-2a3b4c5d6e7f",
    "invoiceNumber": "INV-2026-001",
    "invoiceDate": "2026-04-30",
    "dueDate": "2026-05-30",
    "currency": "NGN",
    "lineItems": [
      {
        "description": "Software development services - April 2026",
        "hsnCode": "9983",
        "quantity": 80,
        "unitCode": "HUR",
        "unitPrice": 15000,
        "taxPercent": 7.5
      },
      {
        "description": "Cloud infrastructure hosting",
        "hsnCode": "9984",
        "quantity": 1,
        "unitCode": "EA",
        "unitPrice": 450000,
        "taxPercent": 7.5
      }
    ],
    "paymentTerms": "Net 30"
  }'
StatusCodeTrigger
400VAL001Missing or invalid fields
400INV001Invalid invoice format
400BIZ001Insufficient credits
404RES001Seller or buyer not found
409RES002Invoice number already exists for this organization

List invoices

GET /i/v1/invoices

List invoices with filters and pagination.

Query parameters

ParameterTypeRequiredDefaultDescription
statusstringNoFilter: draft, queued, pending, accepted, rejected, failed, cancelled
invoiceTypestringNoFilter: standard, credit_note, debit_note, prepayment
paymentStatusstringNoFilter: unpaid, partially_paid, paid, overdue
currencystringNoFilter: NGN, USD, EUR, GBP
sellerIdstringNoFilter by seller UUID
buyerIdstringNoFilter by buyer UUID
invoiceDateFromstringNoISO date, inclusive
invoiceDateTostringNoISO date, inclusive
searchstringNoSearch invoice number and notes
pagenumberNo1Page number
limitnumberNo20Items per page
sortBystringNocreatedAtSort field
sortOrderstringNoDESCASC or DESC
bash
curl "https://gateway.useyona.com/i/v1/invoices?status=draft&page=1&limit=10&sortOrder=DESC" \
  -H "Authorization: Bearer sk_test_your_key_here"

Get invoice

GET /i/v1/invoices/:id

Retrieve a single invoice by ID. Returns the full invoice object including line items.

bash
curl https://gateway.useyona.com/i/v1/invoices/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
  -H "Authorization: Bearer sk_test_your_key_here"
StatusCodeTrigger
404RES001Invoice 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.

bash
curl -X PATCH https://gateway.useyona.com/i/v1/invoices/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
  -H "Authorization: Bearer sk_test_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "dueDate": "2026-06-30",
    "paymentTerms": "Net 60",
    "notes": "Updated payment terms per client agreement"
  }'
StatusCodeTrigger
400INV003Invoice is not in draft status
400VAL001Invalid field values
404RES001Invoice not found

Delete invoice

DELETE /i/v1/invoices/:id

Delete a draft invoice. Only invoices in draft status can be deleted.

bash
curl -X DELETE https://gateway.useyona.com/i/v1/invoices/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
  -H "Authorization: Bearer sk_test_your_key_here"
StatusCodeTrigger
400INV003Invoice is not in draft status
404RES001Invoice 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.

bash
curl -X POST https://gateway.useyona.com/i/v1/invoices/a1b2c3d4-e5f6-7890-abcd-ef1234567890/submit \
  -H "Authorization: Bearer sk_test_your_key_here"
StatusCodeTrigger
400BIZ004Invoice is not in draft status
400INV002Invoice already submitted
400BIZ001Insufficient credits
404RES001Invoice not found

Batch submit

POST /i/v1/invoices/batch-submit

Submit multiple invoices at once. Maximum 100 invoices per request.

Request body

FieldTypeRequiredDescription
invoiceIdsstring[]YesArray of invoice UUIDs, 1-100 items
bash
curl -X POST https://gateway.useyona.com/i/v1/invoices/batch-submit \
  -H "Authorization: Bearer sk_test_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "invoiceIds": [
      "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "c3d4e5f6-a7b8-9012-cdef-123456789012"
    ]
  }'

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.

bash
curl -X POST https://gateway.useyona.com/i/v1/invoices/a1b2c3d4-e5f6-7890-abcd-ef1234567890/retry \
  -H "Authorization: Bearer sk_test_your_key_here"
StatusCodeTrigger
400BIZ004Invoice is not in failed status
404RES001Invoice 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

FieldTypeRequiredDescription
reasonstringYesCancellation reason
notesstringNoAdditional notes
bash
curl -X POST https://gateway.useyona.com/i/v1/invoices/a1b2c3d4-e5f6-7890-abcd-ef1234567890/cancel \
  -H "Authorization: Bearer sk_test_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{ "reason": "Duplicate invoice issued in error" }'
StatusCodeTrigger
400BIZ004Invoice is not in accepted status
404RES001Invoice not found

Get invoice status

GET /i/v1/invoices/:id/status

Get current invoice status from the local database. Fast and suitable for polling.

bash
curl https://gateway.useyona.com/i/v1/invoices/a1b2c3d4-e5f6-7890-abcd-ef1234567890/status \
  -H "Authorization: Bearer sk_test_your_key_here"

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.

bash
curl -X POST https://gateway.useyona.com/i/v1/invoices/a1b2c3d4-e5f6-7890-abcd-ef1234567890/query-status \
  -H "Authorization: Bearer sk_test_your_key_here"
StatusCodeTrigger
404RES001Invoice not found
502TAX001Tax 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.

bash
curl -X POST https://gateway.useyona.com/i/v1/invoices/validate \
  -H "Authorization: Bearer sk_test_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "sellerId": "c7a1d3e5-8f2b-4a6c-9d0e-1f2a3b4c5d6e",
    "buyerId": "d8b2e4f6-9a3c-5b7d-0e1f-2a3b4c5d6e7f",
    "invoiceNumber": "INV-2026-002",
    "invoiceDate": "2026-04-30",
    "lineItems": [{
      "description": "Annual ERP licensing fee",
      "hsnCode": "9984",
      "quantity": 1,
      "unitCode": "EA",
      "unitPrice": 2500000,
      "taxPercent": 7.5
    }]
  }'
StatusCodeTrigger
400VAL001Missing or invalid fields
400INV001Invalid invoice format
404RES001Seller 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

ParameterTypeDefaultDescription
formatstringpdfpdf | xml. Default: pdf
bash
curl "https://gateway.useyona.com/i/v1/invoices/a1b2c3d4-e5f6-7890-abcd-ef1234567890/download?format=pdf" \
  -H "Authorization: Bearer sk_test_your_key_here"

Get statistics

GET /i/v1/invoices/statistics

Get invoice counts and totals grouped by status.

Query parameters

ParameterTypeRequiredDescription
startDatestringNoISO date, filter from
endDatestringNoISO date, filter to
jurisdictionstringNoISO 2-letter country code
bash
curl "https://gateway.useyona.com/i/v1/invoices/statistics?startDate=2026-01-01&endDate=2026-04-30" \
  -H "Authorization: Bearer sk_test_your_key_here"

Search HSN codes

GET /i/v1/invoices/hsn-codes

Search HSN/tax classification codes by keyword.

Query parameters

ParameterTypeRequiredDescription
searchstringNoKeyword search
categorystringNoFilter by category
bash
curl "https://gateway.useyona.com/i/v1/invoices/hsn-codes?search=software&category=Services" \
  -H "Authorization: Bearer sk_test_your_key_here"

HSN code categories

GET /i/v1/invoices/hsn-codes/categories

List all available HSN code categories with their code counts.

bash
curl https://gateway.useyona.com/i/v1/invoices/hsn-codes/categories \
  -H "Authorization: Bearer sk_test_your_key_here"

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.

bash
curl https://gateway.useyona.com/i/v1/invoices/resources \
  -H "Authorization: Bearer sk_test_your_key_here"

Get resource by type

GET /i/v1/invoices/resources/:type

Retrieve a single resource type instead of all resources at once.

Path parameters

ParameterTypeRequiredDescription
typestringYescountries | currencies | tax-categories | payment-means | invoice-types | service-codes | tax-exemptions | product-codes
bash
curl https://gateway.useyona.com/i/v1/invoices/resources/tax-categories \
  -H "Authorization: Bearer sk_test_your_key_here"
StatusCodeTrigger
400VAL001Invalid 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.

bash
curl https://gateway.useyona.com/i/v1/invoices/lookup/tax-id/12345678-0001 \
  -H "Authorization: Bearer sk_test_your_key_here"
StatusCodeTrigger
400VAL001Invalid tax ID format
502TAX001Tax 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

FieldTypeRequiredDescription
referencestringYesInvoice reference to validate
businessIdstringYesBusiness registration ID
externalReferencestringNoExternal reference for correlation
bash
curl -X POST https://gateway.useyona.com/i/v1/invoices/reference/validate \
  -H "Authorization: Bearer sk_test_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "reference": "NRS-2026-REF-00891",
    "businessId": "RC-123456"
  }'
StatusCodeTrigger
400VAL001Missing or invalid fields
502TAX001Tax 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

FieldTypeRequiredDescription
invoiceReferencestringYesInvoice reference number
supplierTaxIdstringYesSupplier tax identification number
buyerTaxIdstringYesBuyer tax identification number
baseAmountnumberYesPre-tax amount
taxAmountnumberYesTax amount
taxRatenumberYesTax rate percentage (e.g. 7.5)
totalAmountnumberYesTotal including tax
currencystringYesCurrency code: NGN, USD, EUR, GBP
transactionDatestringYesISO date of the transaction
itemDescriptionstringYesDescription of goods or services
integratorServiceIdstringNoIntegrator service identifier
otherTaxesnumberNoAdditional tax amounts
taxStatusstringNoTax status override
bash
curl -X POST https://gateway.useyona.com/i/v1/invoices/a1b2c3d4-e5f6-7890-abcd-ef1234567890/tax-report \
  -H "Authorization: Bearer sk_test_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "invoiceReference": "NRS-2026-REF-00891",
    "supplierTaxId": "12345678-0001",
    "buyerTaxId": "87654321-0001",
    "baseAmount": 1650000,
    "taxAmount": 123750,
    "taxRate": 7.5,
    "totalAmount": 1773750,
    "currency": "NGN",
    "transactionDate": "2026-04-30",
    "itemDescription": "Software development and cloud hosting services"
  }'
StatusCodeTrigger
400VAL001Missing or invalid fields
404RES001Invoice not found
502TAX001Tax authority connection error
Last updated on