# API: Generate Service Invoice

# generateNextInvoice

Generates recurring invoice for service sooner. Returns invoice_id of generated invoice if add_queue parameter is not preset/set to 0. If add_queue is set to 1, new line will be added to enqueued invoice items for this service instead of generating invoice right away.

# Required parameters

Parameter Description
account_id Account ID to generate invoice for

# Optional parameters

Parameter Description
add_queue Set 1 to Add new line to enqueued invoice items else set 0 to Generate new invoice for this service. Defaults to 0.
addon[] Addon IDs related to account to generate invoices for. Optional, if addons are set and nothing in account[] then invoice will consit of only addons
account[] List of account ids to generate invoices for in single call for customer. Optional
move_due Set 1 to move service next due date to next cycle - in most cases this should be set to 1. If this parameter is not set then duplicate invoice may be generated by automation.
unlock Set 1 to Send newly generated invoice invoice to client. If set to 0 invoice will be generated in locked state (admin only)
prorata[enable] Set 1 to Enable prorata calculations during invoice genration
prorata[from] Set date from which to prorate
prorata[to] Set date to which to prorate

# Request

GET /admin/api.php?api_id=API_ID&api_key=API_KEY&call=generateNextInvoice&account_id=ACCOUNT_ID

# PHP Samples

# Response

{
    "success": true,
    "invoice_id": "2301",
    "call": "generateNextInvoice",
    "server_time": 1611580143,
    "info": [
        "Invoice generated",
        "Invoice sent to client"
    ]
}
Last Updated: 9/8/2025, 2:21:59 PM