Invoice payload reference

Both PDF tools accept the same invoice object. invoicepig_generate_pdf receives it directly; invoicepig_generate_pdf_batch receives it in its invoices array.

The object is a strict patch over InvoicePig defaults, so fields are optional at the protocol level but unknown field names are rejected. Provide the information required for a correct business document rather than relying on blank defaults.

Parties, identifiers, and dates

FieldTypeGuidance
companyNamestringInvoice issuer. Confirm this role; a receipt merchant is not automatically the issuer.
billToText / shipToTextstringCustomer or delivery name and address; line breaks are allowed.
invoiceNumberValue / poNumberValuestringUse a user-supplied identifier; do not invent one.
invoiceDate / dueDateISO date string or nullPrefer YYYY-MM-DD; use null to clear an optional date.
paymentTermsValuestringFor example, Net 14.
notesTextstringAdditional non-sensitive invoice notes.

Line items and amounts

FieldTypeGuidance
itemsarrayEach item requires id, description, details, quantity, and rate. id is a non-empty stable string.
taxRatenumberTax percentage or rate used by InvoicePig. Set showTax to show it.
discountnumberAmount or percent according to discountType.
discountTypefixed or percentApplies to discount.
shippingnumberShipping amount; set showShipping to show it.
amountPaidnumberPaid amount or percent according to amountPaidType.
amountPaidTypefixed or percentApplies to amountPaid.
showTax, showDiscount, showShipping, showAmountPaidbooleanControls whether the matching amount is shown.
currencyCodestringUse an ISO 4217 code such as USD, EUR, or THB.
{
  "items": [
    {
      "id": "consulting-01",
      "description": "Consulting",
      "details": "Discovery workshop",
      "quantity": 2,
      "rate": 150
    }
  ],
  "taxRate": 7,
  "showTax": true,
  "currencyCode": "THB"
}

Payment instructions

Set paymentMethod to one of bank_transfer, local_transfer, crypto, or other, then provide only the matching non-sensitive instructions.

MethodSupported fields
bank_transferbankAccountName, bankAccountNumber, bankName, bankSwiftCode, bankAddress
local_transferlocalAccountName, localAccountNumber, localBankName
cryptocryptoWalletAddress, cryptoNetwork, cryptoCurrency
otherotherPaymentInstructions

Never include card numbers, security codes, API keys, passwords, or other secrets.

Presentation

FieldTypeGuidance
selectedLayoutenumOne of the supported layout IDs below. Unknown IDs are rejected.
primaryColor / accentColorstringBrand colors for the selected layout.
dateFormatstringDisplay date format.
logoIdUUID or nullUse an ID returned by invoicepig_manage_logo to select a saved private logo. Omit for the signed-in user’s selected default, or use null for no logo.
logoSizenumberLogo scale percentage from 20–200; use 100 for normal size and 90 for 90%.
labelsobjectOverride invoice labels such as invoice, billTo, item, quantity, rate, tax, total, and notes.

Supported layout IDs: classic, corporate, formal, minimal, creative, futuristic, luxury, traditional, swiss, and executive.

Validation rules

  • Each line-item number must be finite; do not send NaN or infinity.
  • A batch contains 1–10 invoices.
  • Use invoicepig_manage_logo to add or list private reusable logos, then pass a returned ID as logoId. Do not send image bytes, base64, preview URLs, or arbitrary URLs in an invoice payload.
  • logoSize must be a percentage from 20–200; use 100 for normal size, never 0.9 for 90%.
  • Unknown invoice or line-item fields are rejected, allowing an agent to correct misspelled keys.
  • The server can accept partial data, but incomplete data can yield an incomplete PDF. Ask for missing issuer, customer, currency, line item, and unclear tax treatment before rendering.