Skip to main content
GET
/
v1
/
batches
/
{batch_id}
Poll a batch
curl --request GET \
  --url https://api.hanji.dev/v1/batches/{batch_id} \
  --header 'X-API-KEY: <api-key>'
import requests

url = "https://api.hanji.dev/v1/batches/{batch_id}"

headers = {"X-API-KEY": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {'X-API-KEY': '<api-key>'}};

fetch('https://api.hanji.dev/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.hanji.dev/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 => [
"X-API-KEY: <api-key>"
],
]);

$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.hanji.dev/v1/batches/{batch_id}"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("X-API-KEY", "<api-key>")

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.hanji.dev/v1/batches/{batch_id}")
.header("X-API-KEY", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.hanji.dev/v1/batches/{batch_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "status": "<string>",
  "counts": {
    "pending": 0,
    "running": 0,
    "succeeded": 0,
    "failed": 0,
    "cancelled": 0
  },
  "total_items": 123,
  "engine": "<string>",
  "options": {},
  "created_at": "<string>",
  "expires_at": "<string>",
  "items": [
    {
      "id": "<string>",
      "batch_id": "<string>",
      "file_id": "<string>",
      "position": 123,
      "status": "<string>",
      "attempts": 123,
      "updated_at": "<string>",
      "object": "batch_item",
      "page_count": 123,
      "started_at": "<string>",
      "completed_at": "<string>",
      "result_url": "<string>",
      "error": {}
    }
  ],
  "object": "batch",
  "metadata": {},
  "started_at": "<string>",
  "completed_at": "<string>",
  "next_cursor": "<string>"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}

Authorizations

X-API-KEY
string
header
required

Path Parameters

batch_id
string
required

Query Parameters

cursor
string | null
limit
integer
default:100
Required range: 1 <= x <= 500

Response

Successful Response

id
string
required
status
string
required
counts
BatchCounts · object
required
total_items
integer
required
engine
string | null
required
options
Options · object
required
created_at
string
required
expires_at
string
required
items
BatchItemResource · object[]
required
object
string
default:batch
metadata
Metadata · object | null
started_at
string | null
completed_at
string | null
next_cursor
string | null