Skip to content

HTTP API

Read the text

GET
/v1/documents/{document_id}/chunks
curl --request GET \
--url 'https://sergo.example.com/v1/documents/example/chunks?page=1' \
--header 'Authorization: Bearer <token>'

The chunks that start on one page, in order — the text search looks in. To read the whole document, go page by page up to page_count.

document_id
required
Document Id
string
page
Page

Page number, from 1. Files without pages of their own have estimated pages

integer
default: 1

Page number, from 1. Files without pages of their own have estimated pages

Successful Response

Media typeapplication/json
Chunks
object
page
required
Page

The page these chunks start on

integer
page_count
required
Page Count
integer
chunk_count
required
Chunk Count

Chunks in the whole document

integer
offset
required
Offset

Chunks before this page

integer
pages_to_view
required
Pages To View

Pages whose text may miss a figure, chart or table

Array<integer>
default:
pages_estimated
required
Pages Estimated

The page numbers are estimates

boolean
items
required
Items
Array<object>
ChunkItem
object
seq
required
Seq

Its place in the document, from 0

integer
page
required
Page

The page it starts on

Any of:
integer
char_count
required
Char Count
integer
text
required
Text

The text, in Markdown

string
heading
required
Heading

The heading of its section, in Word files

Any of:
string

Example

{
"pages_to_view": [],
"pages_estimated": false
}

Validation Error

Media typeapplication/json
RequestError
object
code
required
Code
string
Allowed value: invalid_request
message
required
Message

What was wrong, field by field

string

Example

{
"code": "invalid_request"
}