Webhooks
Invoice updated
Aira sends this event after a field of the invoice that GET /v1/invoices answers changes: its date, its due date, its total, its status, its lock, the instant that Aira sent it by e-mail, its custom fields and its billing account. A recalculation that changes none of these fields sends no event, also when it changes the line items, because the event carries no line items. To follow the line items of a contract invoice, subscribe to invoice.recalculated, which Aira sends after each recalculation, and read them from GET /v1/invoices/{id}.
WEBHOOK
invoice.updated
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"event": "invoice.updated",
"payload": {
"invoice": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Mercado Bom Preço",
"externalId": "705faf65-9c8b-4053-8c0b-2021281ce83f"
},
"contractInvoiceSequence": 2,
"billingAccount": {
"businessName": "Mercado Bom Preço Ltda",
"taxId": "01234567000195"
},
"invoiceNumber": "ACMEI-0042",
"invoiceDate": "2023-12-25",
"dueDate": "2023-12-25",
"totalAmount": 123,
"contractId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"isLocked": true,
"sentAt": "2023-11-07T05:31:56Z",
"customFields": {
"customField1": "value1",
"customField2": [
"value2",
"value3"
]
}
},
"previousValues": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contractInvoiceSequence": 2,
"invoiceNumber": "ACMEI-0042",
"invoiceDate": "2023-12-25",
"dueDate": "2023-12-25",
"totalAmount": 123,
"contractId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"isLocked": true,
"sentAt": "2023-11-07T05:31:56Z",
"customFields": {
"customField1": "value1",
"customField2": [
"value2",
"value3"
]
}
}
}
}Headers
Body
application/json
The event, with its identifier, its name and its payload.
Response
2XX
Answer with a 2XX status to confirm the delivery. Aira retries a delivery that gets another status, a redirect or no answer.
⌘I
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"event": "invoice.updated",
"payload": {
"invoice": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Mercado Bom Preço",
"externalId": "705faf65-9c8b-4053-8c0b-2021281ce83f"
},
"contractInvoiceSequence": 2,
"billingAccount": {
"businessName": "Mercado Bom Preço Ltda",
"taxId": "01234567000195"
},
"invoiceNumber": "ACMEI-0042",
"invoiceDate": "2023-12-25",
"dueDate": "2023-12-25",
"totalAmount": 123,
"contractId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"isLocked": true,
"sentAt": "2023-11-07T05:31:56Z",
"customFields": {
"customField1": "value1",
"customField2": [
"value2",
"value3"
]
}
},
"previousValues": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contractInvoiceSequence": 2,
"invoiceNumber": "ACMEI-0042",
"invoiceDate": "2023-12-25",
"dueDate": "2023-12-25",
"totalAmount": 123,
"contractId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"isLocked": true,
"sentAt": "2023-11-07T05:31:56Z",
"customFields": {
"customField1": "value1",
"customField2": [
"value2",
"value3"
]
}
}
}
}