Perform document extraction inference on the service

Auth

Extract the content of documents, such as PDFs or images of documents, into a textual format.

Required privileges

Cluster privileges monitor_inference

Path parameters

inference_id string required

The unique identifier for the inference endpoint.

Query parameters

timeout string · default: 120s

The amount of time to wait for the inference request to complete.

Request body

input union oneOf required

The documents to extract the content from. Either a content object or an array of content objects.

content object example:

"input": {
  "content": {
    "type": "pdf",
    "format": "base64",
    "value": "data:application/pdf;base64,..."
  }
}
		

content object array example:

"input": [
  {
    "content": {
      "type": "pdf",
      "format": "base64",
      "value": "data:application/pdf;base64,..."
    }
  },
  {
    "content": {
      "type": "image",
      "format": "url",
      "value": "https://example.com/scanned-page.png"
    }
  }
]
		
object or object[]
content object required

The document to extract the content from.

type enum required

The type of the document. Not all services and models support all types.

Values: image pdf html
format enum

The format of the document. If not specified, this defaults to base64 for pdf and image, and url for html. The html type supports url only. Not all services and models support all formats.

Values: base64 url
value string required

The value of the document. For the base64 format, this must be a base64-encoded data URI, that is, "data:content/type;base64,...". For the url format, this must be a URL that points to the document, that is, "https://example.com/document.pdf".

task_settings object

Task settings for the individual inference request. These settings are specific to the task type you specified and override the task settings specified when initializing the service.

output_format enum

The output format of the extracted content. Only markdown is supported.

Values: markdown
parameters map string to object

A free-form object of extraction options that is forwarded to the Elastic Inference Service as-is. The accepted parameters are defined by the Elastic Inference Service.

Response

application/json
document_extraction object[] required
content string required

The content extracted from the document.

format string required

The format of the extracted content, for example markdown.

metadata object

Additional information about the document, such as its title. The available fields depend on the service and model.