JavaScript
import Morphik from 'morphik';
const client = new Morphik({
apiKey: process.env['MORPHIK_API_KEY'], // This is the default and can be omitted
});
const response = await client.documents.pages({
document_id: 'document_id',
end_page: 1,
start_page: 1,
});
console.log(response.document_id);curl https://api.morphik.ai/documents/pages \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $MORPHIK_API_KEY" \
-d '{
"document_id": "document_id",
"end_page": 1,
"start_page": 1
}'{
"document_id": "<string>",
"pages": [
"<string>"
],
"start_page": 123,
"end_page": 123,
"total_pages": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Documents
Extract Document Pages
Extract specific pages from a document (PDF, PowerPoint, or Word) as base64-encoded images or URLs. When output_format=“url”, pages that fail URL generation fall back to base64 data URIs (mixed output possible).
POST
/
documents
/
pages
JavaScript
import Morphik from 'morphik';
const client = new Morphik({
apiKey: process.env['MORPHIK_API_KEY'], // This is the default and can be omitted
});
const response = await client.documents.pages({
document_id: 'document_id',
end_page: 1,
start_page: 1,
});
console.log(response.document_id);curl https://api.morphik.ai/documents/pages \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $MORPHIK_API_KEY" \
-d '{
"document_id": "document_id",
"end_page": 1,
"start_page": 1
}'{
"document_id": "<string>",
"pages": [
"<string>"
],
"start_page": 123,
"end_page": 123,
"total_pages": 123
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Headers
Body
application/json
Request model for extracting pages from a document
ID of the document to extract pages from
Starting page number (1-indexed)
Required range:
x >= 1Ending page number (1-indexed)
Required range:
x >= 1How to return page images: base64 (default) or url
Available options:
base64, url Was this page helpful?

