Best practices
Follow these recommendations to avoid common problems when working with the External Partner API.
Data upload
- Check filing status before importing
-
Before you start a transaction import, check that the target filing has a
Preparationstatus. Filings in theIn ProgressorCompletestatus don't accept imports. If the filing isComplete, the API returns a 400 error with subcodeIMPORT-400-FILING_COMPLETE.Use GET /v1/indirect-tax/vat-filing/filings/{filingId} to confirm the status before calling the import endpoint.
- Upload files before the time-limited URL expires
-
The upload URL the API returns when you start an import expires 10 minutes after the API returns it. If you miss the window, start a new import to get a fresh URL.
Don't store the upload URL for later use. Generate the URL immediately before you upload, and upload it right away.
- Send the file upload directly to S3
-
The
uploadUrlis a time-limited URL. You must send yourPUTrequest directly to that URL, not to the Sovos API.Don't include an
Authorizationheader in thePUTrequest. The time-limited URL carries its own authentication. Adding anAuthorizationheader causes the request to fail.Set the
Content-Typeheader toapplication/jsonand make sure the file size matches themetadata.fileSizevalue you sent in thePOSTrequest.
Processing and monitoring
After you upload your file, poll GET /v1/indirect-tax/vat-filing/transactions/imports/{importId} every 30 seconds to check the import status. Keep polling until the status reaches COMPLETED or FAILED.
Result files
Download URLs for result files expire 10 minutes after the API returns them. Each file has its own accessUrl and expirationDate. Check the expiration date before downloading, and call the result files endpoint again if a URL has expired.
Sovos deletes filing result files 30 days after the filing reaches Complete. Download and store any filing result files you need before that window closes.
The 30-day deletion window applies to all filing-related data after reaching Complete. Confirm with Sovos whether the same window applies to import result files.
Date formatting
The API uses two date formats, and mixing them up causes silent failures.
Use
YYYY-MM-DD(UTC) for filing period fields and date filter parameters:startDate,endDate, anddueDate.Use Unix epoch milliseconds (a 64-bit integer) for timestamp fields: The envelope
timestampand time-limited URLexpirationDatefields.
Using the wrong format for date filter parameters returns an empty result instead of an error. Using the wrong format for timestamp fields causes upload failures.
For more details, see Date and timestamps.
Error handling and resilience
- Handle errors with status codes and subcodes
-
Use a two-step approach when a request fails. First, check the
statusfield to identify the category of the problem. Then checkerrors[].subCodeto identify the specific cause and decide how to handle it in your code.The
subCodevalues are stable across API versions, so use them in your error-handling logic. Use themessagefield for logging and debugging only. For the full list of subcodes, see Error handling. - Retry 500 errors with exponential backoff
-
Any endpoint can return a 500 error when an unexpected upstream failure occurs. These errors aren't caused by your request. Retry with exponential backoff.
If the problem persists, contact Sovos support and include the
uuidfrom the error response. Sovos uses this value to trace the call. - Refresh your token before it expires
-
Every request requires a valid Bearer token in the
Authorizationheader. A missing, invalid, or expired token returns a 401 error.Build token refresh into your integration so requests don't fail mid-workflow. If you get a 403 instead, your token is valid but doesn't have permission for the resource or operation. Check your OAuth scope and company context. For more information, see Authentication.
