Batch API
Send up to 100 requests in one API call.
POST
Request Body
requestsarray (required, max 100)endpointstring - API endpoint (e.g. "search", "country/AE")paramsobject - Query parameters for the endpointRequest Example
curl -X POST "https://api.localityapi.com/v1/batch" \
-H "X-API-Key: lapi_your_key" \
-H "Content-Type: application/json" \
-d '{"requests":[{"endpoint":"country/AE","params":{}},{"endpoint":"timezone","params":{"timezone":"Asia/Dubai"}}]}'Response
json
{
"results": [
{"index": 0, "status": 200, "data": {...}},
{"index": 1, "status": 200, "data": {...}}
],
"total": 2,
"successful": 2,
"failed": 0,
"query_ms": 135
}Response Fields
resultsarrayArray of response objectsresults[].indexintegerPosition in original request arrayresults[].statusintegerHTTP status coderesults[].dataobjectResponse data from endpointtotalintegerTotal number of requestssuccessfulintegerNumber of successful requestsfailedintegerNumber of failed requestsquery_msintegerTotal execution time in milliseconds