Searching for invoices
The following diagram gives a detailed overview of the process for searching invoices:
Step 1: Client Sends GET Request
You can search the archive for invoice references and related data using filters. To retrieve a stored invoice, send a GET request to the /v2/archived-documents endpoint.
To make this request, use the following query parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| documentNumber | string | No | The document number | |
| documentDate | string | No | The document date | |
| supplierName | string | No | The supplier's name | |
| supplierAuthority | string | No | The supplier's countryCode |
|
| supplierIdentifier | string | No | The supplier's tax ID | |
| buyerName | string | No | The buyer's name | |
| buyerAuthority | string | No | The buyer's countryCode |
|
| buyerIdentifier | string | No | The buyer's tax ID | |
| page | integer | No | 1 | The page to be returned |
| perPage | integer | No | 10 | The maximum number of hits to be included in the result |
- Request Sample
-
CODE
curl --location --request GET 'https://api-test.sovos.com/v2/archived-documents?documentNumber=240&documentDate=2021-06-16&supplierName=EARCHIVINGQATEST&supplierAuthority=IN&supplierIdentifier=123456789&buyerName=EARCHIVINGQATEST&buyerAuthority=IN&buyerIdentifier=123456789&page=1&perPage=50' \ --header 'Authorization: Bearer TOKEN' \ --header 'x-correlationId: SET-TO-UNIQUE-VALUE' - Response Sample
-
JSON
{ "timestamp": "1699458506", "success": true, "status": 200, "message": "Documents Listed", "data": { "pageState": { "page": 1, "perPage": 50, "totalEntries": 2, "totalPages": 1 }, "items": [ { "documentId": "c259cda4f9a6d007a5e1bd3cd3fd656d" }, { "documentId": "12312424fewfsd07a5e1bd3cd3fd656d" } ] } }
Step 2: Sovos Returns Invoice (+ Attachments and Metadata)
As a response, Sovos returns the list of references of the documents that were initially sent to Sovos.
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.
