curl --request PUT \
--url https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/invoices/{invoiceId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'If-Match: <if-match>' \
--data '
{
"actionId": "8c1d3e5f-2a4b-4c6d-8e0f-3b5d7a9c1e24",
"categoryId": "550e8400-e29b-41d4-a716-446655440100",
"incurredDate": "2026-06-01",
"dueDate": "2026-08-01",
"memo": "Legal defense — revised",
"lineItems": [
{
"lineItemId": "550e8400-e29b-41d4-a716-446655440300",
"lineItemTypeId": "550e8400-e29b-41d4-a716-446655440110",
"amountCents": 10000
}
]
}
'import requests
url = "https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/invoices/{invoiceId}"
payload = {
"actionId": "8c1d3e5f-2a4b-4c6d-8e0f-3b5d7a9c1e24",
"categoryId": "550e8400-e29b-41d4-a716-446655440100",
"incurredDate": "2026-06-01",
"dueDate": "2026-08-01",
"memo": "Legal defense — revised",
"lineItems": [
{
"lineItemId": "550e8400-e29b-41d4-a716-446655440300",
"lineItemTypeId": "550e8400-e29b-41d4-a716-446655440110",
"amountCents": 10000
}
]
}
headers = {
"If-Match": "<if-match>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'If-Match': '<if-match>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
actionId: '8c1d3e5f-2a4b-4c6d-8e0f-3b5d7a9c1e24',
categoryId: '550e8400-e29b-41d4-a716-446655440100',
incurredDate: '2026-06-01',
dueDate: '2026-08-01',
memo: 'Legal defense — revised',
lineItems: [
{
lineItemId: '550e8400-e29b-41d4-a716-446655440300',
lineItemTypeId: '550e8400-e29b-41d4-a716-446655440110',
amountCents: 10000
}
]
})
};
fetch('https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/invoices/{invoiceId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/invoices/{invoiceId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'actionId' => '8c1d3e5f-2a4b-4c6d-8e0f-3b5d7a9c1e24',
'categoryId' => '550e8400-e29b-41d4-a716-446655440100',
'incurredDate' => '2026-06-01',
'dueDate' => '2026-08-01',
'memo' => 'Legal defense — revised',
'lineItems' => [
[
'lineItemId' => '550e8400-e29b-41d4-a716-446655440300',
'lineItemTypeId' => '550e8400-e29b-41d4-a716-446655440110',
'amountCents' => 10000
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"If-Match: <if-match>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/invoices/{invoiceId}"
payload := strings.NewReader("{\n \"actionId\": \"8c1d3e5f-2a4b-4c6d-8e0f-3b5d7a9c1e24\",\n \"categoryId\": \"550e8400-e29b-41d4-a716-446655440100\",\n \"incurredDate\": \"2026-06-01\",\n \"dueDate\": \"2026-08-01\",\n \"memo\": \"Legal defense — revised\",\n \"lineItems\": [\n {\n \"lineItemId\": \"550e8400-e29b-41d4-a716-446655440300\",\n \"lineItemTypeId\": \"550e8400-e29b-41d4-a716-446655440110\",\n \"amountCents\": 10000\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("If-Match", "<if-match>")
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/invoices/{invoiceId}")
.header("If-Match", "<if-match>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"actionId\": \"8c1d3e5f-2a4b-4c6d-8e0f-3b5d7a9c1e24\",\n \"categoryId\": \"550e8400-e29b-41d4-a716-446655440100\",\n \"incurredDate\": \"2026-06-01\",\n \"dueDate\": \"2026-08-01\",\n \"memo\": \"Legal defense — revised\",\n \"lineItems\": [\n {\n \"lineItemId\": \"550e8400-e29b-41d4-a716-446655440300\",\n \"lineItemTypeId\": \"550e8400-e29b-41d4-a716-446655440110\",\n \"amountCents\": 10000\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/invoices/{invoiceId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["If-Match"] = '<if-match>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"actionId\": \"8c1d3e5f-2a4b-4c6d-8e0f-3b5d7a9c1e24\",\n \"categoryId\": \"550e8400-e29b-41d4-a716-446655440100\",\n \"incurredDate\": \"2026-06-01\",\n \"dueDate\": \"2026-08-01\",\n \"memo\": \"Legal defense — revised\",\n \"lineItems\": [\n {\n \"lineItemId\": \"550e8400-e29b-41d4-a716-446655440300\",\n \"lineItemTypeId\": \"550e8400-e29b-41d4-a716-446655440110\",\n \"amountCents\": 10000\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"journalIds": [
"8c1d3e5f-2a4b-4c6d-8e0f-3b5d7a9c1e24"
],
"invoice": {
"id": "550e8400-e29b-41d4-a716-446655440700",
"invoiceNumber": "INV-389538-455",
"categoryId": "550e8400-e29b-41d4-a716-446655440100",
"status": "partially_paid",
"linkedEvent": {
"id": "550e8400-e29b-41d4-a716-446655440200",
"displayName": "Claim #1042"
},
"linkedPolicy": null,
"linkedPayee": null,
"incurredDate": "2026-06-01",
"dueDate": "2026-08-01",
"memo": "Legal defense — revised",
"fieldData": null,
"lineItems": [
{
"lineItemId": "550e8400-e29b-41d4-a716-446655440300",
"lineItemTypeId": "550e8400-e29b-41d4-a716-446655440110",
"memo": null,
"amountCents": 10000
}
],
"totalAmountCents": 10000,
"amountPaidCents": 4000,
"balanceDueCents": 6000,
"draftAmountPaidCents": null,
"paidDate": null,
"lastPaymentDate": "2026-06-10",
"approved": true,
"approvedAt": "2026-06-10T09:00:00.000Z",
"voidedAt": null,
"deletedAt": null,
"createdAt": "2026-06-01T10:30:00.000Z",
"updatedAt": "2026-06-12T09:00:00.000Z",
"headJournalId": "8c1d3e5f-2a4b-4c6d-8e0f-3b5d7a9c1e24"
},
"payments": [
{
"id": "550e8400-e29b-41d4-a716-446655440800",
"journalId": "550e8400-e29b-41d4-a716-446655440900",
"lineItemId": "550e8400-e29b-41d4-a716-446655440300",
"amountCents": 4000,
"paymentDate": "2026-06-10",
"erodeReserves": true,
"memo": "check #100",
"createdAt": "2026-06-10T09:00:00.000Z"
}
]
}Update Invoice
Replaces the invoice’s economic document — the invoice.updated action.
The body still carries the FULL document (categoryId, dates, memo,
fieldData, lineItems); links are excluded by schema (they change via
re-link and
payee change).
The immutability law. Once an invoice is POSTED (a non-draft
creation, or finalize for drafts), its line items — ids, types, amounts —
and its category are FIXED: an update may change only incurredDate,
dueDate, memo, fieldData (and per-line memos), and must echo the
stored line-item set and categoryId verbatim. ANY line-item or category
deviation is rejected with 422 LINE_ITEMS_IMMUTABLE, at any payment
count — zero included. Corrections are void-and-recreate, payments
removed first. A DRAFT edits freely until finalize — the document
(line items and category included) replaces wholesale while drafting.
Concurrency. Send the invoice’s current headJournalId as If-Match
(from any read or write response). Stale → 409 IF_MATCH_CONFLICT with
the current invoice in the body; missing/malformed → 400.
Idempotency. actionId is a client-minted uuid; an identical retry
replays the original outcome (the watermark is not re-evaluated on
replay); reuse with a different payload is 409 ACTION_ID_REUSED.
Other preconditions (422). Cited types must belong to the cited
category (UNKNOWN_ID, reachable on draft edits); newly-introduced
refs must be live (DEPRECATED_CONFIG); voided/deleted invoices reject
updates (INVOICE_VOIDED / INVOICE_DELETED).
Paid invoices. Once the invoice carries a recorded payment (status
paid or partially_paid) the update additionally requires
invoice.edit-paid; a key without it receives 403.
Required permission: invoice.edit
curl --request PUT \
--url https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/invoices/{invoiceId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'If-Match: <if-match>' \
--data '
{
"actionId": "8c1d3e5f-2a4b-4c6d-8e0f-3b5d7a9c1e24",
"categoryId": "550e8400-e29b-41d4-a716-446655440100",
"incurredDate": "2026-06-01",
"dueDate": "2026-08-01",
"memo": "Legal defense — revised",
"lineItems": [
{
"lineItemId": "550e8400-e29b-41d4-a716-446655440300",
"lineItemTypeId": "550e8400-e29b-41d4-a716-446655440110",
"amountCents": 10000
}
]
}
'import requests
url = "https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/invoices/{invoiceId}"
payload = {
"actionId": "8c1d3e5f-2a4b-4c6d-8e0f-3b5d7a9c1e24",
"categoryId": "550e8400-e29b-41d4-a716-446655440100",
"incurredDate": "2026-06-01",
"dueDate": "2026-08-01",
"memo": "Legal defense — revised",
"lineItems": [
{
"lineItemId": "550e8400-e29b-41d4-a716-446655440300",
"lineItemTypeId": "550e8400-e29b-41d4-a716-446655440110",
"amountCents": 10000
}
]
}
headers = {
"If-Match": "<if-match>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'If-Match': '<if-match>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
actionId: '8c1d3e5f-2a4b-4c6d-8e0f-3b5d7a9c1e24',
categoryId: '550e8400-e29b-41d4-a716-446655440100',
incurredDate: '2026-06-01',
dueDate: '2026-08-01',
memo: 'Legal defense — revised',
lineItems: [
{
lineItemId: '550e8400-e29b-41d4-a716-446655440300',
lineItemTypeId: '550e8400-e29b-41d4-a716-446655440110',
amountCents: 10000
}
]
})
};
fetch('https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/invoices/{invoiceId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/invoices/{invoiceId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'actionId' => '8c1d3e5f-2a4b-4c6d-8e0f-3b5d7a9c1e24',
'categoryId' => '550e8400-e29b-41d4-a716-446655440100',
'incurredDate' => '2026-06-01',
'dueDate' => '2026-08-01',
'memo' => 'Legal defense — revised',
'lineItems' => [
[
'lineItemId' => '550e8400-e29b-41d4-a716-446655440300',
'lineItemTypeId' => '550e8400-e29b-41d4-a716-446655440110',
'amountCents' => 10000
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"If-Match: <if-match>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/invoices/{invoiceId}"
payload := strings.NewReader("{\n \"actionId\": \"8c1d3e5f-2a4b-4c6d-8e0f-3b5d7a9c1e24\",\n \"categoryId\": \"550e8400-e29b-41d4-a716-446655440100\",\n \"incurredDate\": \"2026-06-01\",\n \"dueDate\": \"2026-08-01\",\n \"memo\": \"Legal defense — revised\",\n \"lineItems\": [\n {\n \"lineItemId\": \"550e8400-e29b-41d4-a716-446655440300\",\n \"lineItemTypeId\": \"550e8400-e29b-41d4-a716-446655440110\",\n \"amountCents\": 10000\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("If-Match", "<if-match>")
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/invoices/{invoiceId}")
.header("If-Match", "<if-match>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"actionId\": \"8c1d3e5f-2a4b-4c6d-8e0f-3b5d7a9c1e24\",\n \"categoryId\": \"550e8400-e29b-41d4-a716-446655440100\",\n \"incurredDate\": \"2026-06-01\",\n \"dueDate\": \"2026-08-01\",\n \"memo\": \"Legal defense — revised\",\n \"lineItems\": [\n {\n \"lineItemId\": \"550e8400-e29b-41d4-a716-446655440300\",\n \"lineItemTypeId\": \"550e8400-e29b-41d4-a716-446655440110\",\n \"amountCents\": 10000\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/invoices/{invoiceId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["If-Match"] = '<if-match>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"actionId\": \"8c1d3e5f-2a4b-4c6d-8e0f-3b5d7a9c1e24\",\n \"categoryId\": \"550e8400-e29b-41d4-a716-446655440100\",\n \"incurredDate\": \"2026-06-01\",\n \"dueDate\": \"2026-08-01\",\n \"memo\": \"Legal defense — revised\",\n \"lineItems\": [\n {\n \"lineItemId\": \"550e8400-e29b-41d4-a716-446655440300\",\n \"lineItemTypeId\": \"550e8400-e29b-41d4-a716-446655440110\",\n \"amountCents\": 10000\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"journalIds": [
"8c1d3e5f-2a4b-4c6d-8e0f-3b5d7a9c1e24"
],
"invoice": {
"id": "550e8400-e29b-41d4-a716-446655440700",
"invoiceNumber": "INV-389538-455",
"categoryId": "550e8400-e29b-41d4-a716-446655440100",
"status": "partially_paid",
"linkedEvent": {
"id": "550e8400-e29b-41d4-a716-446655440200",
"displayName": "Claim #1042"
},
"linkedPolicy": null,
"linkedPayee": null,
"incurredDate": "2026-06-01",
"dueDate": "2026-08-01",
"memo": "Legal defense — revised",
"fieldData": null,
"lineItems": [
{
"lineItemId": "550e8400-e29b-41d4-a716-446655440300",
"lineItemTypeId": "550e8400-e29b-41d4-a716-446655440110",
"memo": null,
"amountCents": 10000
}
],
"totalAmountCents": 10000,
"amountPaidCents": 4000,
"balanceDueCents": 6000,
"draftAmountPaidCents": null,
"paidDate": null,
"lastPaymentDate": "2026-06-10",
"approved": true,
"approvedAt": "2026-06-10T09:00:00.000Z",
"voidedAt": null,
"deletedAt": null,
"createdAt": "2026-06-01T10:30:00.000Z",
"updatedAt": "2026-06-12T09:00:00.000Z",
"headJournalId": "8c1d3e5f-2a4b-4c6d-8e0f-3b5d7a9c1e24"
},
"payments": [
{
"id": "550e8400-e29b-41d4-a716-446655440800",
"journalId": "550e8400-e29b-41d4-a716-446655440900",
"lineItemId": "550e8400-e29b-41d4-a716-446655440300",
"amountCents": 4000,
"paymentDate": "2026-06-10",
"erodeReserves": true,
"memo": "check #100",
"createdAt": "2026-06-10T09:00:00.000Z"
}
]
}Authorizations
API key authentication. Send your raw API key as the Authorization header value with NO scheme prefix — Authorization: YOUR-API-KEY. Do NOT prefix it with Bearer or ApiKey, and do not use an X-API-Key header; those are not accepted.
Headers
The invoice's current headJournalId — the optimistic-concurrency watermark every single-invoice write after creation must send. Read it off any invoice read or write response and echo it verbatim (a bare uuid; an entity-tag dressing of it — "uuid" or W/"uuid" — is also accepted). Missing or malformed is a 400 (IF_MATCH_REQUIRED / IF_MATCH_INVALID); a stale value is a 409 IF_MATCH_CONFLICT whose body carries the current invoice. An idempotent actionId replay short-circuits BEFORE the watermark is evaluated.
Path Parameters
Company identifier
Invoice identifier
Body
Client-minted idempotency key — becomes the action's journal id. An identical retry replays the original outcome; reuse with a different payload is 409 ACTION_ID_REUSED
The transaction category — echo the stored value for a posted invoice; changing it is 422 LINE_ITEMS_IMMUTABLE, even with zero live payments. Drafts may change category before finalize
Show child attributes
Show child attributes
Optional display label for the source system's author (e.g. the integrator-side user). Stamped as the journal record's display attribution; the acting principal stays the External API service user, so a label can never impersonate an in-app user. Ignored on idempotent replays
1 - 255The recognition date for the charges (ISO YYYY-MM-DD) — the period the amount lands in. May be in the future while the invoice is policy-linked; on an event-linked or unlinked invoice a future date is 422 FUTURE_DATE
When payment is owed — display metadata only
Free-text memo
Values for the tenant-defined custom invoice fields, keyed by field referenceId — an opaque JSON object
Response
The updated invoice — refreshed read state
The response of every single-invoice write — refreshed read state, not an ack: the emitted journal id(s), THE invoice row (identical shape to the reads — one invoice representation everywhere; its headJournalId is the next If-Match), and the invoice's live payments. An idempotent actionId replay returns this same shape rebuilt from the original outcome, server-minted values included.
Every journal id the write emitted — the anchor action's id (the actionId you supplied) first, then any engine-minted siblings (a multi-mark payment's additional marks) and any companion the horizon rule composed (e.g. the reserve unwind of a pre-horizon eroding payment's removal, or a delete's payment sweep)
1THE invoice representation — the same shape everywhere an endpoint returns an invoice (listing rows, the detail read, and every write's refreshed-row response). headJournalId is the invoice's current journal head — the optimistic-concurrency token subsequent writes echo back as If-Match.
Show child attributes
Show child attributes
The invoice's live payment marks after the write, newest first
Show child attributes
Show child attributes
