Skip to main content
POST
/
v1
/
async
/
ocr
Error
A valid request URL is required to generate request examples
{
  "id": "<string>",
  "status": "pending",
  "created_at": "2023-11-07T05:31:56Z",
  "expires_at": "2023-11-07T05:31:56Z",
  "completed_at": "2023-11-07T05:31:56Z",
  "status_code": 123,
  "result": "<unknown>",
  "error": {
    "event_id": "<string>",
    "type": "<string>",
    "is_bifrost_error": true,
    "status_code": 123,
    "error": {
      "type": "<string>",
      "code": "<string>",
      "message": "<string>",
      "param": "<string>",
      "event_id": "<string>"
    },
    "extra_fields": {
      "provider": "openai",
      "model_requested": "<string>",
      "request_type": "<string>"
    }
  }
}

Authorizations

Authorization
string
header
required

Bearer token authentication. Use your provider API key or Bifrost authentication token. Virtual keys (prefixed with sk-bf-) can also be passed here.

Headers

x-bf-async-job-result-ttl
integer
default:3600

Time-to-live in seconds for the job result after completion. Defaults to 3600 (1 hour). After expiry, the job result is automatically cleaned up.

Body

application/json
model
string
required

Model in provider/model format

Example:

"mistral/mistral-ocr-latest"

document
object
required
id
string

Optional unique identifier for the request

fallbacks
string[]

Fallback models in provider/model format

include_image_base64
boolean

Whether to include base64-encoded images in the response

pages
integer[]

Specific page indices to process (0-based)

Required range: x >= 0
image_limit
integer

Maximum number of images to extract per page

Required range: x >= 1
image_min_size
integer

Minimum image size in pixels to extract

Required range: x >= 1
table_format
string

Format for extracted tables (e.g., "markdown", "html")

extract_header
boolean

Whether to extract page headers

Whether to extract page footers

confidence_scores_granularity
enum<string>

Granularity of confidence scores to include in the response

Available options:
page,
block,
word,
document
bbox_annotation_format
object

Format for bounding box annotations. Supports text, json_object, and json_schema modes.

document_annotation_format
object

Format for document-level annotations. Supports text, json_object, and json_schema modes.

document_annotation_prompt
string

Custom prompt for document annotation

Response

Job accepted for processing

Response returned when creating or polling an async job

id
string
required

Unique identifier for the async job

status
enum<string>
required

The status of an async job

Available options:
pending,
processing,
completed,
failed
created_at
string<date-time>
required

When the job was created

expires_at
string<date-time>

When the job result expires and will be cleaned up

completed_at
string<date-time>

When the job completed (successfully or with failure)

status_code
integer

HTTP status code of the completed operation

result
any

The result of the completed operation (shape depends on the request type)

error
object

Error response from Bifrost