Create a batch
curl --request POST \
--url https://api.hanji.dev/v1/batches \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"source": {
"file_ids": [
"<string>"
],
"type": "files"
},
"engine": "<string>",
"extract_text": true,
"extract_images": true,
"ocr": "auto",
"table_output_format": "markdown",
"metadata": {}
}
'import requests
url = "https://api.hanji.dev/v1/batches"
payload = {
"source": {
"file_ids": ["<string>"],
"type": "files"
},
"engine": "<string>",
"extract_text": True,
"extract_images": True,
"ocr": "auto",
"table_output_format": "markdown",
"metadata": {}
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source: {file_ids: ['<string>'], type: 'files'},
engine: '<string>',
extract_text: true,
extract_images: true,
ocr: 'auto',
table_output_format: 'markdown',
metadata: {}
})
};
fetch('https://api.hanji.dev/v1/batches', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source' => [
'file_ids' => [
'<string>'
],
'type' => 'files'
],
'engine' => '<string>',
'extract_text' => true,
'extract_images' => true,
'ocr' => 'auto',
'table_output_format' => 'markdown',
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hanji.dev/v1/batches"
payload := strings.NewReader("{\n \"source\": {\n \"file_ids\": [\n \"<string>\"\n ],\n \"type\": \"files\"\n },\n \"engine\": \"<string>\",\n \"extract_text\": true,\n \"extract_images\": true,\n \"ocr\": \"auto\",\n \"table_output_format\": \"markdown\",\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hanji.dev/v1/batches")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {\n \"file_ids\": [\n \"<string>\"\n ],\n \"type\": \"files\"\n },\n \"engine\": \"<string>\",\n \"extract_text\": true,\n \"extract_images\": true,\n \"ocr\": \"auto\",\n \"table_output_format\": \"markdown\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hanji.dev/v1/batches")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": {\n \"file_ids\": [\n \"<string>\"\n ],\n \"type\": \"files\"\n },\n \"engine\": \"<string>\",\n \"extract_text\": true,\n \"extract_images\": true,\n \"ocr\": \"auto\",\n \"table_output_format\": \"markdown\",\n \"metadata\": {}\n}"
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>",
"object": "batch",
"metadata": {},
"started_at": "<string>",
"completed_at": "<string>"
}{
"error": "file_not_found",
"file_ids": [
"file_abc123"
]
}{
"error": "file_not_uploaded",
"file_ids": [
"file_abc123"
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Async batch
Create a batch
Submit uploaded files as one batch job. Returns immediately with status: "pending"; poll GET /v1/batches/{batch_id} for per-item progress. Pass an Idempotency-Key header to make retries safe: the same key within 3 days returns the same batch instead of creating a duplicate.
POST
/
v1
/
batches
Create a batch
curl --request POST \
--url https://api.hanji.dev/v1/batches \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"source": {
"file_ids": [
"<string>"
],
"type": "files"
},
"engine": "<string>",
"extract_text": true,
"extract_images": true,
"ocr": "auto",
"table_output_format": "markdown",
"metadata": {}
}
'import requests
url = "https://api.hanji.dev/v1/batches"
payload = {
"source": {
"file_ids": ["<string>"],
"type": "files"
},
"engine": "<string>",
"extract_text": True,
"extract_images": True,
"ocr": "auto",
"table_output_format": "markdown",
"metadata": {}
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source: {file_ids: ['<string>'], type: 'files'},
engine: '<string>',
extract_text: true,
extract_images: true,
ocr: 'auto',
table_output_format: 'markdown',
metadata: {}
})
};
fetch('https://api.hanji.dev/v1/batches', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source' => [
'file_ids' => [
'<string>'
],
'type' => 'files'
],
'engine' => '<string>',
'extract_text' => true,
'extract_images' => true,
'ocr' => 'auto',
'table_output_format' => 'markdown',
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hanji.dev/v1/batches"
payload := strings.NewReader("{\n \"source\": {\n \"file_ids\": [\n \"<string>\"\n ],\n \"type\": \"files\"\n },\n \"engine\": \"<string>\",\n \"extract_text\": true,\n \"extract_images\": true,\n \"ocr\": \"auto\",\n \"table_output_format\": \"markdown\",\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hanji.dev/v1/batches")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {\n \"file_ids\": [\n \"<string>\"\n ],\n \"type\": \"files\"\n },\n \"engine\": \"<string>\",\n \"extract_text\": true,\n \"extract_images\": true,\n \"ocr\": \"auto\",\n \"table_output_format\": \"markdown\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hanji.dev/v1/batches")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": {\n \"file_ids\": [\n \"<string>\"\n ],\n \"type\": \"files\"\n },\n \"engine\": \"<string>\",\n \"extract_text\": true,\n \"extract_images\": true,\n \"ocr\": \"auto\",\n \"table_output_format\": \"markdown\",\n \"metadata\": {}\n}"
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>",
"object": "batch",
"metadata": {},
"started_at": "<string>",
"completed_at": "<string>"
}{
"error": "file_not_found",
"file_ids": [
"file_abc123"
]
}{
"error": "file_not_uploaded",
"file_ids": [
"file_abc123"
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Headers
Body
application/json
Show child attributes
Show child attributes
Maximum string length:
64Deprecated. Accepted for backward compatibility but currently has no effect.
Available options:
auto, never, force How table chunks are structured in each item's result. 'markdown' (default) keeps the existing markdown-derived cells; 'cell_grid' returns true per-cell bounding boxes on table chunks.
Available options:
markdown, cell_grid Response
Successful Response
Show child attributes
Show child attributes
⌘I