Update an invoice

Prev Next
Patch
/v1/invoices/{invoiceId}

Update invoice data using a partial update (PATCH). Only provided fields are updated; omitted fields remain unchanged.

Important: The hash_id field is required for optimistic locking to prevent conflicting updates. Retrieve the current invoice first to obtain the hash_id.

Restrictions:

  • Cannot update invoices that are fully approved
  • Cannot update invoices that are rejected

Request Fields

Field Type Description
hash_id string Invoice hash for optimistic locking. Required.
supplier_info object Supplier details (see below).
ship_to object Ship-to address (name, address).
bill_to object Bill-to address (name, address, memo, departmentId, entityId).
invoice_number string Invoice number.
po_number string Purchase order number.
invoice_terms string Payment terms (e.g., "Net 30").
invoice_date string Invoice date (YYYY-MM-DD).
invoice_due string Payment due date (YYYY-MM-DD).
invoice_items array Line items (see below).
invoice_total number Total invoice amount.
tags string Comma-separated tags.

Supplier Info fields: name, web, email, phone_number, address, supplierId

Ship To fields: name, address

Bill To fields: name, address, memo, departmentId, entityId

Line Item fields (all required except where noted):

  • id (string) - Line item identifier. Required.
  • qty (number) - Quantity. Required.
  • price (number) - Unit price. Required.
  • total (number) - Line total. Required.
  • description (string) - Item description. Required.
  • sku (string) - Item SKU.
  • itemId (string) - Reference to item master.
  • customerId (string) - Customer reference for billable items.
  • accountId (string) - GL account reference.
  • classId (string) - Accounting class reference.
  • poId (string) - Purchase order reference.
  • poLineId (string) - Purchase order line reference.
  • billable (boolean) - Mark as billable. Default: false.
  • departmentId (string) - Department reference.
  • entityId (string) - Entity reference.
  • taxId (string) - Tax code reference.
  • taxInclusive (boolean) - Price includes tax. Default: false.
Security
HTTP
Type bearer

Enter your API token.

Path parameters
invoiceId
integerRequired

The unique identifier of the invoice to update.

Minimum1
Body parameters
updateBasicFields

Update Basic Fields

{
  "hash_id": "abc123def456",
  "invoice_number": "INV-2024-001-REVISED",
  "po_number": "PO-789",
  "invoice_terms": "Net 45",
  "invoice_date": "2024-01-15",
  "invoice_due": "2024-03-01",
  "invoice_total": 1500.0,
  "tags": "revised,q1-2024"
}
updateSupplier

Update Supplier Info

{
  "hash_id": "abc123def456",
  "supplier_info": {
    "name": "Acme Corporation",
    "email": "billing@acme.com",
    "phone_number": "+1-555-123-4567",
    "address": "123 Main St, New York, NY 10001",
    "supplierId": "SUP-001"
  }
}
updateLineItems

Update Line Items

{
  "hash_id": "abc123def456",
  "invoice_items": [
    {
      "id": "1",
      "qty": 10,
      "price": 100.0,
      "total": 1000.0,
      "description": "Professional Services - January 2024",
      "sku": "SVC-001",
      "accountId": "EXP-100",
      "classId": "CLASS-100",
      "billable": true
    },
    {
      "id": "2",
      "qty": 5,
      "price": 100.0,
      "total": 500.0,
      "description": "Consulting Hours",
      "sku": "SVC-002",
      "customerId": "CUST-001",
      "billable": true
    }
  ]
}
fullUpdate

Full Update

{
  "hash_id": "abc123def456",
  "supplier_info": {
    "name": "Acme Corporation",
    "web": "https://acme.com",
    "email": "billing@acme.com",
    "phone_number": "+1-555-123-4567",
    "address": "123 Main St, New York, NY 10001",
    "supplierId": "SUP-001"
  },
  "ship_to": {
    "name": "Warehouse A",
    "address": "456 Oak Ave, Los Angeles, CA 90001"
  },
  "bill_to": {
    "name": "Accounts Payable",
    "address": "789 Corporate Blvd, Chicago, IL 60601",
    "memo": "Attn: John Smith",
    "departmentId": "DEPT-100"
  },
  "invoice_number": "INV-2024-001",
  "po_number": "PO-789",
  "invoice_terms": "Net 30",
  "invoice_date": "2024-01-15",
  "invoice_due": "2024-02-14",
  "invoice_items": [
    {
      "id": "1",
      "qty": 10,
      "price": 100.0,
      "total": 1000.0,
      "description": "Professional Services",
      "sku": "SVC-001",
      "itemId": "ITEM-001",
      "accountId": "EXP-100",
      "classId": "CLASS-100",
      "billable": false
    }
  ],
  "invoice_total": 1000.0,
  "tags": "verified,q1-2024"
}
Expand All
object
hash_id
string Required

