LocalityAPI
Get API Key

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 endpoint

Request 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 objects
results[].indexintegerPosition in original request array
results[].statusintegerHTTP status code
results[].dataobjectResponse data from endpoint
totalintegerTotal number of requests
successfulintegerNumber of successful requests
failedintegerNumber of failed requests
query_msintegerTotal execution time in milliseconds