TeamHub icon

TeamHub

Consume the TeamHub Business Management API

Invoice → Create

AI-generated

Summary

Create a new invoice by specifying the invoice date, due date, customer ID, and line items either via UI fields or as a JSON array.

Inputs

  • Date (required) — Invoice date in YYYY-MM-DD format
  • Due Date (required) — Due date in YYYY-MM-DD format
  • Customer ID (required) — The ID of the customer to whom the invoice is issued
  • Line Items Input Mode (required) — Choose between entering line items in UI fields ('Fields') or passing a JSON array ('JSON')
  • Line Items (UI) — Add multiple line items with description, quantity, unit price in cents, and total in cents (total is calculated if set to 0). This is shown when 'Fields' mode is selected.
  • Line Items (JSON) — Provide an array of line items, each containing description, quantity, unitPriceCents, and totalCents. This is shown when 'JSON' mode is selected.
  • Options — Optional settings such as splitting response lists into individual items and ignoring SSL certificate validation issues.

Output shape

a single JSON object representing the created invoice

The response JSON includes the created invoice details as returned by the TeamHub API. If line items are provided, their totals are computed if totalCents is zero for each item. Operation throws an error if required fields are missing or JSON parsing fails for line items.

Examples

Example 1: Create invoice with UI line items

Specify date, due date, customer ID, choose 'Fields' for line items, and add one or more line items through the UI fields for description, quantity, and pricing.

Example 2: Create invoice with JSON line items

Specify date, due date, customer ID, choose 'JSON' for line items input mode, and provide a JSON array of line items in the prescribed format.

Links

Discussion