Invoice hash for optimistic locking. Required to prevent conflicting updates.

supplier_info
object (InvoiceSupplierInfo)

Supplier/vendor information.

name
string

Supplier name.

web
string

Supplier website URL.

email
string

Supplier email address.

phone_number
string

Supplier phone number.

address
string

Supplier address.

supplierId
string

External supplier/vendor ID reference.

ship_to
object (InvoiceShipTo)

Ship-to address information.

name
string

Ship-to name.

address
string

Ship-to address.

bill_to
object (InvoiceBillTo)

Bill-to address information.

name
string

Bill-to name.

address
string

Bill-to address.

memo
string

Memo or notes for the bill-to.

departmentId
string

Department reference ID.

entityId
string

Entity reference ID.

invoice_number
string

Invoice number from the document.

po_number
string

Purchase order number.

invoice_terms
string

Payment terms (e.g., "Net 30").

invoice_date
string (date)

Invoice date (YYYY-MM-DD).

invoice_due
string (date)

Payment due date (YYYY-MM-DD).

invoice_items
Array of object (InvoiceLineItem)

Line items array.

object

Individual line item on an invoice.

id
string Required

Line item identifier.

qty
number Required

Quantity.

price
number Required

Unit price.

total
number Required

Line total.

description
string Required

Item description.

sku
string

Item SKU.

itemId
string

Reference to item master record.

customerId
string

Customer reference for billable items.

accountId
string

GL account reference ID.

classId
string

Accounting class reference ID.

poId
string

Purchase order reference ID.

poLineId
string

Purchase order line reference ID.

billable
boolean

Mark line item as billable.

Defaultfalse
departmentId
string

Department reference ID.

entityId
string

Entity reference ID.

taxId
string

Tax code reference ID.

taxInclusive
boolean

Price includes tax.

Defaultfalse
invoice_total
number

Total invoice amount.

tags
string

Comma-separated tags.

Responses
200

Invoice updated successfully

success

Success

{
  "status": "OK",
  "msg": "Invoice updated",
  "result": 12345
}
object
status
string
Valid values[ "OK" ]
msg
string
result
400

Bad Request - Invalid data or hash_id mismatch

missingHashId

Missing hash_id

{
  "status": "Error",
  "msg": "A valid reference hash_id is required for update operation.",
  "result": null
}
hashMismatch

Hash ID Mismatch

{
  "status": "Error",
  "msg": "hash_id does not match internal record.",
  "result": null
}
invalidData

Invalid Data

{
  "status": "Error",
  "msg": "Value 'invalid' does not match type 'float' at path 'invoice_total'.",
  "result": null
}
object
status
string
Valid values[ "Error" ]
msg
string
result
401

Unauthorized - Missing or invalid API token

missingToken

Missing Token

{
  "status": "Error",
  "msg": "Bearer token is not set.",
  "result": null
}
object
status
string
Valid values[ "Error" ]
msg
string
result
404

Invoice not found

notFound

Not Found

{
  "status": "Error",
  "msg": "Unable to reference invoice ID: 12345",
  "result": null
}
object
status
string
Valid values[ "Error" ]
msg
string
result
405

Method Not Allowed - Invoice is approved or rejected

approved

Invoice Approved

{
  "status": "Error",
  "msg": "This invoice is fully approved. Update is not allowed.",
  "result": null
}
rejected

Invoice Rejected

{
  "status": "Error",
  "msg": "This invoice is rejected. Update is not allowed.",
  "result": null
}
object
status
string
Valid values[ "Error" ]
msg
string
result