Skip to main content
Glama

Save document

save_document

Create or update a WHOLE document and its header (contact, dates, type, parent); to change lines on an existing document without resending it use update_document_item, and to add one line use add_document_line. Works for documents of ANY kind — all eight document types are supported here, not just invoices: invoice, quote, recurring, debit_note, credit_note, purchase_order, bill, grn (the type enum below documents what each one is for). Credit notes and debit notes are raised through this same tool — pass the matching type and, where it relates to an existing document, its id as parent. For one document, send its fields inline (pass an id to update, omit + include type to create). To create/update many at once, send an items array — preferred over repeated calls: the whole batch is one all-or-nothing transaction with a single ledger recompute. Each item with an id updates; each without creates and must include type. This manages the document as a whole; to edit individual line items on an existing document use update_document_item (or update_document_items_bulk).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNoDocument id. Present → update that document; omit → create a new one (must include type).
dateNoDocument date (ISO 8601).
nameNoDisplay name / title of the document.
sentNoWhether the document has been sent to the recipient.
typeNoThe kind of document. One of: invoice — Bill a customer for goods or services. Money in.; quote — A pre-sale estimate for a customer; becomes money in once accepted.; recurring — An invoice that repeats on a schedule. Money in.; debit_note — Reduce what you owe a supplier (offsets a bill). Money in.; credit_note — Refund or reduce a customer's invoice. Money out.; purchase_order — Order goods or services from a supplier. Money out.; bill — A supplier's bill that you owe. Money out.; grn — Record stock received against a purchase order. Money out..
itemsNoVector of document objects to create/update in one all-or-nothing batch. Preferred over repeated calls. Each item with an id updates; each without creates and must include type.
notesNoFree-text notes.
clientNoClient id, or an exact client name to resolve (see list_clients).
lockedNoWhether the document is locked against further edits.
numberNoDocument number; auto-generated if omitted.
parentNoId of the parent document this one derives from (e.g. the invoice a credit note relates to).
contactNoContact id, or an exact client/supplier name to resolve (client for money-in document types, supplier for money-out; see list_clients / list_suppliers).
duedateNoPayment due date (ISO 8601).
messageNoMessage shown to the recipient on the document.
settledNoWhether the document has been fully settled/paid.
showvatNoWhether to display the VAT/sales-tax line on the document.
acceptedNoWhether the recipient has accepted the document (e.g. a quote).
currencyNoISO 4217 currency code (e.g. "ZAR", "USD"). Defaults to the business currency.
shippingNoShipping amount added to the document total.
showbankNoWhether to display the business's banking details on the document. Defaults to true on create; only shown to recipients on money-in documents (invoices, quotes).
supplierNoSupplier id, or an exact supplier name to resolve (see list_suppliers).
accountidNoBank/ledger account id the payment moved through (see list_accounts).
descriptionNoFree-text description of the document.
showdepositNoWhether to display the deposit line on the document.
accepteddateNoDate the document was accepted (ISO 8601).
paymentnotesNoFree-text payment instructions shown on the document.
showdiscountNoWhether to display the discount line on the document.
showshippingNoWhether to display the shipping line on the document.
baseaccountidNoBase/control account id override; rarely needed — defaults from the category.
depositamountNoExplicit deposit amount; used instead of the percentage when deposituseamount is true.
invoicebankidNoPROD-2443. :bankaccount/id of one of the business's own bank accounts to show on this document instead of the default invoice bank. "$delete" clears it back to the default; null or omitted leaves it unchanged. An id the business does not own is refused.
accountpaymentNoAmount paid against the document at save time.
depositpercentNoDeposit as a percentage of the total.
discountamountNoExplicit discount amount; used instead of the percentage when discountuseamount is true.
discountpercentNoDiscount as a percentage of the subtotal.
showpaymentlinkNoWhether to include an online payment link on the document.
deposituseamountNoWhen true, use depositamount instead of the percentage.
discountuseamountNoWhen true, use discountamount instead of the percentage.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / invoicebankid
      Added value: +{
      +  "description": "PROD-2443. :bankaccount/id of one of the business's own bank accounts to show on this document instead of the default invoice bank. \"$delete\" clears it back to the default; null or omitted leaves it unchanged. An id the business does not own is refused.",
      +  "type": "string"
      +}
    • addedInput schema / properties / items / items / properties / invoicebankid
      Added value: +{
      +  "description": "PROD-2443. :bankaccount/id of one of the business's own bank accounts to show on this document instead of the default invoice bank. \"$delete\" clears it back to the default; null or omitted leaves it unchanged. An id the business does not own is refused.",
      +  "type": "string"
      +}
  2. First observed

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources