Skip to main content
Cohere

Search documentation

Type to search this documentation.

Parse API (v2)

POST/v2/parseParse API (v2)

Parse a document image into structured output. Use output_format to select blocks or markdown (default).

Currently supports document.type = image_url only (data URI or remote http(s) image URL). PDF / file URL inputs are not yet supported.

Image limits: 20 MB file size; 50 megapixels or 200 MB decoded (whichever is exceeded first).

Parameters

X-Client-Namestringheader

The name of the project that is making the request.

Request body

required
application/json
object
documentobjectrequired

Document to parse. Currently only `image_url` documents are supported.

Show child attributes
image_urlstringrequired

Image URL or base64 data URI to parse. Limits: - Maximum file size: 20 MB (compressed upload, download, or decoded data-URI payload) - Maximum decoded size: 50 megapixels or 200 MB decompressed (whichever is exceeded first)

typestringrequired

Discriminator for the document payload.

one of "image_url"

modelstringrequired

The name of a compatible Cohere parse model.

output_formatstring

Selects the page payload shape in the response. Defaults to `"markdown"`. - `"markdown"`: each page includes markdown content. Tables are inlined as HTML, and images are referenced as `![<description>](<image_id>)` with matching entries in `page.markdown.images`. - `"blocks"`: each page includes an ordered `blocks` array of text, image, and table content regions, including bounding boxes where available.

one of "blocks", "markdown" · default "markdown"

Example request
{
  "document": {
    "image_url": "string",
    "type": "image_url"
  },
  "model": "string",
  "output_format": "markdown"
}

Responses

200OKapplication/json
objectParseResponse

Response from the v2 parse endpoint.

finish_reasonstring

The reason a chat request has finished. - **complete**: The model finished sending a complete message. - **max_tokens**: The number of generated tokens exceeded the model's context length or the value specified via the `max_tokens` parameter. - **stop_sequence**: One of the provided `stop_sequence` entries was reached in the model's generation. - **tool_call**: The model generated a Tool Call and is expecting a Tool Message in return - **error**: The generation failed due to an internal error - **timeout**: The generation was stopped because it exceeded the allowed time limit.

one of "COMPLETE", "STOP_SEQUENCE", "MAX_TOKENS", "TOOL_CALL", "ERROR", "TIMEOUT"

idstringrequired

Unique identifier for the parse response.

metaobject
Show child attributes
api_versionobject
Show child attributes
is_deprecatedboolean
is_experimentalboolean
versionstringrequired
billed_unitsobject
Show child attributes
classificationsnumber

The number of billed classifications units.

image_tokensnumber

The number of billed image tokens.

imagesnumber

The number of billed images.

input_tokensnumber

The number of billed input tokens.

output_tokensnumber

The number of billed output tokens.

pagesnumber

The number of billed pages parsed.

search_unitsnumber

The number of billed search units.

cached_tokensnumber

The number of prompt tokens that hit the inference cache.

tokensobject
Show child attributes
input_tokensnumber

The number of tokens used as input to the model.

output_tokensnumber

The number of tokens produced by the model.

warningsarray of string
Show child attributes
pagesarray of valuerequired

Parsed pages in document order.

Show child attributes
Show array items

A single parsed page. The payload shape depends on `output_format`.

oneOf · 2 options
Option 1objectParseBlocksPageVariant

A parsed page with structured content blocks.

blocksarray of valuerequired

Ordered content blocks extracted from the page.

Show child attributes
Show array items

A content block on a parsed page.

oneOf · 3 options
Option 1objectParseTextContentBlock

A text content block.

textobjectrequired

Payload for a text block.

Show child attributes
contentstringrequired

Extracted text content.

typestringrequired

one of "text"

Option 2objectParseImageContentBlock

An image content block.

imageobjectrequired

Payload for an image block.

Show child attributes
bounding_boxobjectrequired

A bounding box with pixel coordinates on the source document image.

Show child attributes
bottom_right_xintegerrequired

X coordinate of the bottom-right corner.

bottom_right_yintegerrequired

Y coordinate of the bottom-right corner.

top_left_xintegerrequired

X coordinate of the top-left corner.

top_left_yintegerrequired

