Retrieving invoices
The following diagram gives a detailed overview of the process for retrieving invoices:
Step 1: Client Sends GET Request
A client application can retrieve a stored invoice by sending a GET request to the /v2/archived-documents/{documentId} endpoint.
To make this request, set the following path parameter:
| Name | Type | Required | Description |
|---|---|---|---|
| documentId | string | Yes | The document ID of the invoice as returned by Sovos after it's stored. |
- Request Sample
curl --location --request GET 'https://api-test.sovos.com/v2/archived-documents/{documentId}' \ --header 'Authorization: Bearer TOKEN' \ --header 'Content-Type: application/json' \ --header 'x-correlationId: SET-TO-UNIQUE-VALUE'- Response Sample
{ "status": 200, "message": "OK", "success": true, "timestamp": 1741599245300, "data": { "documentId": "4cc8ea...7a4", "metadata": { "attachments": [ { "fileName": "attachment1.pdf", "mimeType": "application/pdf", "attachmentType": "PDF", "data": "PD94..." }, { "fileName": "attachment2.xml", "mimeType": "application/xml", "attachmentType": "LegalInvoice", "data": "PD94..." } ], "customProperties": [ { "name": "AckDt", "value": "2021-03-17 10:14:07" }, { "name": "p1", "value": "property1" } ] }, "content": { "data": "PD94...", "type": "application/xml", "name": "invoice.xml" } } }
Step 2: Sovos Returns the Invoice (+ Attachments and Metadata)
Sovos returns the archived document shown by a particular documentId, including the invoices, any attachments and metadata.
Error Handling
The client must adhere to the error handling principles, outlined on the responses page.
In general, all error codes in the 400 range are client errors and must be analyzed by the client. After fixing the error, the client can try to resend the request. Error codes 408 and 429 are exceptions, in these cases the client must wait 60 seconds before retrying. The error codes in the 500 range are server errors, in case of such an error, the client should retry sending the request, according to the instructions given on the responses page which also includes a full list of error codes the API can return.
