curl --request POST \
--url https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/policies/{policyId}/invoices/batch \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"incurredDate": "2026-08-01",
"voidInvoices": [
{
"invoiceId": "550e8400-e29b-41d4-a716-446655440700",
"headJournalId": "550e8400-e29b-41d4-a716-446655440900"
}
],
"creates": [
{
"group": "Policy Invoice",
"dueDate": "2026-08-01",
"payeeId": "550e8400-e29b-41d4-a716-446655440010",
"lineItems": [
{
"label": "Policy Premium",
"amountCents": 500000
}
]
},
{
"group": "Policy Invoice",
"dueDate": "2026-09-01",
"scheduledDate": "2026-08-02",
"payeeId": "550e8400-e29b-41d4-a716-446655440010",
"lineItems": [
{
"label": "Policy Premium",
"amountCents": 500000
}
]
}
]
}
'import requests
url = "https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/policies/{policyId}/invoices/batch"
payload = {
"incurredDate": "2026-08-01",
"voidInvoices": [
{
"invoiceId": "550e8400-e29b-41d4-a716-446655440700",
"headJournalId": "550e8400-e29b-41d4-a716-446655440900"
}
],
"creates": [
{
"group": "Policy Invoice",
"dueDate": "2026-08-01",
"payeeId": "550e8400-e29b-41d4-a716-446655440010",
"lineItems": [
{
"label": "Policy Premium",
"amountCents": 500000
}
]
},
{
"group": "Policy Invoice",
"dueDate": "2026-09-01",
"scheduledDate": "2026-08-02",
"payeeId": "550e8400-e29b-41d4-a716-446655440010",
"lineItems": [
{
"label": "Policy Premium",
"amountCents": 500000
}
]
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
incurredDate: '2026-08-01',
voidInvoices: [
{
invoiceId: '550e8400-e29b-41d4-a716-446655440700',
headJournalId: '550e8400-e29b-41d4-a716-446655440900'
}
],
creates: [
{
group: 'Policy Invoice',
dueDate: '2026-08-01',
payeeId: '550e8400-e29b-41d4-a716-446655440010',
lineItems: [{label: 'Policy Premium', amountCents: 500000}]
},
{
group: 'Policy Invoice',
dueDate: '2026-09-01',
scheduledDate: '2026-08-02',
payeeId: '550e8400-e29b-41d4-a716-446655440010',
lineItems: [{label: 'Policy Premium', amountCents: 500000}]
}
]
})
};
fetch('https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/policies/{policyId}/invoices/batch', 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/policies/{policyId}/invoices/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'incurredDate' => '2026-08-01',
'voidInvoices' => [
[
'invoiceId' => '550e8400-e29b-41d4-a716-446655440700',
'headJournalId' => '550e8400-e29b-41d4-a716-446655440900'
]
],
'creates' => [
[
'group' => 'Policy Invoice',
'dueDate' => '2026-08-01',
'payeeId' => '550e8400-e29b-41d4-a716-446655440010',
'lineItems' => [
[
'label' => 'Policy Premium',
'amountCents' => 500000
]
]
],
[
'group' => 'Policy Invoice',
'dueDate' => '2026-09-01',
'scheduledDate' => '2026-08-02',
'payeeId' => '550e8400-e29b-41d4-a716-446655440010',
'lineItems' => [
[
'label' => 'Policy Premium',
'amountCents' => 500000
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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/policies/{policyId}/invoices/batch"
payload := strings.NewReader("{\n \"incurredDate\": \"2026-08-01\",\n \"voidInvoices\": [\n {\n \"invoiceId\": \"550e8400-e29b-41d4-a716-446655440700\",\n \"headJournalId\": \"550e8400-e29b-41d4-a716-446655440900\"\n }\n ],\n \"creates\": [\n {\n \"group\": \"Policy Invoice\",\n \"dueDate\": \"2026-08-01\",\n \"payeeId\": \"550e8400-e29b-41d4-a716-446655440010\",\n \"lineItems\": [\n {\n \"label\": \"Policy Premium\",\n \"amountCents\": 500000\n }\n ]\n },\n {\n \"group\": \"Policy Invoice\",\n \"dueDate\": \"2026-09-01\",\n \"scheduledDate\": \"2026-08-02\",\n \"payeeId\": \"550e8400-e29b-41d4-a716-446655440010\",\n \"lineItems\": [\n {\n \"label\": \"Policy Premium\",\n \"amountCents\": 500000\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/policies/{policyId}/invoices/batch")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"incurredDate\": \"2026-08-01\",\n \"voidInvoices\": [\n {\n \"invoiceId\": \"550e8400-e29b-41d4-a716-446655440700\",\n \"headJournalId\": \"550e8400-e29b-41d4-a716-446655440900\"\n }\n ],\n \"creates\": [\n {\n \"group\": \"Policy Invoice\",\n \"dueDate\": \"2026-08-01\",\n \"payeeId\": \"550e8400-e29b-41d4-a716-446655440010\",\n \"lineItems\": [\n {\n \"label\": \"Policy Premium\",\n \"amountCents\": 500000\n }\n ]\n },\n {\n \"group\": \"Policy Invoice\",\n \"dueDate\": \"2026-09-01\",\n \"scheduledDate\": \"2026-08-02\",\n \"payeeId\": \"550e8400-e29b-41d4-a716-446655440010\",\n \"lineItems\": [\n {\n \"label\": \"Policy Premium\",\n \"amountCents\": 500000\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/policies/{policyId}/invoices/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"incurredDate\": \"2026-08-01\",\n \"voidInvoices\": [\n {\n \"invoiceId\": \"550e8400-e29b-41d4-a716-446655440700\",\n \"headJournalId\": \"550e8400-e29b-41d4-a716-446655440900\"\n }\n ],\n \"creates\": [\n {\n \"group\": \"Policy Invoice\",\n \"dueDate\": \"2026-08-01\",\n \"payeeId\": \"550e8400-e29b-41d4-a716-446655440010\",\n \"lineItems\": [\n {\n \"label\": \"Policy Premium\",\n \"amountCents\": 500000\n }\n ]\n },\n {\n \"group\": \"Policy Invoice\",\n \"dueDate\": \"2026-09-01\",\n \"scheduledDate\": \"2026-08-02\",\n \"payeeId\": \"550e8400-e29b-41d4-a716-446655440010\",\n \"lineItems\": [\n {\n \"label\": \"Policy Premium\",\n \"amountCents\": 500000\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"journalIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"invoices": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoiceNumber": "<string>",
"categoryId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"linkedEvent": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"displayName": "<string>"
},
"linkedPolicy": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"displayName": "<string>"
},
"linkedPayee": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"entityType": "<string>",
"displayName": "<string>"
},
"incurredDate": "2023-12-25",
"dueDate": "2023-12-25",
"memo": "<string>",
"fieldData": {},
"lineItems": [
{
"lineItemId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"lineItemTypeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"memo": "<string>",
"amountCents": 123
}
],
"totalAmountCents": 123,
"amountPaidCents": 123,
"balanceDueCents": 123,
"draftAmountPaidCents": 123,
"paidDate": "2023-12-25",
"lastPaymentDate": "2023-12-25",
"voidedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z",
"approved": true,
"approvedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"headJournalId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"scheduledDates": {}
}Update Policy Invoices
Applies one atomic keep/void/create plan to a policy’s complete invoice set. This is the only document-write door for policy-linked invoices: the engine validates the plan against the policy’s current pricing contract and commits every void and create together, or writes nothing.
Existing active invoices omitted from voidInvoices are kept. Every void
carries the headJournalId watermark from the read that the plan was based
on; one stale head rejects the entire batch with 409. The kept invoices
plus creates must net every bound pricing component to exactly zero.
The body is exactly a detached PolicyInvoiceTransactionPlan. policyId
belongs only in the path. Dates, payees, lines, voids, and creates are never
defaulted or inferred.
Required permission: company.payment:update
curl --request POST \
--url https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/policies/{policyId}/invoices/batch \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"incurredDate": "2026-08-01",
"voidInvoices": [
{
"invoiceId": "550e8400-e29b-41d4-a716-446655440700",
"headJournalId": "550e8400-e29b-41d4-a716-446655440900"
}
],
"creates": [
{
"group": "Policy Invoice",
"dueDate": "2026-08-01",
"payeeId": "550e8400-e29b-41d4-a716-446655440010",
"lineItems": [
{
"label": "Policy Premium",
"amountCents": 500000
}
]
},
{
"group": "Policy Invoice",
"dueDate": "2026-09-01",
"scheduledDate": "2026-08-02",
"payeeId": "550e8400-e29b-41d4-a716-446655440010",
"lineItems": [
{
"label": "Policy Premium",
"amountCents": 500000
}
]
}
]
}
'import requests
url = "https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/policies/{policyId}/invoices/batch"
payload = {
"incurredDate": "2026-08-01",
"voidInvoices": [
{
"invoiceId": "550e8400-e29b-41d4-a716-446655440700",
"headJournalId": "550e8400-e29b-41d4-a716-446655440900"
}
],
"creates": [
{
"group": "Policy Invoice",
"dueDate": "2026-08-01",
"payeeId": "550e8400-e29b-41d4-a716-446655440010",
"lineItems": [
{
"label": "Policy Premium",
"amountCents": 500000
}
]
},
{
"group": "Policy Invoice",
"dueDate": "2026-09-01",
"scheduledDate": "2026-08-02",
"payeeId": "550e8400-e29b-41d4-a716-446655440010",
"lineItems": [
{
"label": "Policy Premium",
"amountCents": 500000
}
]
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
incurredDate: '2026-08-01',
voidInvoices: [
{
invoiceId: '550e8400-e29b-41d4-a716-446655440700',
headJournalId: '550e8400-e29b-41d4-a716-446655440900'
}
],
creates: [
{
group: 'Policy Invoice',
dueDate: '2026-08-01',
payeeId: '550e8400-e29b-41d4-a716-446655440010',
lineItems: [{label: 'Policy Premium', amountCents: 500000}]
},
{
group: 'Policy Invoice',
dueDate: '2026-09-01',
scheduledDate: '2026-08-02',
payeeId: '550e8400-e29b-41d4-a716-446655440010',
lineItems: [{label: 'Policy Premium', amountCents: 500000}]
}
]
})
};
fetch('https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/policies/{policyId}/invoices/batch', 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/policies/{policyId}/invoices/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'incurredDate' => '2026-08-01',
'voidInvoices' => [
[
'invoiceId' => '550e8400-e29b-41d4-a716-446655440700',
'headJournalId' => '550e8400-e29b-41d4-a716-446655440900'
]
],
'creates' => [
[
'group' => 'Policy Invoice',
'dueDate' => '2026-08-01',
'payeeId' => '550e8400-e29b-41d4-a716-446655440010',
'lineItems' => [
[
'label' => 'Policy Premium',
'amountCents' => 500000
]
]
],
[
'group' => 'Policy Invoice',
'dueDate' => '2026-09-01',
'scheduledDate' => '2026-08-02',
'payeeId' => '550e8400-e29b-41d4-a716-446655440010',
'lineItems' => [
[
'label' => 'Policy Premium',
'amountCents' => 500000
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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/policies/{policyId}/invoices/batch"
payload := strings.NewReader("{\n \"incurredDate\": \"2026-08-01\",\n \"voidInvoices\": [\n {\n \"invoiceId\": \"550e8400-e29b-41d4-a716-446655440700\",\n \"headJournalId\": \"550e8400-e29b-41d4-a716-446655440900\"\n }\n ],\n \"creates\": [\n {\n \"group\": \"Policy Invoice\",\n \"dueDate\": \"2026-08-01\",\n \"payeeId\": \"550e8400-e29b-41d4-a716-446655440010\",\n \"lineItems\": [\n {\n \"label\": \"Policy Premium\",\n \"amountCents\": 500000\n }\n ]\n },\n {\n \"group\": \"Policy Invoice\",\n \"dueDate\": \"2026-09-01\",\n \"scheduledDate\": \"2026-08-02\",\n \"payeeId\": \"550e8400-e29b-41d4-a716-446655440010\",\n \"lineItems\": [\n {\n \"label\": \"Policy Premium\",\n \"amountCents\": 500000\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/policies/{policyId}/invoices/batch")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"incurredDate\": \"2026-08-01\",\n \"voidInvoices\": [\n {\n \"invoiceId\": \"550e8400-e29b-41d4-a716-446655440700\",\n \"headJournalId\": \"550e8400-e29b-41d4-a716-446655440900\"\n }\n ],\n \"creates\": [\n {\n \"group\": \"Policy Invoice\",\n \"dueDate\": \"2026-08-01\",\n \"payeeId\": \"550e8400-e29b-41d4-a716-446655440010\",\n \"lineItems\": [\n {\n \"label\": \"Policy Premium\",\n \"amountCents\": 500000\n }\n ]\n },\n {\n \"group\": \"Policy Invoice\",\n \"dueDate\": \"2026-09-01\",\n \"scheduledDate\": \"2026-08-02\",\n \"payeeId\": \"550e8400-e29b-41d4-a716-446655440010\",\n \"lineItems\": [\n {\n \"label\": \"Policy Premium\",\n \"amountCents\": 500000\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://go.aiinsurance.io/api/v1/companies/{companyId}/financials/policies/{policyId}/invoices/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"incurredDate\": \"2026-08-01\",\n \"voidInvoices\": [\n {\n \"invoiceId\": \"550e8400-e29b-41d4-a716-446655440700\",\n \"headJournalId\": \"550e8400-e29b-41d4-a716-446655440900\"\n }\n ],\n \"creates\": [\n {\n \"group\": \"Policy Invoice\",\n \"dueDate\": \"2026-08-01\",\n \"payeeId\": \"550e8400-e29b-41d4-a716-446655440010\",\n \"lineItems\": [\n {\n \"label\": \"Policy Premium\",\n \"amountCents\": 500000\n }\n ]\n },\n {\n \"group\": \"Policy Invoice\",\n \"dueDate\": \"2026-09-01\",\n \"scheduledDate\": \"2026-08-02\",\n \"payeeId\": \"550e8400-e29b-41d4-a716-446655440010\",\n \"lineItems\": [\n {\n \"label\": \"Policy Premium\",\n \"amountCents\": 500000\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"journalIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"invoices": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoiceNumber": "<string>",
"categoryId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"linkedEvent": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"displayName": "<string>"
},
"linkedPolicy": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"displayName": "<string>"
},
"linkedPayee": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"entityType": "<string>",
"displayName": "<string>"
},
"incurredDate": "2023-12-25",
"dueDate": "2023-12-25",
"memo": "<string>",
"fieldData": {},
"lineItems": [
{
"lineItemId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"lineItemTypeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"memo": "<string>",
"amountCents": 123
}
],
"totalAmountCents": 123,
"amountPaidCents": 123,
"balanceDueCents": 123,
"draftAmountPaidCents": 123,
"paidDate": "2023-12-25",
"lastPaymentDate": "2023-12-25",
"voidedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z",
"approved": true,
"approvedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"headJournalId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"scheduledDates": {}
}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.
Path Parameters
Company identifier
Policy identifier
Body
A fully explicit, detached policy-invoice batch. Existing invoices not named in voidInvoices are kept. The complete kept-plus-created set must conserve every bound component of the policy's current pricing contract.
Response
The resulting policy invoice set.
Journal ids emitted in execution order (voids, then creates).
All non-deleted policy invoices after the batch, voided rows included.
Show child attributes
Show child attributes
Sparse map from invoice id to its installment recognition date.
Show child attributes
Show child attributes
