Finance API

Base URL

All finance endpoints are prefixed with:

/dev/finance

Note: All endpoints require authentication via Bearer token in the Authorization header.

Invoice Management

Endpoints for managing invoices and billing

List Invoices

Retrieve a list of all invoices

GET /dev/finance/invoices
Authorization: Bearer YOUR_API_KEY

Create Invoice

Create a new invoice

Optional Fields:

  • invoice_number (string)
  • client_name (string)
  • client_email (string, valid email)
  • client_address (string)
  • due_date (date)
  • status (enum: 'draft', 'sent', 'paid', 'overdue', 'cancelled')
  • subtotal (number, min 0)
  • tax (number, min 0)
  • total (number, min 0)
  • notes (string)
  • items (array of objects)

Each item in items array requires:

  • description (string, required)
  • quantity (number, integer, min 1, required)
  • unit_price (number, positive, required)
POST /dev/finance/invoices
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "invoice_number": "INV-2024-001",
  "client_name": "Acme Corp",
  "client_email": "billing@acme.com",
  "client_address": "123 Main St",
  "due_date": "2024-04-01",
  "status": "draft",
  "items": [
    {
      "description": "Service A",
      "quantity": 1,
      "unit_price": 100.00
    },
    {
      "description": "Service B",
      "quantity": 2,
      "unit_price": 50.00
    }
  ],
  "subtotal": 200.00,
  "tax": 20.00,
  "total": 220.00,
  "notes": "Payment due within 30 days"
}

Get Invoice

Retrieve details of a specific invoice

GET /dev/finance/invoices/:invoiceId
Authorization: Bearer YOUR_API_KEY

Send Invoice

Send an invoice to a customer

POST /dev/finance/invoices/:invoiceId/send
Authorization: Bearer YOUR_API_KEY

Delete Invoice

Delete an existing invoice

DELETE /dev/finance/invoices/:invoiceId
Authorization: Bearer YOUR_API_KEY

Budget Management

Endpoints for managing budgets and financial planning

List Budgets

Retrieve all budgets

GET /dev/finance/budgets
Authorization: Bearer YOUR_API_KEY

Create Budget

Create a new budget

Optional Fields:

  • name (string)
  • start_date (date)
  • end_date (date, must be greater than start_date)
  • total_amount (number, min 0, max 99999999.99)
  • spent_amount (number, min 0, max 99999999.99)
  • status (enum: 'active', 'completed', 'cancelled')
POST /dev/finance/budgets
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "name": "Q1 2024",
  "start_date": "2024-01-01",
  "end_date": "2024-03-31",
  "total_amount": 10000.00,
  "spent_amount": 0.00,
  "status": "active"
}

Update Budget

Update an existing budget

PUT /dev/finance/budgets/:budgetId
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "name": "Updated Q1 2024",
  "total_amount": 12000.00,
  "spent_amount": 5000.00
}

Delete Budget

Delete an existing budget

DELETE /dev/finance/budgets/:budgetId
Authorization: Bearer YOUR_API_KEY

Expense Management

Endpoints for tracking and managing expenses

List Expenses

Retrieve all expenses

GET /dev/finance/expenses
Authorization: Bearer YOUR_API_KEY

Create Expense

Record a new expense with optional receipt upload

Optional Fields:

  • description (string)
  • amount (number, min 0)
  • date (date)
  • category (string)
  • receipt_url (string) - URL of uploaded receipt
  • budget_id (UUID)

Note: Receipt can be uploaded as a file using multipart/form-data

POST /dev/finance/expenses
Authorization: Bearer YOUR_API_KEY
Content-Type: multipart/form-data

amount: 100.00
description: Office Supplies
category: supplies
date: 2024-01-15
budget_id: uuid-here
receipt: (file upload)

Update Expense

Update an existing expense

PUT /dev/finance/expenses/:expenseId
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "amount": 150.00,
  "description": "Updated Office Supplies",
  "category": "supplies",
  "date": "2024-01-16"
}

Delete Expense

Delete an existing expense

DELETE /dev/finance/expenses/:expenseId
Authorization: Bearer YOUR_API_KEY

Error Responses

400 Bad Request
{
  "message": "Invalid request parameters"
}

401 Unauthorized
{
  "message": "Invalid or missing API key"
}

404 Not Found
{
  "message": "Resource not found"
}

422 Unprocessable Entity
{
  "message": "Insufficient funds"
}

Contents