HTTP API
Get a page
GET
/v1/documents/{document_id}/pages/{page}
const url = 'https://sergo.example.com/v1/documents/example/pages/1?format=png';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://sergo.example.com/v1/documents/example/pages/1?format=png' \ --header 'Authorization: Bearer <token>'One page as a PNG picture, or as a one-page PDF. Works for PDFs and for Office files with a PDF copy. The X-Page-Count header gives the number of pages.
404 page_view_pending while the PDF copy is being made, 404 no_page_view when the file has none, 422 page_out_of_range past the last page.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”document_id
required
Document Id
string
page
required
Page
Page number, from 1
integer
Page number, from 1
Query Parameters
Section titled “Query Parameters”format
Format
png for a picture, pdf for a one-page PDF
string
png for a picture, pdf for a one-page PDF
Responses
Section titled “Responses”The page
Headers
Section titled “Headers”X-Page-Count
integer
Pages in the document
Validation Error
Media typeapplication/json
RequestError
object
code
required
Code
string
message
required
Message
What was wrong, field by field
string
Example
{ "code": "invalid_request"}