Skip to main content

Create invoice

Create a new invoice for a customer. You must supply at least one line item. Line items can reference existing products by ID (which auto-populates description and price) or be freeform entries with a description and unit price.
POST /api/v1/invoices/

Authentication

x-api-key: your_api_key
x-api-secret: your_api_secret

Request body

Invoice details
title
string
required
A descriptive title for the invoice, e.g. "Web Development Services — March 2024".
currency
string
ISO 4217 3-letter currency code. Defaults to "USD" if not provided. Example: "NGN".
companyName
string
required
Your company or business name as it should appear on the invoice.
email
string
required
Your business email address. Must be a valid email.
issueDate
string
ISO 8601 date-time of when the invoice is issued. Defaults to now if omitted. Example: "2024-04-01T00:00:00Z".
dueDate
string
ISO 8601 date-time of the payment due date. Example: "2024-04-30T00:00:00Z".
Customer details
customerName
string
required
Full name of the customer receiving the invoice.
customerEmail
string
required
Customer’s email address. Must be a valid email. Used when sending the invoice by email.
billingAddress
string
Customer’s street billing address.
city
string
Customer’s city.
state
string
Customer’s state or province.
country
string
Customer’s country.
zipCode
string
Customer’s postal / zip code.
Tax & discounts (invoice-level) When you set taxType at the invoice level, it overrides any per-line-item tax settings.
taxType
string
How tax is applied across the invoice. One of: "none", "percentage", "fixed". Defaults to "none".
taxRate
number
Tax value. When taxType is "percentage", this is the percentage (e.g. 7.5 for 7.5%). When taxType is "fixed", this is the flat amount per line item.
discountType
string
How the discount is applied. One of: "none", "percentage", "fixed". Defaults to "none".
discount
number
Discount value. Interpretation depends on discountType.
shippingFee
number
Flat shipping fee added to the invoice total.
Other
notes
string
Optional notes or payment instructions shown on the invoice.
metadata
object
Arbitrary key-value pairs you want to attach to the invoice for your own reference.
checkoutCallbackUrl
string
An HTTPS URL Hyparrow will POST to when a checkout-link payment for this invoice changes status (completed, pending, or failed).
Line items
lineItems
array
required
Array of line item objects. At least one is required.

Example request

curl --request POST \
  --url https://api.hyparrow.com/api/v1/invoices/ \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: your_api_key' \
  --header 'x-api-secret: your_api_secret' \
  --data '{
    "title": "Web Development Services — Q1 2024",
    "currency": "NGN",
    "companyName": "Acme Corp",
    "email": "billing@acme.com",
    "issueDate": "2024-04-01T00:00:00Z",
    "dueDate": "2024-04-30T00:00:00Z",
    "customerName": "Jane Doe",
    "customerEmail": "jane@example.com",
    "billingAddress": "12 Victoria Island",
    "city": "Lagos",
    "state": "Lagos",
    "country": "Nigeria",
    "taxType": "percentage",
    "taxRate": 7.5,
    "discountType": "none",
    "shippingFee": 0,
    "notes": "Payment due within 30 days.",
    "lineItems": [
      {
        "description": "Frontend development",
        "quantity": 1,
        "unitPrice": 250000
      },
      {
        "description": "API integration",
        "quantity": 2,
        "unitPrice": 75000
      }
    ]
  }'

Example response

201 Created
{
  "success": true,
  "message": "Invoice created successfully",
  "data": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "invoiceNumber": "invoice-hpw-000000001",
    "title": "Web Development Services — Q1 2024",
    "currency": "NGN",
    "companyName": "Acme Corp",
    "email": "billing@acme.com",
    "customerName": "Jane Doe",
    "customerEmail": "jane@example.com",
    "issueDate": "2024-04-01T00:00:00Z",
    "dueDate": "2024-04-30T00:00:00Z",
    "taxType": "percentage",
    "taxRate": 7.5,
    "discountType": "none",
    "discount": 0,
    "shippingFee": 0,
    "subTotal": 400000,
    "taxTotal": 30000,
    "discountTotal": 0,
    "totalAmount": 430000,
    "status": "draft",
    "lineItems": [
      {
        "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "description": "Frontend development",
        "quantity": 1,
        "unitPrice": 250000,
        "taxType": "none",
        "taxRate": 0,
        "discountType": "none",
        "discount": 0
      },
      {
        "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
        "description": "API integration",
        "quantity": 2,
        "unitPrice": 75000,
        "taxType": "none",
        "taxRate": 0,
        "discountType": "none",
        "discount": 0
      }
    ],
    "createdAt": "2024-04-01T08:00:00Z",
    "updatedAt": "2024-04-01T08:00:00Z"
  }
}

