Back to Home

API Documentation

Integrate document generation into your system programmatically

Base URL

https://docs-generation.vercel.app

1. Generate Receipt

POST /generate-receipt

Generate a professional receipt document in PDF format.

Required Fields

receipt required object
customer required object
created_by required object
products required Array of objects
bs_data required object

Python Code Example

import requests

payload = {
    "receipt": {
        "receipt_number": "RCT-001",
        "created_at": "2025-10-29",
        "amount_paid": 1500.00,
        "discount": 50.00,
        "payment_method": "Cash"
    },
    "customer": {
        "name": "John Doe",
        "phone": "+254712345678",
        "email": "john@example.com",
        "address": "123 Main Street, Nairobi"
    },
    "created_by": {
        "first_name": "Jane",
        "last_name": "Smith"
    },
    "products": [
        {
            "name": "Product A",
            "quantity": 2,
            "unit_price": 500.00
        },
        {
            "name": "Product B",
            "quantity": 1,
            "unit_price": 500.00
        }
    ],
    "bs_data": {
        "name": "My Business Ltd",
        "address": "456 Business Ave",
        "location": "Nairobi, Kenya",
        "phone": "+254700000000",
        "email": "info@mybusiness.com",
        "tax": "P051234567X",
        "logo": "https://example.com/logo.png",
        "primary_brand_color": "#000000",
        "secondary_brand_color": "#ffffff"
    }
}

response = requests.post(f"{base_url}/generate-receipt", json=payload)
# now you get a pdf response manipulate as to your needs
      

2. Generate Invoice

POST /generate-invoice

Generate a professional invoice document in PDF format.

Required Fields

invoice required object
customer required object
created_by required object
products required Array of objects
terms Array of Strings
bs_data required object

Python Code Example

import requests

payload = {
    "invoice": {
        "invoice_number": "string",
        "created_at": "string",
        "due_date": "string",
        "total_cost": 20000,
        "amount_paid": 15000,
        "amount_due": 5000,
        "penalties": 0,
        "status": "Open"
    },
    "customer": {
        "name": "John Doe",
        "phone": "+254712345678",
        "email": "john@example.com",
        "address": "123 Main Street, Nairobi"
    },
    "created_by": {
        "first_name": "Jane",
        "last_name": "Smith"
    },
    "products": [
        {
            "name": "Product A",
            "quantity": 2,
            "unit_price": 5000.00
        },
        {
            "name": "Product B",
            "quantity": 1,
            "unit_price": 10000.00
        }
    ],
    "terms": [
        "Goods once sold can never be returned"
    ],
    "bs_data": {
        "name": "My Business Ltd",
        "address": "456 Business Ave",
        "location": "Nairobi, Kenya",
        "phone": "+254700000000",
        "email": "info@mybusiness.com",
        "tax": "P051234567X",
        "logo": "https://example.com/logo.png",
        "primary_brand_color": "#000000",
        "secondary_brand_color": "#ffffff"
    }
}

response = requests.post(f"{base_url}/generate-invoice", json=payload)
# now you get a pdf response manipulate as to your needs
      

3. Generate Quote

POST /generate-quote

Generate a professional quote document in PDF format.

Required Fields

quote_data required object
customer required object
created_by required object
products required Array of objects
terms Array of Strings
bs_data required object

Python Code Example

import requests

payload = {
    "quote_data": {
        "quote_number": "QTE-001",
        "created_at": "2025-10-29",
        "valid_until": "2025-11-30",
        "discount": 50.00,
        "vat_amount": 102,
        "status": "Draft"
    },
    "customer": {
        "name": "John Doe",
        "phone": "+254712345678",
        "email": "john@example.com",
        "address": "123 Main Street, Nairobi"
    },
    "created_by": {
        "first_name": "Jane",
        "last_name": "Smith"
    },
    "products": [
        {
            "name": "Product A",
            "quantity": 2,
            "unit_price": 500.00
        },
        {
            "name": "Product B",
            "quantity": 1,
            "unit_price": 500.00
        }
    ],
    "bs_data": {
        "name": "My Business Ltd",
        "address": "456 Business Ave",
        "location": "Nairobi, Kenya",
        "phone": "+254700000000",
        "email": "info@mybusiness.com",
        "tax": "P051234567X",
        "logo": "https://example.com/logo.png",
        "primary_brand_color": "#000000",
        "secondary_brand_color": "#ffffff"
    }
}

response = requests.post(f"{base_url}/generate-quote", json=payload)
# now you get a pdf response manipulate as to your needs
      

4. Generate Z-Report

POST /generate-z-report

Generate a professional Z-Report document in PDF format.

Required Fields

report required object
bs_data required object
generated_by required object

Python Code Example

import requests

payload = {
    "report": {
        "report_number": "ZR-001",
        "date_from": "2025-10-01",
        "date_to": "2025-10-29",
        "generated_at": "2025-10-29T14:30:00",
        "sales_summary": {
            "total_receipts": 150,
            "total_items_sold": 45,
            "gross_sales": 20000.00,
            "total_discounts": 1500.00,
            "net_sales": 14650.00,
            "tax_amount": 4500.00,
            "average_transaction": 5600
        },
        "payment_methods": [
            {
                "method": "Cash",
                "amount": 8000.00,
                "transaction_count": 25
            },
            {
                "method": "M-Pesa",
                "amount": 7000.00,
                "transaction_count": 20
            }
        ],
        "cash_drawer": {
            "opening_balance": 5000.00,
            "closing_balance": 13000.00,
            "cash_sales": 13000.00,
            "expected_cash": 12950.00,
            "variance": -50.00
        },
        "top_products": [
            {
                "name": "Product A",
                "quantity": 10,
                "total_amount": 6000,
                "unit_price": 600
            },
            {
                "name": "Product B",
                "quantity": 12,
                "total_amount": 1000,
                "unit_price": 12000
            }
        ]
    },
    "bs_data": {
        "name": "My Business Ltd",
        "address": "456 Business Ave",
        "location": "Nairobi, Kenya",
        "phone": "+254700000000",
        "email": "info@mybusiness.com",
        "tax": "P051234567X",
        "logo": "https://example.com/logo.png",
        "primary_brand_color": "#000000",
        "secondary_brand_color": "#ffffff"
    },
    "generated_by": {
        "first_name": "Jane",
        "last_name": "Smith"
    }
}

response = requests.post(f"{base_url}/generate-z-report", json=payload)
# now you get a pdf response manipulate as to your needs
      
Made with by jaycode