Office

Invoices

The 5 tools for invoices. Before an agent first makes one, it reads guide topic invoices.

create_invoice

Make an invoice in a space: who it is from and to, its number (given for you), the day issued and the day due, price lines with quantities and unit prices (Artifacts adds up the subtotal, discount, tax and total), how to pay (bank details) and a note. The client reads it on its published page; when the money arrives, update_invoice with paid marks it paid. When the space lists its invoices in a sheet or database (list_invoices_in), its row is written there. Read guide topic "invoices" first; check it with render_invoice; publish_item gives the link to send.

Parameters

space_idstringrequired
titlestringrequired
What people find it by: "Invoice: Redfern Logistics, November".
numberstring
Its number; a new invoice is numbered for you (INV-0001, INV-0002… per space).
fromobject
Who it is from (you). A new invoice starts with the space's last one.
Show child attributes
companystring
Your company, as the client pays it.
contactstring
Who to ask about it.
emailstring
An email, shown on the invoice.
addressstring
The postal address, on one line ("200 Market St, San Francisco, CA 94105").
clientobject
Who pays it.
Show child attributes
companystring
The client company: "Redfern Logistics".
contactstring
The person who approves it: "Ruth Okafor, Head of Operations".
emailstring
An email, shown on the invoice.
addressstring
The postal address, on one line ("200 Market St, San Francisco, CA 94105").
issuedstring
The day it is issued (YYYY-MM-DD; default today).
duestring
The day it is due (YYYY-MM-DD; default 30 days after issued).
linesobject[]
Show child attributes
itemstringrequired
What it is: "Team plan, 120 seats", "Design work".
descriptionstring
A line under it: the period, what is included.
quantitynumber
How many (default 1).
unit_pricenumberrequired
The price of one, in the invoice's currency.
unitstring
What one is: "seat / year", "hour", "month".
currencystring
ISO code: "USD" (default), "EUR", "GBP".
discount_percentnumber
A discount on the subtotal, in percent.
tax_percentnumber
Tax on the subtotal after the discount, in percent.
paymentstring
How to pay, in Markdown: bank, account and routing numbers, the reference to quote. A new invoice starts with the space's last one.
notesstring
A closing note, in Markdown: thanks, late-payment terms.

read_invoice

An invoice as it is now: its status (draft, sent, overdue, paid), number, who it is from and to, the days issued and due, its price lines with their ids (what update_invoice and comment take), the totals, how to pay, the note, when it was paid (the day, the amount, who marked it), where the space lists its invoices, its published link and whether that page shows the latest version, and checks: what to fix.

Parameters

item_idstringrequired

update_invoice

Change an invoice: the title, number, who it is from and to, the days issued and due, currency, discount, tax, how to pay and the note; add price lines (after a given id, or at the end), change them (only the parts given; null or "" clears one), remove them (only when the person asked), order them (every id once). paid marks it paid when the person says the money arrived (the day, default today, and a note such as the transfer reference): its terms then stop changing. paid: null undoes it (a mistake). Its row in the space's invoice list follows. A published invoice's page keeps the version published last: after a change, the client sees it only once it is published again (publish_item, when the person asks).

Parameters

item_idstringrequired
titlestring
numberstring
Its number; a new invoice is numbered for you (INV-0001, INV-0002… per space).
fromobject
Show child attributes
companystring | null
contactstring | null
emailstring | null
addressstring | null
clientobject
Show child attributes
companystring | null
contactstring | null
emailstring | null
addressstring | null
issuedstring
The day it is issued (YYYY-MM-DD; default today).
duestring
The day it is due (YYYY-MM-DD; default 30 days after issued).
currencystring
ISO code: "USD" (default), "EUR", "GBP".
discount_percentnumber | null
tax_percentnumber | null
paymentstring | null
notesstring | null
add_linesobject[]
Show child attributes
itemstringrequired
What it is: "Team plan, 120 seats", "Design work".
descriptionstring
A line under it: the period, what is included.
quantitynumber
How many (default 1).
unit_pricenumberrequired
The price of one, in the invoice's currency.
unitstring
What one is: "seat / year", "hour", "month".
afterstring
The line it goes after; left out, at the end.
change_linesobject[]
Show child attributes
linestringrequired
Its id.
itemstring
What it is: "Team plan, 120 seats", "Design work".
descriptionstring | null
quantitynumber
How many (default 1).
unit_pricenumber
The price of one, in the invoice's currency.
unitstring | null
remove_linesstring[]
order_linesstring[]
Every line id once, in the new order.
paidobject | null
Mark it paid, only when the person says the money arrived; null undoes it.
Show child attributes
paid_onstring
The day the money arrived (YYYY-MM-DD; default today).
notestring
The transfer reference, how it was paid.

list_invoices_in

Where a space lists its invoices, one row each — Number, Client, Amount, Due, Status (Draft, Sent, Paid) — kept up to date as invoices change, are published and are marked paid. Give nothing for a new database named Invoices; sheet for a spreadsheet of the space (its Invoices tab, made if missing); or database (and table) for a database of the space (the table given gets the missing fields; without table, a new Invoices table). Every invoice of the space is written there at once. off: true stops listing (the rows stay). Only when the person asks where invoices should be listed.

Parameters

space_idstringrequired
sheetstring
A spreadsheet item of the space.
databasestring
A database item of the space.
tablestring
The database's table, by name or id.
offboolean
Stop listing invoices.

render_invoice

See an invoice as people do: a screenshot of the page (its sender, client, dates, lines, totals and how to pay), plus checks — no sender, client or payment details, no price lines, a total of 0, overdue, an invoice list that cannot be written, not published yet or changed since — and errors the page hit.

Parameters

item_idstringrequired