curl --request GET \
--url https://api.sailresearch.com/v1/batches/{batch_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sailresearch.com/v1/batches/{batch_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sailresearch.com/v1/batches/{batch_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sailresearch.com/v1/batches/{batch_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sailresearch.com/v1/batches/{batch_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.sailresearch.com/v1/batches/{batch_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sailresearch.com/v1/batches/{batch_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "batch_abc123",
"object": "batch",
"endpoint": "/v1/responses",
"status": "in_progress",
"request_counts": {
"total": 2,
"completed": 1,
"failed": 0
},
"created_at": 1741564800,
"label": "my-batch-job",
"request_status": {
"my-first-request": {
"status": "COMPLETED"
},
"my-second-request": {
"status": "RUNNING"
}
},
"results": null,
"error": null
}Get batch status and results
Poll for batch progress and read inline results once all requests have finished. See Reading the batch response for result handling and Large batches and individual results for limits and retries.
curl --request GET \
--url https://api.sailresearch.com/v1/batches/{batch_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sailresearch.com/v1/batches/{batch_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sailresearch.com/v1/batches/{batch_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sailresearch.com/v1/batches/{batch_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sailresearch.com/v1/batches/{batch_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.sailresearch.com/v1/batches/{batch_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sailresearch.com/v1/batches/{batch_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "batch_abc123",
"object": "batch",
"endpoint": "/v1/responses",
"status": "in_progress",
"request_counts": {
"total": 2,
"completed": 1,
"failed": 0
},
"created_at": 1741564800,
"label": "my-batch-job",
"request_status": {
"my-first-request": {
"status": "COMPLETED"
},
"my-second-request": {
"status": "RUNNING"
}
},
"results": null,
"error": null
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Response
Batch status and counts, with inline results when complete and within the inline size limit.
Unique identifier for the batch.
batch Endpoint used by the requests in this batch.
/v1/responses Completed means every request has finished, including any that failed or were cancelled.
in_progress, completed Progress counts for this batch. The create and list endpoints return request_counts as an integer instead.
Show child attributes
Show child attributes
Unix timestamp of when the batch was created.
Current statuses keyed by custom_id. Status updates may be partial; use the batch status field to decide when it is complete.
Show child attributes
Show child attributes
Results for a completed batch, matched to inputs by custom_id. Null while the batch is in progress or when its results exceed the inline size limit.
Show child attributes
Show child attributes
Null unless inline results are unavailable because the batch exceeds the inline size limit. In that case, code is batch_results_too_large; retrieve results by custom_id.
Show child attributes
Show child attributes
The label for the batch, if provided.