Alya Books

    Help centre

    Guides for Alya Books and UAE e-invoicing

    Bulk actions

    Create, submit, email, mark as sent, delete, void, post, reverse, write off and decide many records in one API call, with one result per record.

    Bulk endpoints let an integration or an AI assistant act on many records in one call. Every call returns one result per record, so a refusal on one record never stops the others.

    Steps

    1. Collect the ids of the records to act on, up to 500 per call (100 for batch create).
    2. Send the request with an API key whose scopes cover the action, for example invoices:write for invoices.
    3. Read the result array: each element carries the record id, what happened, and error as {code, message} or null.
    4. Retry only the elements that failed, after fixing the cause named in error.code.

    Endpoints

    EndpointBodyNotes
    POST /invoicesan array of invoicesBatch create, up to 100
    POST /invoices/bulk-submit{ids}Submits each invoice to the ASP as POST /invoices/{id}/submit does (a draft is validated on the way); per invoice submitted, the submission id and its status, or error (validation, period_locked, a submission in flight). With a live key the documents reach the tax authority
    POST /invoices/bulk-send{ids, to?, cc?, bcc?, subject?, message?, format?, language?}Emails each invoice as POST /invoices/{id}/send does; without to each goes to its customer's default recipients; per invoice sent, the delivery id and its state (sent, skipped, failed)
    POST /invoices/bulk-mark-sent{ids, recipient?, sentAt?, note?}Records that the invoices were delivered outside the app (by hand, by post, another system): a manual delivery per invoice in its delivery log; a draft answers invoice_draft, an archived one invoice_archived
    POST /invoices/bulk-delete{ids}Drafts only; an issued invoice answers invoice_issued, a rejected one invoice_rejected
    POST /invoices/bulk-void{ids, reason, reasonCode}Undo by country policy: returns the invoice to draft where the country allows it, otherwise creates a draft credit note; credit notes answer invoice_not_undoable
    POST /ledger/entries/bulk-post{ids}Posts draft journal entries
    POST /ledger/entries/bulk-reverse{ids, date?}Reverses posted entries
    POST /ledger/write-offs{ids, ...}Writes off open invoices
    POST /approvals/decide{stepIds, decision, comment}Approves or declines approval steps with one comment

    Example result:

    [
      { "id": "inv_1", "status": "deleted", "error": null },
      { "id": "inv_2", "status": "skipped", "error": { "code": "invoice_issued", "message": "Issued invoices cannot be deleted" } }
    ]
    

    Good to know

    • Limit: 500 ids per call. Larger lists are refused as a whole; split them.
    • AI assistants have the same actions as tools: submit_invoices, send_invoices, mark_invoices_sent, delete_draft_invoices, void_invoices, decide_approvals, post_journal_entries and reverse_journal_entries. submit_invoices and send_invoices reach the tax authority or a buyer with a live key: an assistant previews the call and asks for confirmation first, and every result carries the environment (test or live).
    • Every record changed by a bulk call appears in the Audit log with the channel API or MCP and the reason you passed.
    • Period locks apply per record: a record dated in a locked period answers period_locked.

    Still stuck? Contact support