Y coordinate of the top-left corner.

bounding_box_normalizedobjectrequired

A bounding box with coordinates in [0, 1] relative to the source page (model coordinates are thousandths of page width/height).

Show child attributes
bottom_right_xnumber · doublerequired

Normalized X coordinate of the bottom-right corner.

bottom_right_ynumber · doublerequired

Normalized Y coordinate of the bottom-right corner.

top_left_xnumber · doublerequired

Normalized X coordinate of the top-left corner.

top_left_ynumber · doublerequired

Normalized Y coordinate of the top-left corner.

categorystringrequired

Image element category.

one of "other", "flowchart", "logo", "signature"

descriptionstringrequired

Model-generated description of the image.

idstringrequired

Unique identifier for the image within the page (for example `img-0`).

typestringrequired

one of "image"

Option 3objectParseTableContentBlock

A table content block.

tableobjectrequired

Payload for a table block.

Show child attributes
bounding_boxobjectrequiredParseBoundingBox ↑

A bounding box with pixel coordinates on the source document image.

bounding_box_normalizedobjectrequiredParseBoundingBoxNormalized ↑

A bounding box with coordinates in [0, 1] relative to the source page (model coordinates are thousandths of page width/height).

descriptionstring

Optional table description when detected.

htmlstringrequired

Table content as HTML.

titlestring

Optional table title when detected.

typestringrequired

Table serialization format.

one of "html"

typestringrequired

one of "table"

indexintegerrequired

Zero-based page index.

typestringrequired

one of "blocks"

Option 2objectParseMarkdownPageVariant

A parsed page with markdown content.

indexintegerrequired

Zero-based page index.

markdownobjectrequired

Markdown output payload for a parsed page.

Show child attributes
contentstringrequired

Page content as markdown. Images are embedded as `![<description>](<image_id>)`. Tables are inlined as HTML.

imagesarray of object

Image metadata referenced from `content`.

Show child attributes
typestringrequired

one of "markdown"

Example response
{
  "finish_reason": "COMPLETE",
  "id": "string",
  "meta": {
    "api_version": {
      "is_deprecated": true,
      "is_experimental": true,
      "version": "string"
    },
    "billed_units": {
      "classifications": 0,
      "image_tokens": 0,
      "images": 0,
      "input_tokens": 0,
      "output_tokens": 0,
      "pages": 0,
      "search_units": 0
    },
    "cached_tokens": 0,
    "tokens": {
      "input_tokens": 0,
      "output_tokens": 0
    },
    "warnings": [
      "string"
    ]
  },
  "pages": [
    {
      "blocks": [
        {
          "image": {
            "bounding_box": {
              "bottom_right_x": 0,
              "bottom_right_y": 0,
              "top_left_x": 0,
              "top_left_y": 0
            },
            "bounding_box_normalized": {
              "bottom_right_x": 0,
              "bottom_right_y": 0,
              "top_left_x": 0,
              "top_left_y": 0
            },
            "category": "flowchart",
            "description": "string",
            "id": "string"
          },
          "type": "image"
        }
      ],
      "index": 0,
      "type": "blocks"
    }
  ]
}
400This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields application/json
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
401This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions application/json
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
403This error indicates that the operation attempted to be performed is not allowed. This could be because: - The api token is invalid - The user does not have the necessary permissions application/json
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
404This error is returned when a resource is not found. This could be because: - The endpoint does not exist - The resource does not exist eg model id, dataset id application/json
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
422This error is returned when the request is not well formed. This could be because: - JSON is invalid - The request is missing required fields - The request contains an invalid combination of fields application/json
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
429Too many requestsapplication/json
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
498This error is returned when a request or response contains a deny-listed token. application/json
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
499This error is returned when a request is cancelled by the user. application/json
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
500This error is returned when an uncategorised internal server error occurs. application/json
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
501This error is returned when the requested feature is not implemented. application/json
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
503This error is returned when the service is unavailable. This could be due to: - Too many users trying to access the service at the same time application/json
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
504This error is returned when a request to the server times out. This could be due to: - An internal services taking too long to respond application/json
object
idstring
messagestring
Example response
{
  "id": "string",
  "message": "string"
}
Documentation menu