Updating invoices
Updating invoices can be used for adding attachments and metadata or adjusting the storage period.
The following figure gives a detailed overview of the process for updating invoices based on the Archiving business process.
Step 1: Client Sends JSON to Sovos
The client sends a PATCH request to the /v2/archived-documents/{documentId} endpoint.
To make this request, set the following request body parameters:
| Name | Type | Description |
|---|---|---|
| actionCode | String | Set it to document.archiveUpdate. |
| metadata | Object | Provides more information about the document. |
| attachments | Array | A list of attachments related to the document. |
| fileName | String | The name of the file. |
| mimeType | String | The MIME type of the file. |
| attachmentType | String | The type of attachment. |
| data | String | The content of the attachment. |
| customProperties | Array | A list of custom properties for the document. |
| name | String | The name of the custom property. |
| value | String | The value of the custom property. |
- Request Sample
{ "actionCode": "document.archiveUpdate", "metadata": { "attachments": [ { "fileName": "Test-invoice.xml", "mimeType": "application/xml", "attachmentType": "LegalInvoice", "data": "content of invoice as base64 encoded" } ], "customProperties": [ { "name": "AckDt", "value": "2021-03-17 10:14:07" } ] } }- Response Sample
{ "timestamp": "1699458506", "success": true, "status": 202, "message": "Document Updated", "data": { "transactionId": "string", "documentId": "string" } }
Step 2: Sovos Updates Invoice
Sovos updates the invoice with the new attachments and metadata. The reference id of the invoice remains the same.
Step 3: Sovos Returns Invoice Reference
As part of the response, the client will receive an invoice reference (documentId) related to the specific file that has been updated.
Error Handling
The client must apply the error handling principles that are outlined on the responses page. The responses page also includes a full list of error codes that the API might return.
In general, all error codes in the 400 range are client errors that the client must analyze. After fixing the errors, the client can resend the request. For 408 and 429 errors, the client must wait 60 seconds before resending the request.
Error codes in the 500 range are server errors. The client should resend the request according to the instructions on the responses page.
