Skip to main content

List all invoices

curl -X GET https://your-domain.com/api/invoices \
  -H "Content-Type: application/json"

Response

message
string
Information about the endpoint status
note
string
Additional implementation notes
Response example
{
  "message": "This endpoint would fetch invoices from a database",
  "note": "Currently using localStorage on the client side"
}

Errors

error
string
Error message describing what went wrong
500 - Internal server error
{
  "error": "Failed to fetch invoices"
}

Create an invoice

curl -X POST https://your-domain.com/api/invoices \
  -H "Content-Type: application/json" \
  -d '{
    "invoiceNumber": "INV-001",
    "date": "2026-03-03",
    "dueDate": "2026-03-17",
    "status": "draft",
    "customer": {
      "id": "cust_123",
      "name": "Acme Corp",
      "email": "[email protected]",
      "address": "123 Main St",
      "city": "New York",
      "state": "NY",
      "zipCode": "10001",
      "country": "USA"
    },
    "items": [
      {
        "id": "item_1",
        "description": "Web Development Services",
        "quantity": 40,
        "rate": 150,
        "taxRate": 10
      }
    ],
    "currency": "USD",
    "notes": "Payment due within 14 days"
  }'

Body parameters

invoiceNumber
string
required
Unique invoice number identifier
date
string
required
Invoice creation date in ISO 8601 format
dueDate
string
required
Payment due date in ISO 8601 format
status
string
required
Invoice status. One of: draft, sent, paid, cancelled
customer
object
required
Customer information object
id
string
required
Unique customer identifier
name
string
required
Customer name
email
string
required
Customer email address
address
string
required
Street address
city
string
required
City
state
string
required
State or province
zipCode
string
required
Postal code
country
string
required
Country
Customer logo URL
items
array
required
Array of invoice line items
id
string
required
Unique item identifier
description
string
required
Item or service description
quantity
number
required
Quantity of items
rate
number
required
Price per unit
discount
number
Discount percentage (0-100)
taxRate
number
Tax rate percentage (0-100)
currency
string
required
Three-letter ISO currency code (e.g., USD, EUR, GBP)
notes
string
Additional notes or payment terms
taxRate
number
Global tax rate percentage (0-100)

Response

message
string
Success message
invoice
object
The created invoice object with all submitted fields
201 - Invoice created successfully
{
  "message": "Invoice created successfully",
  "invoice": {
    "invoiceNumber": "INV-001",
    "date": "2026-03-03",
    "dueDate": "2026-03-17",
    "status": "draft",
    "customer": {
      "id": "cust_123",
      "name": "Acme Corp",
      "email": "[email protected]",
      "address": "123 Main St",
      "city": "New York",
      "state": "NY",
      "zipCode": "10001",
      "country": "USA"
    },
    "items": [
      {
        "id": "item_1",
        "description": "Web Development Services",
        "quantity": 40,
        "rate": 150,
        "taxRate": 10
      }
    ],
    "currency": "USD",
    "notes": "Payment due within 14 days"
  }
}

Errors

400 - Missing required fields
{
  "error": "Missing required fields"
}
500 - Internal server error
{
  "error": "Failed to create invoice"
}

Get an invoice

curl -X GET https://your-domain.com/api/invoices/inv_123 \
  -H "Content-Type: application/json"

Path parameters

id
string
required
The unique identifier of the invoice to retrieve

Response

message
string
Information about the endpoint status
invoiceId
string
The requested invoice ID
Response example
{
  "message": "This endpoint would fetch a specific invoice from a database",
  "invoiceId": "inv_123"
}

Errors

400 - Invoice ID required
{
  "error": "Invoice ID is required"
}
500 - Internal server error
{
  "error": "Failed to fetch invoice"
}

Update an invoice

curl -X PATCH https://your-domain.com/api/invoices/inv_123 \
  -H "Content-Type: application/json" \
  -d '{
    "status": "sent",
    "notes": "Updated payment terms"
  }'

Path parameters

id
string
required
The unique identifier of the invoice to update

Body parameters

All fields are optional. Only include the fields you want to update.
invoiceNumber
string
Unique invoice number identifier
date
string
Invoice creation date in ISO 8601 format
dueDate
string
Payment due date in ISO 8601 format
status
string
Invoice status. One of: draft, sent, paid, cancelled
customer
object
Customer information object (partial updates supported)
items
array
Array of invoice line items (replaces existing items)
currency
string
Three-letter ISO currency code
notes
string
Additional notes or payment terms
taxRate
number
Global tax rate percentage (0-100)

Response

message
string
Success message
invoiceId
string
The updated invoice ID
updates
object
The fields that were updated
Response example
{
  "message": "Invoice updated successfully",
  "invoiceId": "inv_123",
  "updates": {
    "status": "sent",
    "notes": "Updated payment terms"
  }
}

Errors

400 - Invoice ID required
{
  "error": "Invoice ID is required"
}
500 - Internal server error
{
  "error": "Failed to update invoice"
}

Delete an invoice

curl -X DELETE https://your-domain.com/api/invoices/inv_123 \
  -H "Content-Type: application/json"

Path parameters

id
string
required
The unique identifier of the invoice to delete

Response

message
string
Success message
invoiceId
string
The deleted invoice ID
Response example
{
  "message": "Invoice deleted successfully",
  "invoiceId": "inv_123"
}

Errors

400 - Invoice ID required
{
  "error": "Invoice ID is required"
}
500 - Internal server error
{
  "error": "Failed to delete invoice"
}

Build docs developers (and LLMs) love