Best practices
Follow these best practices 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 the subcodeIMPORT-400-FILING_COMPLETE.Use GET /v1/indirect-tax/vat-filing/filings/{filingId} to confirm the status before calling the import endpoint.
- Uploading files with the uploadURL
-
The
uploadUrlis a time-limited link. Send your PUT request directly to S3, not to the External Partner API. Don't include anAuthorizationheader. The time-limited link carries its own authentication. Adding anAuthorizationheader to the PUT request causes it to fail.If you send a new transaction import for a filing that's still in
Preparationstatus, Sovos deletes the earlier import's data and replaces it with the new import's data. The most recent import is always the source of truth for that filing period. There's no conflict or rejection if you send more than one import for the same filing. - Upload files before the time-limited link expires
-
The
uploadUrlthe API returns when you start an import expires 10 minutes after the API returns it. If you miss this window, start a new import to get a fresh link.Don't store the upload link for later use. Generate the link immediately before you upload, and upload it right away.
- Set the Content-Type header
-
Set the
Content-Typeheader toapplication/jsonand make sure the file size matches themetadata.fileSizevalue you sent in the POST request.
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. If a link has expired, call the result files endpoint again to get a new URL.
Sovos deletes the files for a filing 30 days after you submit it, including import result files. Only the return card stays. To keep copies, download the files before then.
Checking the service status
- How often can I check the service status?
- Wait at least 30 to 60 seconds between checks.
- How long should my client wait for a response?
-
Set a client timeout of about 15 seconds. Treat a timeout or connection error the same as
Unhealthy. - What do I do after a 503 response?
- Wait longer after each failed attempt. This approach is called exponential backoff. Wait five seconds, then 10 seconds, then 30 seconds, then 60 seconds. Don't send filings or imports while the service returns 503.
- Can I send filings or imports while the service returns 503?
- No. Wait until the service stops returning 503.
- What do I do with fields that aren't documented?
- Read only the documented fields and ignore the rest. Sovos may add fields later. Existing fields and values don't change within the same API version.
- Is a 401 response a service outage?
- No. A 401 response means your token is missing, expired, or invalid. Refresh the token and retry. Don't treat it as an outage.
