Skip to main content
Glama

create_invoice

Generate professional invoices in FreshBooks by specifying customer details and line items with quantities and costs.

Instructions

Create a new invoice. Lines format: [{"name": "Service", "description": "...", "qty": 1, "unit_cost": {"amount": "100.00", "code": "USD"}}]

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customer_idYes
linesYes
due_offset_daysNo
currency_codeNoUSD
notesNo
po_numberNo

Implementation Reference

  • The 'create_invoice' handler function, responsible for creating a new invoice in FreshBooks using the accounting client.
    async def create_invoice(
        customer_id: int,
        lines: list[dict],
        due_offset_days: int = 30,
        currency_code: str = "USD",
        notes: str = "",
        po_number: str = "",
    ) -> str:
        """Create a new invoice. Lines format: [{"name": "Service", "description": "...", "qty": 1, "unit_cost": {"amount": "100.00", "code": "USD"}}]"""
        data = {
            "customerid": customer_id,
            "create_date": _today(),
            "due_offset_days": due_offset_days,
            "currency_code": currency_code,
            "lines": lines,
        }
        if notes:
            data["notes"] = notes
        if po_number:
            data["po_number"] = po_number
        result = await client.accounting_create("invoices/invoices", "invoice", data)
        inv = result.get("invoice", result)
        return f"Invoice #{inv.get('invoice_number', '?')} created (ID: {inv.get('id')}). Amount: ${inv.get('amount', {}).get('amount', '0')}"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AlexlaGuardia/MCP-Freshbooks'

If you have feedback or need assistance with the MCP directory API, please join our Discord server