Skip to main content

List all templates

curl -X GET https://your-domain.com/api/templates \
  -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 invoice templates 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 templates"
}

Create a template

curl -X POST https://your-domain.com/api/templates \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Monthly Consulting Template",
    "description": "Standard monthly consulting invoice",
    "customer": {
      "name": "Acme Corp",
      "email": "[email protected]",
      "address": "123 Main St",
      "city": "New York",
      "state": "NY",
      "zipCode": "10001",
      "country": "USA"
    },
    "items": [
      {
        "description": "Consulting Services",
        "quantity": 40,
        "rate": 150,
        "taxRate": 10
      }
    ],
    "currency": "USD",
    "taxRate": 10,
    "notes": "Payment due within 14 days"
  }'

Body parameters

name
string
required
Template name for easy identification
description
string
Optional description of the template’s purpose
customer
object
Partial customer information object. All fields are optional and can be overridden when creating an invoice from the template.
id
string
Customer identifier
name
string
Customer name
email
string
Customer email address
address
string
Street address
city
string
City
state
string
State or province
zipCode
string
Postal code
country
string
Country
Customer logo URL
items
array
Array of template invoice line items with partial data
id
string
Item identifier
description
string
Item or service description
quantity
number
Default quantity of items
rate
number
Default price per unit
discount
number
Default discount percentage (0-100)
taxRate
number
Default tax rate percentage (0-100)
currency
string
Three-letter ISO currency code (e.g., USD, EUR, GBP)
notes
string
Default notes or payment terms
taxRate
number
Default global tax rate percentage (0-100)

Response

message
string
Success message
template
object
The created template object with all submitted fields
201 - Template created successfully
{
  "message": "Template created successfully",
  "template": {
    "name": "Monthly Consulting Template",
    "description": "Standard monthly consulting invoice",
    "customer": {
      "name": "Acme Corp",
      "email": "[email protected]",
      "address": "123 Main St",
      "city": "New York",
      "state": "NY",
      "zipCode": "10001",
      "country": "USA"
    },
    "items": [
      {
        "description": "Consulting Services",
        "quantity": 40,
        "rate": 150,
        "taxRate": 10
      }
    ],
    "currency": "USD",
    "taxRate": 10,
    "notes": "Payment due within 14 days"
  }
}

Errors

400 - Template name required
{
  "error": "Template name is required"
}
500 - Internal server error
{
  "error": "Failed to create template"
}

Build docs developers (and LLMs) love