Handling Partial Batch Failures: A Robust Integration Approach
When building high-volume data pipelines, developers often use the /api/v1/batch-check endpoint to submit up to 100 E.164-formatted identifiers in a single synchronous HTTP request. While this approach optimizes throughput, a successful HTTP response does not guarantee that every individual identifier was resolved. To maintain data integrity, your integration must treat the response as a collection of individual outcomes rather than a single global result.
Parsing the Batch Response Envelope
The batch endpoint returns an envelope containing total, succeeded, and failed counts. A common pitfall is assuming that a successful HTTP response implies all identifiers are resolved. Instead, you must iterate through the results array and inspect the exists boolean for each record:
exists: true: The service successfully determined the registration status. You can safely access the registered boolean to update your downstream database.
exists: false: The service could not determine the status for this specific identifier. In this case, the registered field will not be present.
Crucial: Do not treat an exists: false record as a negative registration result. Mapping missing data to a false value will "poison" your database with inaccurate information. Always verify exists before reading the registered field.
Troubleshooting Integration Symptoms
Use the following diagnostic steps to handle common API behaviors and errors:
| Symptom |
Diagnostic Step |
Remediation |
failed count > 0 |
Iterate through the results array and filter by exists: false. |
Log these specific identifiers for review; do not assume they are unregistered. |
| HTTP 50400 |
The entire batch exceeded the 150s timeout. |
The batch failed as a whole and no records were charged. Implement a retry mechanism with a non-aggressive backoff. |
| HTTP 42901 |
All five in-flight request slots are occupied. |
The request was rejected before processing. Wait for your current in-flight requests to complete before submitting a new batch. |
| HTTP 42200 |
Upstream could not determine a specific number. |
No data is returned for the affected record and no charge is applied. |
Ensuring Data Integrity
- Atomic Processing: While the batch is submitted as a single unit, process the
results array as individual outcomes. Only commit data to your database when exists is true.
- Monitor Response Codes: Always check the
code field in the response envelope. If the code is non-zero, the request did not complete as intended. Consult the official API documentation for specific error code definitions to determine if a retry is appropriate.
- Respect Concurrency: The service processes batches in groups of 10 concurrently. Ensure your application respects the documented concurrency limits to avoid 42901 rejections.
By implementing these validation checks, you ensure that your integration remains resilient to partial failures and maintains high data quality in your downstream systems.
Handling Partial Batch Failures: A Robust Integration Approach
When building high-volume data pipelines, developers often use the
/api/v1/batch-checkendpoint to submit up to 100 E.164-formatted identifiers in a single synchronous HTTP request. While this approach optimizes throughput, a successful HTTP response does not guarantee that every individual identifier was resolved. To maintain data integrity, your integration must treat the response as a collection of individual outcomes rather than a single global result.Parsing the Batch Response Envelope
The batch endpoint returns an envelope containing
total,succeeded, andfailedcounts. A common pitfall is assuming that a successful HTTP response implies all identifiers are resolved. Instead, you must iterate through theresultsarray and inspect theexistsboolean for each record:exists: true: The service successfully determined the registration status. You can safely access theregisteredboolean to update your downstream database.exists: false: The service could not determine the status for this specific identifier. In this case, theregisteredfield will not be present.Crucial: Do not treat an
exists: falserecord as a negative registration result. Mapping missing data to afalsevalue will "poison" your database with inaccurate information. Always verifyexistsbefore reading theregisteredfield.Troubleshooting Integration Symptoms
Use the following diagnostic steps to handle common API behaviors and errors:
failedcount > 0resultsarray and filter byexists: false.Ensuring Data Integrity
resultsarray as individual outcomes. Only commit data to your database whenexistsistrue.codefield in the response envelope. If the code is non-zero, the request did not complete as intended. Consult the official API documentation for specific error code definitions to determine if a retry is appropriate.By implementing these validation checks, you ensure that your integration remains resilient to partial failures and maintains high data quality in your downstream systems.