Skip to content

Ocr Extract Blocks

POST
/ocr/extract_blocks
curl --request POST \
--url https://example.com/ocr/extract_blocks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "image": "example", "model": "example", "variant": "example" }'

Submit an OCR spatial-blocks job and return immediately with a task_id.

Returns per-block text with bounding boxes and confidence scores. Only supported by models with spatial grounding: deepseek-ocr2, paddleocr-vl. Poll GET /ocr/blocks/{task_id} for the result.

Media typeapplication/json
OCRBlocksRequest
object
image
required
Image

Base64-encoded image (JPEG, PNG, or PDF page)

string
model
required
Model

Registered model name — only models with spatial block support: deepseek-ocr2, paddleocr-vl

string
variant
Any of:
string
<= 64 characters
Examplegenerated
{
"image": "example",
"model": "example",
"variant": "example"
}

Successful Response

Media typeapplication/json
OCRBlocksSubmission
object
task_id
required
Task Id

Celery task ID for tracking the OCR blocks job

string
status
Status

Initial status of the task

string
default: queued
Example
{
"status": "queued"
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object
Examplegenerated
{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example",
"input": "example",
"ctx": {}
}
]
}