Skip to content

Replace property allocations and re-evaluate the invoice (ANALYST+)

PUT
/property-management/invoices/{invoiceId}/context
curl --request PUT \
--url https://api.invogi.com/v1/property-management/invoices/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/context \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "allocations": [ { "operating_context_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "spend_commitment_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "is_primary": true, "allocation_amount": "example", "service_period_start": "2026-04-15", "service_period_end": "2026-04-15", "work_order_reference": "example", "recovery_treatment": "RECOVERABLE" } ] }'

Exactly one allocation must be primary when the list is non-empty. A multi-property split requires a positive-magnitude amount for every allocation, and the amounts must equal the absolute invoice gross. Positive allocation magnitudes on supplier credits reduce commitment usage. Every allocation is evaluated independently. ACTIVE profiles append an auditable analysis decision; SHADOW profiles return preview findings without changing the decision. An identical commitment-free replacement is an explicit no-op when its invoice, policy, and profile inputs are also current; it returns unchanged: true without appending an analysis run or dispatching webhooks. Allocations with commitments always re-check live usage and status; saving also queues peer invoices on every commitment left or joined. Clearing a commitment mismatch or overrun needs an Admin or Owner (403), and a change that would clear a CONFIRMED finding is refused (409). On a bill the ledger reported as settled at import, the allocation is stored and decides nothing until the invoice is corrected.

invoiceId
required
string format: uuid
X-Invogi-Organization
string format: uuid

For a Clerk session, selects a workspace in which the user has an active membership. If omitted, the remembered accessible workspace is used. API keys remain bound to their own workspace and cannot select another tenant.

Media typeapplication/json
object
allocations
required
Array<object>
<= 20 items
object
operating_context_id
required
string format: uuid
spend_commitment_id
string | null format: uuid
is_primary
required
boolean
allocation_amount
string | null
/^\d+(?:\.\d{1,6})?$/
service_period_start
string | null format: date
service_period_end
string | null format: date
work_order_reference
string | null
<= 120 characters
recovery_treatment
string | null
Allowed values: RECOVERABLE NON_RECOVERABLE MIXED NOT_APPLICABLE

Context saved and evaluation returned

Media typeapplication/json
Any of:
object
status
required
string
Allowed values: SHADOW ACTIVE INACTIVE
previewFindings
required
Array<object>
object
type
required
string
Allowed values: EXACT_DUPLICATE FUZZY_DUPLICATE AMOUNT_ANOMALY FREQUENCY_ANOMALY BANK_ACCOUNT_CHANGED DUPLICATE_PAYMENT PO_PRICE_VARIANCE PO_QUANTITY_VARIANCE PO_TOTAL_EXCEEDED INVALID_TOTALS EXTRACTION_LOW_CONFIDENCE STRUCTURED_INVOICE_INVALID SUPPLIER_IDENTITY_MISMATCH CURRENCY_UNKNOWN CROSS_CURRENCY_DUPLICATE PO_CURRENCY_MISMATCH TAX_ID_INVALID BANK_DETAILS_INVALID SUPPLIER_NOT_ACTIVE SUPPLIER_REGISTRY_UNCHECKED VAT_RATE_INVALID TAX_ID_MISSING COMPANY_NUMBER_MISSING PROPERTY_CONTEXT_MISSING PROPERTY_ALLOCATION_MISMATCH PROPERTY_SERVICE_PERIOD_MISSING PROPERTY_WORK_ORDER_MISSING PROPERTY_RECOVERABILITY_UNSET PROPERTY_COMMITMENT_MISMATCH PROPERTY_COMMITMENT_EXCEEDED CONSTRUCTION_PROJECT_MISSING CONSTRUCTION_SUBCONTRACT_MISMATCH CONSTRUCTION_SUBCONTRACT_EXCEEDED CONSTRUCTION_CERTIFICATE_MISSING CONSTRUCTION_CERTIFICATE_MISMATCH CONSTRUCTION_CERTIFIED_AMOUNT_EXCEEDED CONSTRUCTION_CIS_VERIFICATION_MISSING CONSTRUCTION_REVERSE_CHARGE_CONFLICT UNAPPLIED_SUPPLIER_CREDIT STATEMENT_CREDIT_BALANCE STATEMENT_CREDIT_MISSING STATEMENT_PAYMENT_UNALLOCATED STATEMENT_INVOICE_MISSING STATEMENT_AMOUNT_MISMATCH BANK_ACCOUNT_REPORTED BANK_CHANGE_UNVERIFIED AGREED_PRICE_VARIANCE BANK_ACCOUNT_SHARED NEW_SUPPLIER_BANK_ACCOUNT
severity
required
string
Allowed values: INFO LOW MEDIUM HIGH CRITICAL
policyAction
string
Allowed values: REVIEW BLOCK
summary
required
string
evidence
required
object
key
additional properties
relatedInvoiceIds
Array<string>
confidence
number
ruleVersion
required
string
recommendedAction
string
analysisRunId
required
null
decision
required
null
unchanged
required
boolean
withheld
number
riskScore
number

Example

{
"status": "SHADOW",
"previewFindings": [
{
"type": "EXACT_DUPLICATE",
"severity": "INFO",
"policyAction": "REVIEW"
}
],
"unchanged": true
}

Invalid request

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: NOT_FOUND UNAUTHORIZED FORBIDDEN INVALID_REQUEST CONFLICT RATE_LIMITED USAGE_LIMIT_EXCEEDED PROCESSING_FAILED
message
required
string
request_id
required
string
details

Optional stable, content-free context, e.g. {reason, resets_at, preparation_id}.

object
key
additional properties
One of:
string

Example

{
"error": {
"code": "NOT_FOUND"
}
}

API key lacks required scope/role

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: NOT_FOUND UNAUTHORIZED FORBIDDEN INVALID_REQUEST CONFLICT RATE_LIMITED USAGE_LIMIT_EXCEEDED PROCESSING_FAILED
message
required
string
request_id
required
string
details

Optional stable, content-free context, e.g. {reason, resets_at, preparation_id}.

object
key
additional properties
One of:
string

Example

{
"error": {
"code": "NOT_FOUND"
}
}

Resource not found

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: NOT_FOUND UNAUTHORIZED FORBIDDEN INVALID_REQUEST CONFLICT RATE_LIMITED USAGE_LIMIT_EXCEEDED PROCESSING_FAILED
message
required
string
request_id
required
string
details

Optional stable, content-free context, e.g. {reason, resets_at, preparation_id}.

object
key
additional properties
One of:
string

Example

{
"error": {
"code": "NOT_FOUND"
}
}

Conflicting idempotency key or resource processing state

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: NOT_FOUND UNAUTHORIZED FORBIDDEN INVALID_REQUEST CONFLICT RATE_LIMITED USAGE_LIMIT_EXCEEDED PROCESSING_FAILED
message
required
string
request_id
required
string
details

Optional stable, content-free context, e.g. {reason, resets_at, preparation_id}.

object
key
additional properties
One of:
string

Example

{
"error": {
"code": "NOT_FOUND"
}
}