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, use the following path parameter:
| Name | Type | Required | Description |
|---|---|---|---|
| documentId | string | Yes | The document ID of the invoice that Sovos returns after storing it |
- 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
Sovos returns the archived document shown using a specific documentId. This archive includes invoices, attachments, and metadata.
Error handling
When handling errors, the client application must follow the Indirect Tax API's error handling principles, as specified in the error handling documentation.
In general, all error codes in the 400 range are client errors, which you need to analyze. After fixing the error, you can resend the request. Error codes 408 and 429 are exceptions: In these cases, you should wait at least 60 seconds before retrying. Error codes in the 500 range are server errors. In that case, resend the request according to the instructions given on the error handling documentation, which also includes a full list of error codes Indirect Tax API can return.
