Pages API
Endpoints for page retrieval, text and tag updates, extraction triggers, and workflow status.
Pages represent individual pages within an artifact (document). Each page carries extracted text, compound mentions, NER tags, and a summary. Most page data is populated automatically by the extraction pipeline, but endpoints exist for manual updates and re-triggering workflows.
Get Page
GET /pages/{page_id}Returns the full page read model including text content, compound mentions, tag mentions, summary, and metadata. Requires view permission on the parent artifact.
Response fields include:
| Field | Description |
|---|---|
page_id | Unique page identifier |
artifact_id | Parent artifact ID |
index | Page number within the artifact (0-based) |
text_mention | Extracted text content |
compound_mentions | OCSR-extracted chemical structures |
tag_mentions | NER-extracted named entities with types |
summary_candidate | LLM-generated page summary |
Create Page
POST /pages/
Content-Type: application/json{
"artifact_id": "artifact-uuid",
"index": 0
}Returns 201 Created. In normal operation, pages are created automatically during artifact processing. This endpoint exists for manual page management.
Update Text
PATCH /pages/{page_id}/text_mention
Content-Type: application/json{
"text": "The extracted text content of this page...",
"model_name": "pymupdf",
"date_extracted": "2026-03-29T00:00:00Z"
}This fires Page.TextMentionUpdated, which triggers the embedding and NER pipelines.
Update Tags
PATCH /pages/{page_id}/tag_mentions
Content-Type: application/json[
{"tag": "NadD", "entity_type": "target"},
{"tag": "SACC-111", "entity_type": "compound"},
{"tag": "tuberculosis", "entity_type": "disease"}
]Update Summary
PATCH /pages/{page_id}/summary_candidate
Content-Type: application/json{
"summary": "This page presents IC50 measurements for...",
"model_name": "manual",
"is_locked": true
}Add Compound Mentions
POST /pages/{page_id}/compound_mentions
Content-Type: application/json{
"page_id": "page-uuid",
"compound_mentions": [
{
"smiles": "CC(=O)Oc1ccccc1C(=O)O",
"extracted_id": "SACC-111",
"confidence": 0.95
}
]
}The page_id in the body must match the path parameter. This fires Page.CompoundMentionsUpdated, triggering SMILES embedding.
Trigger Workflows
All trigger endpoints return 202 Accepted with a WorkflowStartedResponse containing the workflow ID. Re-triggering is safe due to ALLOW_DUPLICATE reuse policies.
Embedding Generation
POST /pages/{page_id}/embeddings/generateStarts the text embedding Temporal workflow. Requires the page to have text content.
Compound Extraction
POST /pages/{page_id}/compounds/extractStarts the OCSR ML pipeline (YOLO + DECIMER) to extract chemical structures from the page image.
SMILES Embedding
POST /pages/{page_id}/compounds/embedStarts the ChemBERTa embedding workflow for the page's compounds. Requires extracted compounds with valid canonical SMILES.
Summarization
POST /pages/{page_id}/summarizeStarts the LLM page summarization workflow. Locked summaries (human corrections) are preserved.
NER Extraction
POST /pages/{page_id}/ner/extractStarts the named-entity recognition workflow. Extracts compounds, targets, diseases, genes, and other entities from the page text.
Get Summary
GET /pages/{page_id}/summaryReturns the page summary with metadata:
{
"entity_id": "page-uuid",
"summary": "This page describes...",
"model_name": "gemma3:27b",
"date_extracted": "2026-03-29T12:00:00",
"is_locked": false,
"hil_correction": null
}Returns 404 if the page has no summary yet.
Get Workflow Statuses
GET /pages/{page_id}/workflowsProxies to Temporal to return the current status of all page-level workflows: embedding, compound extraction, SMILES embedding, summarization, and NER extraction.
{
"entity_id": "page-uuid",
"workflows": {
"text-embedding-{page_id}": {"status": "COMPLETED", "...": "..."},
"compound-extraction-{page_id}": {"status": "RUNNING", "...": "..."}
}
}Delete Page
DELETE /pages/{page_id}Returns 204 No Content. Requires edit permission on the parent artifact.