{
    "$comment": "Shared action manifest for the n8n / Make / Zapier Billabex integrations. Source of truth: the public OpenAPI spec at {baseURL}/api/docs/public-json. Regenerate by hand if the public API's shape changes.",
    "oauth": {
        "authorizationUrl": "{baseURL}/api/oauth/authorize",
        "tokenUrl": "{baseURL}/api/oauth/token",
        "pkce": "S256",
        "scopes": [
            "openid",
            "profile",
            "email",
            "invoices:read",
            "invoices:all",
            "credit-notes:read",
            "credit-notes:all",
            "accounts:read",
            "accounts:all",
            "communications:read",
            "dunning:manage",
            "tasks:read",
            "tasks:all",
            "organizations:read",
            "organizations:all"
        ]
    },
    "actions": [
        {
            "key": "list_accounts",
            "label": "List Accounts",
            "method": "GET",
            "path": "/api/public/v1/accounts",
            "scope": "accounts:read",
            "query": [
                {
                    "name": "organizationId",
                    "required": true,
                    "type": "string"
                },
                {
                    "name": "first",
                    "required": false,
                    "type": "number"
                },
                {
                    "name": "after",
                    "required": false,
                    "type": "string"
                }
            ]
        },
        {
            "key": "create_account",
            "label": "Create Account",
            "method": "POST",
            "path": "/api/public/v1/accounts",
            "scope": "accounts:all",
            "bodyType": "json",
            "body": [
                {
                    "name": "organizationId",
                    "required": true,
                    "type": "string"
                },
                {
                    "name": "fullName",
                    "required": true,
                    "type": "string"
                },
                {
                    "name": "currencyCode",
                    "required": true,
                    "type": "string",
                    "helpText": "The 3-letter ISO 4217 currency code for this account's transactions, e.g. EUR, USD, GBP."
                },
                {
                    "name": "billingAddress",
                    "required": true,
                    "type": "object"
                },
                {
                    "name": "source",
                    "required": false,
                    "type": "object"
                }
            ]
        },
        {
            "key": "add_contact",
            "label": "Add Contact to Account",
            "method": "POST",
            "path": "/api/public/v1/accounts/{accountId}/contacts",
            "scope": "accounts:all",
            "bodyType": "json",
            "pathParams": [
                {
                    "name": "accountId",
                    "required": true,
                    "type": "string"
                }
            ],
            "body": [
                {
                    "name": "fullName",
                    "required": true,
                    "type": "string"
                },
                {
                    "name": "email",
                    "required": false,
                    "type": "string"
                },
                {
                    "name": "language",
                    "required": true,
                    "type": "string",
                    "helpText": "ISO 639-1 language code. The API accepts any of the ~180 standard codes; this dropdown covers the ~20 most common business languages."
                }
            ]
        },
        {
            "key": "list_invoices",
            "label": "List Invoices",
            "method": "GET",
            "path": "/api/public/v1/invoices",
            "scope": "invoices:read",
            "query": [
                {
                    "name": "organizationId",
                    "required": true,
                    "type": "string"
                },
                {
                    "name": "first",
                    "required": false,
                    "type": "number"
                },
                {
                    "name": "after",
                    "required": false,
                    "type": "string"
                }
            ]
        },
        {
            "key": "create_invoice",
            "label": "Create Invoice",
            "method": "POST",
            "path": "/api/public/v1/invoices",
            "scope": "invoices:all",
            "bodyType": "multipart",
            "body": [
                {
                    "name": "accountId",
                    "required": true,
                    "type": "string"
                },
                {
                    "name": "number",
                    "required": true,
                    "type": "string"
                },
                {
                    "name": "issuedDate",
                    "required": true,
                    "type": "date"
                },
                {
                    "name": "dueDate",
                    "required": true,
                    "type": "date"
                },
                {
                    "name": "totalAmount",
                    "required": true,
                    "type": "number"
                },
                {
                    "name": "taxAmount",
                    "required": true,
                    "type": "number"
                },
                {
                    "name": "paidAmount",
                    "required": true,
                    "type": "number"
                },
                {
                    "name": "poNumber",
                    "required": false,
                    "type": "string"
                },
                {
                    "name": "billingAddress",
                    "required": true,
                    "type": "object"
                },
                {
                    "name": "file",
                    "required": true,
                    "type": "file"
                }
            ]
        },
        {
            "key": "update_invoice_paid_amount",
            "label": "Update Invoice Paid Amount",
            "method": "PUT",
            "path": "/api/public/v1/invoices/{invoiceId}/paid-amount",
            "scope": "invoices:all",
            "bodyType": "json",
            "pathParams": [
                {
                    "name": "invoiceId",
                    "required": true,
                    "type": "string"
                }
            ],
            "body": [
                {
                    "name": "paidAmount",
                    "required": true,
                    "type": "number",
                    "helpText": "The invoice's new total paid amount (not a delta). Set it equal to the invoice's totalAmount to mark it fully paid, or 0 to mark it unpaid."
                }
            ]
        },
        {
            "key": "list_credit_notes",
            "label": "List Credit Notes",
            "method": "GET",
            "path": "/api/public/v1/credit-notes",
            "scope": "credit-notes:read",
            "query": [
                {
                    "name": "organizationId",
                    "required": true,
                    "type": "string"
                },
                {
                    "name": "first",
                    "required": false,
                    "type": "number"
                },
                {
                    "name": "after",
                    "required": false,
                    "type": "string"
                }
            ]
        },
        {
            "key": "create_credit_note",
            "label": "Create Credit Note",
            "method": "POST",
            "path": "/api/public/v1/credit-notes",
            "scope": "credit-notes:all",
            "bodyType": "multipart",
            "body": [
                {
                    "name": "accountId",
                    "required": true,
                    "type": "string"
                },
                {
                    "name": "number",
                    "required": true,
                    "type": "string"
                },
                {
                    "name": "issuedDate",
                    "required": true,
                    "type": "date"
                },
                {
                    "name": "totalAmount",
                    "required": true,
                    "type": "number"
                },
                {
                    "name": "taxAmount",
                    "required": true,
                    "type": "number"
                },
                {
                    "name": "billingAddress",
                    "required": true,
                    "type": "object"
                },
                {
                    "name": "file",
                    "required": true,
                    "type": "file"
                }
            ]
        },
        {
            "key": "update_credit_note_refunded_amount",
            "label": "Update Credit Note Refunded Amount",
            "method": "PUT",
            "path": "/api/public/v1/credit-notes/{creditNoteId}/refunded-amount",
            "scope": "credit-notes:all",
            "bodyType": "json",
            "pathParams": [
                {
                    "name": "creditNoteId",
                    "required": true,
                    "type": "string"
                }
            ],
            "body": [
                {
                    "name": "refundedAmount",
                    "required": true,
                    "type": "number",
                    "helpText": "The credit note's new total refunded amount (not a delta)."
                }
            ]
        },
        {
            "key": "pause_dunning",
            "label": "Pause Dunning on Account",
            "method": "POST",
            "path": "/api/public/v1/accounts/{accountId}/dunning/pause",
            "scope": "dunning:manage",
            "pathParams": [
                {
                    "name": "accountId",
                    "required": true,
                    "type": "string"
                }
            ]
        },
        {
            "key": "resume_dunning",
            "label": "Resume Dunning on Account",
            "method": "POST",
            "path": "/api/public/v1/accounts/{accountId}/dunning/resume",
            "scope": "dunning:manage",
            "pathParams": [
                {
                    "name": "accountId",
                    "required": true,
                    "type": "string"
                }
            ]
        }
    ]
}