Add line item

Add a new line item to an existing invoice.
POST /api/v1/invoices/:invoiceId/line-items

Path parameters

invoiceId
string
required
UUID of the invoice to add the line item to.

Request body

description
string
required
Description of the line item.
quantity
integer
required
Number of units. Must be greater than 0.
unitPrice
number
required
Price per unit. Must be greater than 0.
taxType
string
Tax type for this line item: "none", "percentage", or "fixed". Only applied when the invoice-level taxType is "none".
taxRate
number
Tax rate or fixed amount for this line item.
discountType
string
Discount type for this line item: "none", "percentage", or "fixed".
discount
number
Discount value for this line item.

Example request

curl --request POST \
  --url https://api.hyparrow.com/api/v1/invoices/3fa85f64-5717-4562-b3fc-2c963f66afa6/line-items \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: your_api_key' \
  --header 'x-api-secret: your_api_secret' \
  --data '{
    "description": "Hosting setup fee",
    "quantity": 1,
    "unitPrice": 15000
  }'

Example response

201 Created
{
  "success": true,
  "message": "Line item added",
  "data": {
    "id": "c3d4e5f6-a7b8-9012-cdef-012345678902",
    "invoiceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "description": "Hosting setup fee",
    "quantity": 1,
    "unitPrice": 15000,
    "taxType": "none",
    "taxRate": 0,
    "discountType": "none",
    "discount": 0,
    "createdAt": "2024-04-02T09:00:00Z",
    "updatedAt": "2024-04-02T09:00:00Z"
  }
}

List invoices

Returns a paginated list of all invoices for your account.
GET /api/v1/invoices/

Query parameters

page
integer
Page number. Defaults to 1.
limit
integer
Number of results per page. Defaults to 20.
status
string
Filter by invoice status. One of: draft, pending, paid, overdue, canceled.

Example request

cURL
curl --request GET \
  --url 'https://api.hyparrow.com/api/v1/invoices/?page=1&limit=10&status=pending' \
  --header 'x-api-key: your_api_key' \
  --header 'x-api-secret: your_api_secret'

Example response

200 OK
{
  "success": true,
  "data": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "invoiceNumber": "invoice-hpw-000000001",
      "title": "Web Development Services — Q1 2024",
      "customerName": "Jane Doe",
      "customerEmail": "jane@example.com",
      "totalAmount": 430000,
      "currency": "NGN",
      "status": "pending",
      "dueDate": "2024-04-30T00:00:00Z",
      "createdAt": "2024-04-01T08:00:00Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 1,
    "totalPages": 1
  }
}

Get invoice

Retrieve a single invoice by its ID.
GET /api/v1/invoices/:invoiceId

Path parameters

invoiceId
string
required
UUID of the invoice to retrieve.

Example request

cURL
curl --request GET \
  --url https://api.hyparrow.com/api/v1/invoices/3fa85f64-5717-4562-b3fc-2c963f66afa6 \
  --header 'x-api-key: your_api_key' \
  --header 'x-api-secret: your_api_secret'

Example response

200 OK
{
  "success": true,
  "data": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "invoiceNumber": "invoice-hpw-000000001",
    "title": "Web Development Services — Q1 2024",
    "currency": "NGN",
    "companyName": "Acme Corp",
    "email": "billing@acme.com",
    "customerName": "Jane Doe",
    "customerEmail": "jane@example.com",
    "issueDate": "2024-04-01T00:00:00Z",
    "dueDate": "2024-04-30T00:00:00Z",
    "taxType": "percentage",
    "taxRate": 7.5,
    "subTotal": 400000,
    "taxTotal": 30000,
    "discountTotal": 0,
    "totalAmount": 430000,
    "status": "pending",
    "notes": "Payment due within 30 days.",
    "lineItems": [],
    "createdAt": "2024-04-01T08:00:00Z",
    "updatedAt": "2024-04-01T08:00:00Z"
  }
}