Overview

The Billing System provides a comprehensive RESTful API for managing customers, quotations, invoices, and recurring billing schedules.

Base URL: https://ihsbilling.innovatelhubltd.com/api/v1

Response Format: JSON

Authentication

All API endpoints require authentication using an API key.

API Key Configuration:

Set the API key using the API_KEY environment variable.

Default API Key (change in production): your-api-key-change-this

Method 1: Header Authentication

curl -H "X-API-Key: your-api-key-change-this" https://ihsbilling.innovatelhubltd.com/api/v1/customers

Method 2: Query Parameter

curl https://ihsbilling.innovatelhubltd.com/api/v1/customers?api_key=your-api-key-change-this

Endpoints

Customers

Method Endpoint Description
GET /customers Get all customers
GET /customers/{id} Get a specific customer
POST /customers Create a new customer
PUT /customers/{id} Update a customer
DELETE /customers/{id} Delete a customer
Show Example Request
POST https://ihsbilling.innovatelhubltd.com/api/v1/customers
Content-Type: application/json
X-API-Key: your-api-key-change-this

{
    "name": "John Doe",
    "email": "john.doe@example.com",
    "phone": "+678 123456",
    "address": "Port Vila, Vanuatu"
}

Quotations

Method Endpoint Description
GET /quotations Get all quotations (filters: status, customer_id)
GET /quotations/{id} Get a specific quotation
POST /quotations Create a new quotation
PUT /quotations/{id} Update a quotation
DELETE /quotations/{id} Delete a quotation
POST /quotations/{id}/convert Convert quotation to invoice
Show Example Request
POST https://ihsbilling.innovatelhubltd.com/api/v1/quotations
Content-Type: application/json
X-API-Key: your-api-key-change-this

{
    "customer_id": 1,
    "valid_until": "2026-03-30",
    "notes": "Thank you for your business",
    "items": [
        {
            "description": "Web Development Services",
            "quantity": 10,
            "unit_price": 5000
        },
        {
            "description": "Hosting (1 Year)",
            "quantity": 1,
            "unit_price": 12000
        }
    ]
}

Invoices

Method Endpoint Description
GET /invoices Get all invoices (filters: status, customer_id)
GET /invoices/{id} Get a specific invoice
POST /invoices Create a new invoice
PUT /invoices/{id} Update an invoice
DELETE /invoices/{id} Delete an invoice
POST /invoices/{id}/mark-paid Mark invoice as paid
Show Example Request
POST https://ihsbilling.innovatelhubltd.com/api/v1/invoices
Content-Type: application/json
X-API-Key: your-api-key-change-this

{
    "customer_id": 1,
    "due_date": "2026-03-25",
    "notes": "Payment due within 30 days",
    "items": [
        {
            "description": "Consulting Services",
            "quantity": 5,
            "unit_price": 8000
        }
    ]
}

Recurring Billing

Method Endpoint Description
GET /recurring-billing Get all recurring billings (filters: customer_id, active_only)
GET /recurring-billing/{id} Get a specific recurring billing
POST /recurring-billing Create a new recurring billing
PUT /recurring-billing/{id} Update a recurring billing
DELETE /recurring-billing/{id} Delete a recurring billing
POST /recurring-billing/{id}/toggle Toggle active status
POST /recurring-billing/process Process all due recurring billings
Show Example Request
POST https://ihsbilling.innovatelhubltd.com/api/v1/recurring-billing
Content-Type: application/json
X-API-Key: your-api-key-change-this

{
    "customer_id": 1,
    "frequency": "monthly",
    "amount": 15000,
    "description": "Monthly Subscription Fee",
    "start_date": "2026-03-01"
}

Statistics

Method Endpoint Description
GET /stats Get system statistics

Response Format

All API responses follow a consistent format:

Success Response:

{
    "success": true,
    "data": { ... },
    "message": "Optional success message"
}

Error Response:

{
    "success": false,
    "error": "Error message description"
}

Testing the API

You can test the API using tools like:

Quick Test:

Visit /api/v1/?api_key=your-api-key-change-this to see the API documentation in JSON format.

Back to Dashboard