{
    "openapi": "3.0.3",
    "info": {
        "title": "Astrosia Accounts API",
        "version": "1.0.0",
        "description": "REST API for CRM, websites, and other systems to read and write Astrosia Accounts data.\n\n**Auth:** create a token in Settings \u2192 API, then send:\n\n```\nAuthorization: Bearer acc_live_\u2026\n```\n\n**Base URL:** `https://accounts.astrosia.tech/api/v1`\n\nAmounts are in the company currency (INR by default). Rate limit: 60 requests/minute."
    },
    "servers": [
        {
            "url": "https://accounts.astrosia.tech/api/v1",
            "description": "Production"
        },
        {
            "url": "{{baseUrl}}",
            "description": "Postman variable"
        }
    ],
    "tags": [
        {
            "name": "Auth"
        },
        {
            "name": "Catalog"
        },
        {
            "name": "Parties"
        },
        {
            "name": "Items"
        },
        {
            "name": "Invoices"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "acc_live_*",
                "description": "Create a token in Settings \u2192 API. Send as `Authorization: Bearer acc_live_\u2026`."
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "properties": {
                    "ok": {
                        "type": "boolean",
                        "example": false
                    },
                    "error": {
                        "type": "string"
                    },
                    "error_code": {
                        "type": "string",
                        "example": "missing_token"
                    },
                    "errors": {
                        "type": "object"
                    }
                }
            },
            "Party": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "party_type": {
                        "type": "string",
                        "enum": [
                            "customer",
                            "supplier"
                        ]
                    },
                    "name": {
                        "type": "string"
                    },
                    "first_name": {
                        "type": "string"
                    },
                    "last_name": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string",
                        "nullable": true
                    },
                    "mobile": {
                        "type": "string",
                        "nullable": true
                    },
                    "whatsapp": {
                        "type": "string",
                        "nullable": true
                    },
                    "gstin": {
                        "type": "string",
                        "nullable": true
                    },
                    "billing_address": {
                        "type": "string",
                        "nullable": true
                    },
                    "currency": {
                        "type": "string",
                        "example": "INR"
                    }
                }
            },
            "Item": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "name": {
                        "type": "string"
                    },
                    "item_code": {
                        "type": "string"
                    },
                    "sku": {
                        "type": "string",
                        "nullable": true
                    },
                    "hsn": {
                        "type": "string",
                        "nullable": true
                    },
                    "is_service": {
                        "type": "boolean"
                    },
                    "sale_price": {
                        "type": "number"
                    },
                    "tax_id": {
                        "type": "integer",
                        "nullable": true
                    },
                    "tax_rate": {
                        "type": "number",
                        "nullable": true
                    },
                    "unit_id": {
                        "type": "integer",
                        "nullable": true
                    },
                    "unit": {
                        "type": "string",
                        "nullable": true
                    }
                }
            },
            "Invoice": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "sale_code": {
                        "type": "string",
                        "example": "SI1"
                    },
                    "sale_date": {
                        "type": "string",
                        "format": "date"
                    },
                    "party_id": {
                        "type": "integer"
                    },
                    "party_name": {
                        "type": "string"
                    },
                    "currency": {
                        "type": "string",
                        "example": "INR"
                    },
                    "currency_symbol": {
                        "type": "string",
                        "example": "\u20b9"
                    },
                    "grand_total": {
                        "type": "number"
                    },
                    "paid_amount": {
                        "type": "number"
                    },
                    "balance": {
                        "type": "number"
                    },
                    "formatted_total": {
                        "type": "string",
                        "example": "\u20b91,180.00 INR"
                    },
                    "lines": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "payments": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "pdf_url": {
                        "type": "string",
                        "format": "uri",
                        "description": "Public clickable PDF URL"
                    },
                    "download_url": {
                        "type": "string",
                        "format": "uri"
                    }
                }
            }
        }
    },
    "paths": {
        "/ping": {
            "get": {
                "tags": [
                    "Auth"
                ],
                "summary": "Health check",
                "operationId": "ping",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "service": {
                                            "type": "string"
                                        },
                                        "version": {
                                            "type": "string"
                                        },
                                        "company_id": {
                                            "type": "integer"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/company": {
            "get": {
                "tags": [
                    "Catalog"
                ],
                "summary": "Company profile",
                "operationId": "getCompany",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/currencies": {
            "get": {
                "tags": [
                    "Catalog"
                ],
                "summary": "Currencies (INR is company default)",
                "operationId": "listCurrencies",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/taxes": {
            "get": {
                "tags": [
                    "Catalog"
                ],
                "summary": "Tax rates",
                "operationId": "listTaxes",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/units": {
            "get": {
                "tags": [
                    "Catalog"
                ],
                "summary": "Units of measure",
                "operationId": "listUnits",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/warehouses": {
            "get": {
                "tags": [
                    "Catalog"
                ],
                "summary": "Warehouses",
                "operationId": "listWarehouses",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/payment-types": {
            "get": {
                "tags": [
                    "Catalog"
                ],
                "summary": "Payment modes",
                "operationId": "listPaymentTypes",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/item-categories": {
            "get": {
                "tags": [
                    "Catalog"
                ],
                "summary": "Item categories",
                "operationId": "listItemCategories",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/parties": {
            "get": {
                "tags": [
                    "Parties"
                ],
                "summary": "List customers / suppliers",
                "operationId": "listParties",
                "parameters": [
                    {
                        "name": "type",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "customer",
                                "supplier"
                            ]
                        }
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 25
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "party_type": {
                                                        "type": "string",
                                                        "enum": [
                                                            "customer",
                                                            "supplier"
                                                        ]
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "first_name": {
                                                        "type": "string"
                                                    },
                                                    "last_name": {
                                                        "type": "string"
                                                    },
                                                    "email": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "mobile": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "whatsapp": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "gstin": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "billing_address": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "currency": {
                                                        "type": "string",
                                                        "example": "INR"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "current_page": {
                                                    "type": "integer"
                                                },
                                                "last_page": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "Parties"
                ],
                "summary": "Create party",
                "operationId": "createParty",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "first_name"
                                ],
                                "properties": {
                                    "first_name": {
                                        "type": "string"
                                    },
                                    "last_name": {
                                        "type": "string"
                                    },
                                    "party_type": {
                                        "type": "string",
                                        "enum": [
                                            "customer",
                                            "supplier"
                                        ],
                                        "default": "customer"
                                    },
                                    "email": {
                                        "type": "string"
                                    },
                                    "mobile": {
                                        "type": "string"
                                    },
                                    "whatsapp": {
                                        "type": "string"
                                    },
                                    "tax_number": {
                                        "type": "string",
                                        "description": "GSTIN"
                                    },
                                    "billing_address": {
                                        "type": "string"
                                    },
                                    "shipping_address": {
                                        "type": "string"
                                    },
                                    "state_id": {
                                        "type": "integer"
                                    },
                                    "country_code": {
                                        "type": "string",
                                        "example": "IN"
                                    },
                                    "currency_id": {
                                        "type": "integer"
                                    }
                                }
                            },
                            "example": {
                                "first_name": "Asha",
                                "last_name": "Sen",
                                "party_type": "customer",
                                "mobile": "9876543210",
                                "tax_number": "19AAAAA0000A1Z5"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "party_type": {
                                                    "type": "string",
                                                    "enum": [
                                                        "customer",
                                                        "supplier"
                                                    ]
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "first_name": {
                                                    "type": "string"
                                                },
                                                "last_name": {
                                                    "type": "string"
                                                },
                                                "email": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "mobile": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "whatsapp": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "gstin": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "billing_address": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "currency": {
                                                    "type": "string",
                                                    "example": "INR"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/parties/{id}": {
            "get": {
                "tags": [
                    "Parties"
                ],
                "summary": "Get party",
                "operationId": "getParty",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "party_type": {
                                                    "type": "string",
                                                    "enum": [
                                                        "customer",
                                                        "supplier"
                                                    ]
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "first_name": {
                                                    "type": "string"
                                                },
                                                "last_name": {
                                                    "type": "string"
                                                },
                                                "email": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "mobile": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "whatsapp": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "gstin": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "billing_address": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "currency": {
                                                    "type": "string",
                                                    "example": "INR"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/items": {
            "get": {
                "tags": [
                    "Items"
                ],
                "summary": "List items",
                "operationId": "listItems",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 25
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "item_code": {
                                                        "type": "string"
                                                    },
                                                    "sku": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "hsn": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "is_service": {
                                                        "type": "boolean"
                                                    },
                                                    "sale_price": {
                                                        "type": "number"
                                                    },
                                                    "tax_id": {
                                                        "type": "integer",
                                                        "nullable": true
                                                    },
                                                    "tax_rate": {
                                                        "type": "number",
                                                        "nullable": true
                                                    },
                                                    "unit_id": {
                                                        "type": "integer",
                                                        "nullable": true
                                                    },
                                                    "unit": {
                                                        "type": "string",
                                                        "nullable": true
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "current_page": {
                                                    "type": "integer"
                                                },
                                                "last_page": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "Items"
                ],
                "summary": "Create item",
                "operationId": "createItem",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "name"
                                ],
                                "properties": {
                                    "name": {
                                        "type": "string"
                                    },
                                    "item_code": {
                                        "type": "string"
                                    },
                                    "hsn": {
                                        "type": "string"
                                    },
                                    "sku": {
                                        "type": "string"
                                    },
                                    "description": {
                                        "type": "string"
                                    },
                                    "is_service": {
                                        "type": "boolean"
                                    },
                                    "item_category_id": {
                                        "type": "integer"
                                    },
                                    "unit_id": {
                                        "type": "integer"
                                    },
                                    "sale_price": {
                                        "type": "number"
                                    },
                                    "purchase_price": {
                                        "type": "number"
                                    },
                                    "tax_id": {
                                        "type": "integer"
                                    }
                                }
                            },
                            "example": {
                                "name": "GST Consultation",
                                "is_service": true,
                                "hsn": "9983",
                                "sale_price": 10000
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "item_code": {
                                                    "type": "string"
                                                },
                                                "sku": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "hsn": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "is_service": {
                                                    "type": "boolean"
                                                },
                                                "sale_price": {
                                                    "type": "number"
                                                },
                                                "tax_id": {
                                                    "type": "integer",
                                                    "nullable": true
                                                },
                                                "tax_rate": {
                                                    "type": "number",
                                                    "nullable": true
                                                },
                                                "unit_id": {
                                                    "type": "integer",
                                                    "nullable": true
                                                },
                                                "unit": {
                                                    "type": "string",
                                                    "nullable": true
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/items/{id}": {
            "get": {
                "tags": [
                    "Items"
                ],
                "summary": "Get item",
                "operationId": "getItem",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "item_code": {
                                                    "type": "string"
                                                },
                                                "sku": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "hsn": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "is_service": {
                                                    "type": "boolean"
                                                },
                                                "sale_price": {
                                                    "type": "number"
                                                },
                                                "tax_id": {
                                                    "type": "integer",
                                                    "nullable": true
                                                },
                                                "tax_rate": {
                                                    "type": "number",
                                                    "nullable": true
                                                },
                                                "unit_id": {
                                                    "type": "integer",
                                                    "nullable": true
                                                },
                                                "unit": {
                                                    "type": "string",
                                                    "nullable": true
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/invoices": {
            "get": {
                "tags": [
                    "Invoices"
                ],
                "summary": "List invoices",
                "operationId": "listInvoices",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 25
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer"
                                                    },
                                                    "sale_code": {
                                                        "type": "string",
                                                        "example": "SI1"
                                                    },
                                                    "sale_date": {
                                                        "type": "string",
                                                        "format": "date"
                                                    },
                                                    "party_id": {
                                                        "type": "integer"
                                                    },
                                                    "party_name": {
                                                        "type": "string"
                                                    },
                                                    "currency": {
                                                        "type": "string",
                                                        "example": "INR"
                                                    },
                                                    "currency_symbol": {
                                                        "type": "string",
                                                        "example": "\u20b9"
                                                    },
                                                    "grand_total": {
                                                        "type": "number"
                                                    },
                                                    "paid_amount": {
                                                        "type": "number"
                                                    },
                                                    "balance": {
                                                        "type": "number"
                                                    },
                                                    "formatted_total": {
                                                        "type": "string",
                                                        "example": "\u20b91,180.00 INR"
                                                    },
                                                    "lines": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object"
                                                        }
                                                    },
                                                    "payments": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object"
                                                        }
                                                    },
                                                    "pdf_url": {
                                                        "type": "string",
                                                        "format": "uri",
                                                        "description": "Public clickable PDF URL"
                                                    },
                                                    "download_url": {
                                                        "type": "string",
                                                        "format": "uri"
                                                    }
                                                }
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "current_page": {
                                                    "type": "integer"
                                                },
                                                "last_page": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "tags": [
                    "Invoices"
                ],
                "summary": "Create invoice",
                "operationId": "createInvoice",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "party_id",
                                    "lines"
                                ],
                                "properties": {
                                    "party_id": {
                                        "type": "integer"
                                    },
                                    "sale_date": {
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "reference_no": {
                                        "type": "string"
                                    },
                                    "note": {
                                        "type": "string"
                                    },
                                    "warehouse_id": {
                                        "type": "integer"
                                    },
                                    "currency_id": {
                                        "type": "integer"
                                    },
                                    "exchange_rate": {
                                        "type": "number"
                                    },
                                    "gst_supply_type": {
                                        "type": "string",
                                        "enum": [
                                            "auto",
                                            "domestic",
                                            "export_lut",
                                            "export_igst"
                                        ]
                                    },
                                    "gst_lut_number": {
                                        "type": "string"
                                    },
                                    "round_off": {
                                        "type": "number"
                                    },
                                    "lines": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "required": [
                                                "item_id",
                                                "quantity"
                                            ],
                                            "properties": {
                                                "item_id": {
                                                    "type": "integer"
                                                },
                                                "quantity": {
                                                    "type": "number"
                                                },
                                                "unit_price": {
                                                    "type": "number"
                                                },
                                                "tax_id": {
                                                    "type": "integer"
                                                },
                                                "description": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    },
                                    "payment": {
                                        "type": "object",
                                        "properties": {
                                            "amount": {
                                                "type": "number"
                                            },
                                            "payment_type_id": {
                                                "type": "integer"
                                            },
                                            "reference_no": {
                                                "type": "string"
                                            },
                                            "note": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                }
                            },
                            "example": {
                                "party_id": 1,
                                "sale_date": "2026-08-23",
                                "gst_supply_type": "domestic",
                                "lines": [
                                    {
                                        "item_id": 1,
                                        "quantity": 2,
                                        "unit_price": 1000
                                    }
                                ],
                                "payment": {
                                    "amount": 2360,
                                    "note": "UPI"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "sale_code": {
                                                    "type": "string",
                                                    "example": "SI1"
                                                },
                                                "sale_date": {
                                                    "type": "string",
                                                    "format": "date"
                                                },
                                                "party_id": {
                                                    "type": "integer"
                                                },
                                                "party_name": {
                                                    "type": "string"
                                                },
                                                "currency": {
                                                    "type": "string",
                                                    "example": "INR"
                                                },
                                                "currency_symbol": {
                                                    "type": "string",
                                                    "example": "\u20b9"
                                                },
                                                "grand_total": {
                                                    "type": "number"
                                                },
                                                "paid_amount": {
                                                    "type": "number"
                                                },
                                                "balance": {
                                                    "type": "number"
                                                },
                                                "formatted_total": {
                                                    "type": "string",
                                                    "example": "\u20b91,180.00 INR"
                                                },
                                                "lines": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "payments": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "pdf_url": {
                                                    "type": "string",
                                                    "format": "uri",
                                                    "description": "Public clickable PDF URL"
                                                },
                                                "download_url": {
                                                    "type": "string",
                                                    "format": "uri"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/invoices/{id}": {
            "get": {
                "tags": [
                    "Invoices"
                ],
                "summary": "Get invoice",
                "operationId": "getInvoice",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "sale_code": {
                                                    "type": "string",
                                                    "example": "SI1"
                                                },
                                                "sale_date": {
                                                    "type": "string",
                                                    "format": "date"
                                                },
                                                "party_id": {
                                                    "type": "integer"
                                                },
                                                "party_name": {
                                                    "type": "string"
                                                },
                                                "currency": {
                                                    "type": "string",
                                                    "example": "INR"
                                                },
                                                "currency_symbol": {
                                                    "type": "string",
                                                    "example": "\u20b9"
                                                },
                                                "grand_total": {
                                                    "type": "number"
                                                },
                                                "paid_amount": {
                                                    "type": "number"
                                                },
                                                "balance": {
                                                    "type": "number"
                                                },
                                                "formatted_total": {
                                                    "type": "string",
                                                    "example": "\u20b91,180.00 INR"
                                                },
                                                "lines": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "payments": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "pdf_url": {
                                                    "type": "string",
                                                    "format": "uri",
                                                    "description": "Public clickable PDF URL"
                                                },
                                                "download_url": {
                                                    "type": "string",
                                                    "format": "uri"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/invoices/{id}/payments": {
            "post": {
                "tags": [
                    "Invoices"
                ],
                "summary": "Record payment",
                "operationId": "payInvoice",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "amount"
                                ],
                                "properties": {
                                    "amount": {
                                        "type": "number"
                                    },
                                    "payment_type_id": {
                                        "type": "integer"
                                    },
                                    "reference_no": {
                                        "type": "string"
                                    },
                                    "note": {
                                        "type": "string"
                                    },
                                    "transaction_date": {
                                        "type": "string",
                                        "format": "date"
                                    }
                                }
                            },
                            "example": {
                                "amount": 2360,
                                "note": "UPI"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "sale_code": {
                                                    "type": "string",
                                                    "example": "SI1"
                                                },
                                                "sale_date": {
                                                    "type": "string",
                                                    "format": "date"
                                                },
                                                "party_id": {
                                                    "type": "integer"
                                                },
                                                "party_name": {
                                                    "type": "string"
                                                },
                                                "currency": {
                                                    "type": "string",
                                                    "example": "INR"
                                                },
                                                "currency_symbol": {
                                                    "type": "string",
                                                    "example": "\u20b9"
                                                },
                                                "grand_total": {
                                                    "type": "number"
                                                },
                                                "paid_amount": {
                                                    "type": "number"
                                                },
                                                "balance": {
                                                    "type": "number"
                                                },
                                                "formatted_total": {
                                                    "type": "string",
                                                    "example": "\u20b91,180.00 INR"
                                                },
                                                "lines": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "payments": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    }
                                                },
                                                "pdf_url": {
                                                    "type": "string",
                                                    "format": "uri",
                                                    "description": "Public clickable PDF URL"
                                                },
                                                "download_url": {
                                                    "type": "string",
                                                    "format": "uri"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "error_code": {
                                            "type": "string",
                                            "example": "missing_token"
                                        },
                                        "errors": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/hsn": {
            "get": {
                "tags": [
                    "Catalog"
                ],
                "summary": "Search HSN / SAC codes",
                "operationId": "searchHsn",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Code or description (e.g. consulting, 9983)"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "code": {
                                                        "type": "string",
                                                        "example": "998313"
                                                    },
                                                    "label": {
                                                        "type": "string"
                                                    },
                                                    "description": {
                                                        "type": "string"
                                                    },
                                                    "type": {
                                                        "type": "string",
                                                        "example": "SAC"
                                                    },
                                                    "gst": {
                                                        "type": "string",
                                                        "example": "18%"
                                                    },
                                                    "source": {
                                                        "type": "string",
                                                        "enum": [
                                                            "catalog",
                                                            "item"
                                                        ]
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid token"
                    }
                }
            }
        },
        "/invoices/{id}/pdf": {
            "get": {
                "tags": [
                    "Invoices"
                ],
                "summary": "Download invoice PDF (Bearer)",
                "operationId": "downloadInvoicePdf",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "PDF file",
                        "content": {
                            "application/pdf": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing or invalid token"
                    },
                    "404": {
                        "description": "Invoice not found"
                    }
                }
            }
        }
    }
}
