curl --request POST \
--url http://localhost:3500/v1/invoices/{id}/line-items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"line_number": 123,
"quantity": "<string>",
"unit_price": "<string>",
"total_excluding_vat": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
line_number: 123,
quantity: '<string>',
unit_price: '<string>',
total_excluding_vat: '<string>'
})
};
fetch('http://localhost:3500/v1/invoices/{id}/line-items', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "http://localhost:3500/v1/invoices/{id}/line-items"
payload = {
"line_number": 123,
"quantity": "<string>",
"unit_price": "<string>",
"total_excluding_vat": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"extraction_confirmed": true,
"extraction_confirmed_at": "2023-11-07T05:31:56Z",
"extraction_confirmed_by_user_id": "<string>",
"invoice_number": "<string>",
"title": "<string>",
"category": "invoice",
"issued_date": "2023-12-25",
"due_date": "2023-12-25",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"currency_code": "<string>",
"total_amount_excluding_vat": "1250.00",
"total_amount_including_vat": "1250.00",
"financially_valid": true,
"financial_errors": [
{
"code": "missing_financial_inputs",
"field": "<string>",
"message": "<string>"
}
],
"alert_summary": {
"scope": {
"type": "invoice",
"agreement_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
},
"checks": {
"status": "not_checkable",
"completed": 1,
"total": 1,
"reasons": [
"credit_note"
]
},
"counts": {
"pending": 1,
"claimed": 1,
"dismissed": 1,
"credited": 1
},
"is_fully_credited": true,
"has_credit_note_match": true
},
"supplier_name": "<string>",
"recipient_name": "<string>",
"review_recommended": true,
"extraction_confidence": "high",
"relationships": {
"linked_credit_note_count": 1,
"matched_invoice_count": 1,
"line_item_count": 123,
"document_count": 123,
"agreement_match_count": 123,
"alert_count": 123
},
"supplier_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"recipient_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"supplier_snapshot": {
"name": "<string>",
"organization_number": "<string>",
"main_name": "<string>",
"department": "<string>",
"email": "<string>",
"website": "<string>",
"address": {
"street": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country_code": "<string>"
}
},
"recipient_snapshot": {
"name": "<string>",
"organization_number": "<string>",
"main_name": "<string>",
"department": "<string>",
"email": "<string>",
"website": "<string>",
"address": {
"street": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country_code": "<string>"
}
},
"payment_terms": "<string>",
"invoice_note": "<string>",
"additional_properties": [
{
"name": "<string>",
"value": "<string>",
"source_path": "<string>",
"scheme": "<string>"
}
],
"original_currency_code": "<string>",
"currency_conversion_rate": "1250.00",
"original_total_amount_including_vat": "1250.00",
"payment": {
"reference": "<string>",
"bank_account_number": "<string>",
"status": "paid",
"outstanding_amount": "1250.00",
"override": {
"outstanding_amount": "1250.00"
},
"integration_outstanding_amount": "1250.00"
},
"delivery": {
"name": "<string>",
"address": {
"street": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country_code": "<string>"
},
"date": "2023-12-25"
},
"references": {
"order_references": [
"<string>"
],
"buyer_reference": "<string>",
"seller_reference": "<string>",
"contract_reference": "<string>",
"project_reference": "<string>",
"accounting_cost": "<string>",
"credit_note_invoice_reference": "<string>"
},
"origin": {
"type": "structured",
"import_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source_system": "<string>",
"source_invoice_id": "<string>"
}
}{
"error": {
"code": "validation_error",
"message": "Invalid correction or category selection, including an invalid financial result.",
"request_id": "req_example"
}
}{
"error": {
"code": "invalid_token",
"message": "Missing or invalid bearer credential.",
"request_id": "req_example"
}
}{
"error": {
"code": "forbidden",
"message": "Access denied: forbidden, token_disabled, organization_required, insufficient_role, or mfa_required. Check the error code and effective permissions.",
"request_id": "req_example"
}
}{
"error": {
"code": "not_found",
"message": "The resource does not exist in the current organization.",
"request_id": "req_example"
}
}{
"error": {
"code": "conflict",
"message": "Invoice, relationship, or claim conflict.",
"request_id": "req_example"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "The IP or authenticated credential exceeded its request limit.",
"request_id": "req_example"
}
}{
"error": {
"code": "internal_error",
"message": "Unexpected server failure. Include the request ID when contacting support.",
"request_id": "req_example"
}
}{
"error": {
"code": "service_unavailable",
"message": "Authentication infrastructure is unavailable or rate limited. Honor Retry-After when provided.",
"request_id": "req_example"
}
}Add one invoice line
Uses the complete-invoice correction planner. The line number must be unused and the complete invoice must remain financially valid. Use invoice PATCH to add a line and correct headers atomically. The response is the invoice; read the line collection for the assigned ID.
curl --request POST \
--url http://localhost:3500/v1/invoices/{id}/line-items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"line_number": 123,
"quantity": "<string>",
"unit_price": "<string>",
"total_excluding_vat": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
line_number: 123,
quantity: '<string>',
unit_price: '<string>',
total_excluding_vat: '<string>'
})
};
fetch('http://localhost:3500/v1/invoices/{id}/line-items', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "http://localhost:3500/v1/invoices/{id}/line-items"
payload = {
"line_number": 123,
"quantity": "<string>",
"unit_price": "<string>",
"total_excluding_vat": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"extraction_confirmed": true,
"extraction_confirmed_at": "2023-11-07T05:31:56Z",
"extraction_confirmed_by_user_id": "<string>",
"invoice_number": "<string>",
"title": "<string>",
"category": "invoice",
"issued_date": "2023-12-25",
"due_date": "2023-12-25",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"currency_code": "<string>",
"total_amount_excluding_vat": "1250.00",
"total_amount_including_vat": "1250.00",
"financially_valid": true,
"financial_errors": [
{
"code": "missing_financial_inputs",
"field": "<string>",
"message": "<string>"
}
],
"alert_summary": {
"scope": {
"type": "invoice",
"agreement_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
},
"checks": {
"status": "not_checkable",
"completed": 1,
"total": 1,
"reasons": [
"credit_note"
]
},
"counts": {
"pending": 1,
"claimed": 1,
"dismissed": 1,
"credited": 1
},
"is_fully_credited": true,
"has_credit_note_match": true
},
"supplier_name": "<string>",
"recipient_name": "<string>",
"review_recommended": true,
"extraction_confidence": "high",
"relationships": {
"linked_credit_note_count": 1,
"matched_invoice_count": 1,
"line_item_count": 123,
"document_count": 123,
"agreement_match_count": 123,
"alert_count": 123
},
"supplier_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"recipient_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"supplier_snapshot": {
"name": "<string>",
"organization_number": "<string>",
"main_name": "<string>",
"department": "<string>",
"email": "<string>",
"website": "<string>",
"address": {
"street": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country_code": "<string>"
}
},
"recipient_snapshot": {
"name": "<string>",
"organization_number": "<string>",
"main_name": "<string>",
"department": "<string>",
"email": "<string>",
"website": "<string>",
"address": {
"street": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country_code": "<string>"
}
},
"payment_terms": "<string>",
"invoice_note": "<string>",
"additional_properties": [
{
"name": "<string>",
"value": "<string>",
"source_path": "<string>",
"scheme": "<string>"
}
],
"original_currency_code": "<string>",
"currency_conversion_rate": "1250.00",
"original_total_amount_including_vat": "1250.00",
"payment": {
"reference": "<string>",
"bank_account_number": "<string>",
"status": "paid",
"outstanding_amount": "1250.00",
"override": {
"outstanding_amount": "1250.00"
},
"integration_outstanding_amount": "1250.00"
},
"delivery": {
"name": "<string>",
"address": {
"street": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country_code": "<string>"
},
"date": "2023-12-25"
},
"references": {
"order_references": [
"<string>"
],
"buyer_reference": "<string>",
"seller_reference": "<string>",
"contract_reference": "<string>",
"project_reference": "<string>",
"accounting_cost": "<string>",
"credit_note_invoice_reference": "<string>"
},
"origin": {
"type": "structured",
"import_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source_system": "<string>",
"source_invoice_id": "<string>"
}
}{
"error": {
"code": "validation_error",
"message": "Invalid correction or category selection, including an invalid financial result.",
"request_id": "req_example"
}
}{
"error": {
"code": "invalid_token",
"message": "Missing or invalid bearer credential.",
"request_id": "req_example"
}
}{
"error": {
"code": "forbidden",
"message": "Access denied: forbidden, token_disabled, organization_required, insufficient_role, or mfa_required. Check the error code and effective permissions.",
"request_id": "req_example"
}
}{
"error": {
"code": "not_found",
"message": "The resource does not exist in the current organization.",
"request_id": "req_example"
}
}{
"error": {
"code": "conflict",
"message": "Invoice, relationship, or claim conflict.",
"request_id": "req_example"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "The IP or authenticated credential exceeded its request limit.",
"request_id": "req_example"
}
}{
"error": {
"code": "internal_error",
"message": "Unexpected server failure. Include the request ID when contacting support.",
"request_id": "req_example"
}
}{
"error": {
"code": "service_unavailable",
"message": "Authentication infrastructure is unavailable or rate limited. Honor Retry-After when provided.",
"request_id": "req_example"
}
}Authorizations
Personal API key. Send X-Organization-Id. The required cumulative level is listed in x-watchdog-permission.
Headers
Required for personal API keys. Target one organization you have access to. Migrated keys may omit it to use their original organization. For Clerk sessions, it must match the active organization.
Path Parameters
Body
x <= 2147483647100^-?\d+(?:\.\d+)?$100^-?\d+(?:\.\d+)?$100^-?\d+(?:\.\d+)?$200020002000100^-?\d+(?:\.\d+)?$100^-?\d+(?:\.\d+)?$100^-?\d+(?:\.\d+)?$^\d{4}-\d{2}-\d{2}$^\d{4}-\d{2}-\d{2}$2000Response
Invoice after the addition.
Explicit human review acknowledgment; independent of extraction confidence and financial validity.
invoice, credit_note, self_billed_invoice Exact decimal string; retain as decimal text rather than a floating-point number.
100^-?\d+(?:\.\d+)?$"1250.00"
Exact decimal string; retain as decimal text rather than a floating-point number.
100^-?\d+(?:\.\d+)?$"1250.00"
Deterministic arithmetic within a tolerance of 1 currency unit. Does not imply extraction accuracy, compliance, or human approval.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Current canonical supplier name. Used by supplier ordering.
Current canonical recipient name. Used by recipient ordering.
Review is recommended for low or medium unconfirmed extraction confidence, an unmatched credit note, or financial invalidity. Uses the same predicate as the review_recommended filter.
Lowest original header/line confidence from the creating import, when both stages have reliable evidence. Structured, XML and unavailable historical evidence are unknown; manual confirmation does not change this value.
high, mid, low, unknown Recorded org-owned links including soft-deleted counterparts. A match does not establish financial resolution.
Show child attributes
Show child attributes
Current canonical supplier ID.
Current canonical recipient ID.
Supplier details captured on the invoice.
Show child attributes
Show child attributes
Recipient details captured on the invoice.
Show child attributes
Show child attributes
Stored printed payment terms, including conditions. Null means unavailable; never inferred from the due date.
Stored invoice-wide note in its original wording, separate from line notes. Null means unavailable; empty text stays empty.
Stored named business details with optional source paths. Null means unavailable; [] means inspected with none found. These do not replace financial values.
Show child attributes
Show child attributes
Exact decimal string; retain as decimal text rather than a floating-point number.
100^-?\d+(?:\.\d+)?$"1250.00"
Exact decimal string; retain as decimal text rather than a floating-point number.
100^-?\d+(?:\.\d+)?$"1250.00"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes