List all templates
curl -X GET https://your-domain.com/api/templates \
-H "Content-Type: application/json"
Response
Information about the endpoint status
Additional implementation notes
{
"message": "This endpoint would fetch invoice templates from a database",
"note": "Currently using localStorage on the client side"
}
Errors
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
Template name for easy identification
Optional description of the template’s purpose
Partial customer information object. All fields are optional and can be overridden when creating an invoice from the template.
Array of template invoice line items with partial dataItem or service description
Default quantity of items
Default discount percentage (0-100)
Default tax rate percentage (0-100)
Three-letter ISO currency code (e.g., USD, EUR, GBP)
Default notes or payment terms
Default global tax rate percentage (0-100)
Response
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"
}