Other Documents
Same patterns as invoices. Create, finalize, render, send.
If your documents need a consumer-style gross discount flow instead of the default B2B calculation order, see Calculation Modes.
Delivery Notes
Shipping or packing slips. Set hide_prices: true for a packing list without pricing.
// title: Create delivery note
const _deliveryNote = await sdk.deliveryNotes.create({
customer: { name: "Warehouse Inc.", email: "warehouse@example.com" },
items: [
{ name: "Product A", quantity: 10, price: 50 },
{ name: "Product B", quantity: 5, price: 200 },
],
hide_prices: true,
});Purchase Orders
A purchase order is an order your entity sends to a supplier. It is not a tax document: there is no fiscalization, VAT reporting, payment tracking or e-invoicing, and it can’t be linked to other documents.
// title: Create purchase order
const _purchaseOrder = await sdk.purchaseOrders.create({
customer: { name: "Steel Supply Ltd.", email: "orders@example.com" },
items: [
{ name: "Steel bracket", quantity: 100, price: 4.5 },
{ name: "Mounting screws (box of 50)", quantity: 20 },
],
date_delivery: "2030-04-01",
note: "Deliver to loading dock B.",
});- Supplier. Pass the supplier in
customer_idorcustomer, the same fields other documents use for the customer. Suppliers are contacts in your customers directory. The API marks the contact as a supplier (contact_type: "supplier", or"both"if it was already a buyer). - Requested delivery date. Set
date_deliveryto the date you want the goods (date only,YYYY-MM-DD). - Prices. A line can omit
price; it is stored as0. When you omithide_prices, it defaults totrueif no line has a non-zero price, which gives a quantity-only order. - Numbering. Numbers come from
number_formats.purchase_orderin the entity settings (default{yyyy}-{nnnnn}) and the entity’s sequence starts. Passis_draft: trueto save a draft without a number, then finalize it with the sharedfinalizeDocumentendpoint. Drafts can be deleted and restored. - PDF and share link. Render the PDF or HTML with the shared render endpoints using the
po_id, or share the order through itsshareable_idwithGET /purchase-orders/shareable/{shareableId}(and/htmlor/pdf).POST /purchase-orders/renderpreviews an order without saving it. - Voiding.
POST /purchase-orders/{id}/voidmarks an order as invalid and blocks further changes.
Send an order to the supplier with the Email API. The default subject and body come from email_defaults.purchase_order_subject and email_defaults.purchase_order_body:
// title: Email purchase order to supplier
await sdk.email.sendEmail({
document_id: "po_6595a27b5d35015c3ef0c402",
to: "orders@example.com",
attach_pdf: true,
});Purchase orders can also be exported with the Exports API. They aren’t available as e-SLOG files.
Limits:
- No webhook events in this version.
- Not available for Portugal entities (
422). - White labels can hide purchase orders with the
documents.purchase_orderscapability, which is hidden by default for white labels. - They count toward document usage like estimates and delivery notes.
Estimates
Estimates or proforma invoices before invoicing.
// title: Create estimate
const _estimate = await sdk.estimates.create({
customer: { name: "Potential Client", email: "client@example.com" },
items: [
{ name: "Web Design", quantity: 1, price: 3000 },
{ name: "Development", quantity: 40, price: 100 },
],
date_valid_till: "2024-12-31",
});Credit Notes
Refunds or corrections.
// title: Create credit note
const _creditNote = await sdk.creditNotes.create({
customer: { name: "Acme Corp" },
items: [{ name: "Refund - Duplicate charge", quantity: 1, price: 100 }],
linked_documents: [invoice.id],
});Advance Invoices
Deposits or prepayments.
// title: Create advance invoice
const _advance = await sdk.advanceInvoices.create({
customer: { name: "Acme Corp", email: "billing@acme.com" },
items: [{ name: "Project deposit (50%)", quantity: 1, price: 5000 }],
});