Sovos Docs

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.

Overview process for updating invoices.

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:

NameTypeDescription
actionCodeStringSet it to document.archiveUpdate.
metadataObjectProvides more information about the document.
attachmentsArrayA list of attachments related to the document.
fileNameStringThe name of the file.
mimeTypeStringThe MIME type of the file.
attachmentTypeStringThe type of attachment.
dataStringThe content of the attachment.
customPropertiesArrayA list of custom properties for the document.
nameStringThe name of the custom property.
valueStringThe 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.