import Morphik from 'morphik';
const client = new Morphik({
apiKey: process.env['MORPHIK_API_KEY'], // This is the default and can be omitted
});
const document = await client.documents.updateText('document_id', { content: 'content' });
console.log(document.app_id);curl https://api.morphik.ai/documents/$DOCUMENT_ID/update_text \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $MORPHIK_API_KEY" \
-d '{
"content": "content"
}'{
"content_type": "<string>",
"external_id": "<string>",
"filename": "<string>",
"metadata": {},
"metadata_types": {},
"storage_info": {},
"system_metadata": {},
"additional_metadata": {},
"chunk_ids": [
"<string>"
],
"summary_storage_key": "<string>",
"summary_version": 123,
"summary_bucket": "<string>",
"summary_updated_at": "<string>",
"folder_name": "<string>",
"end_user_id": "<string>",
"app_id": "<string>",
"folder_path": "<string>",
"folder_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Update Document Text
Update a document by replacing its text content and queueing re-ingestion.
import Morphik from 'morphik';
const client = new Morphik({
apiKey: process.env['MORPHIK_API_KEY'], // This is the default and can be omitted
});
const document = await client.documents.updateText('document_id', { content: 'content' });
console.log(document.app_id);curl https://api.morphik.ai/documents/$DOCUMENT_ID/update_text \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $MORPHIK_API_KEY" \
-d '{
"content": "content"
}'{
"content_type": "<string>",
"external_id": "<string>",
"filename": "<string>",
"metadata": {},
"metadata_types": {},
"storage_info": {},
"system_metadata": {},
"additional_metadata": {},
"chunk_ids": [
"<string>"
],
"summary_storage_key": "<string>",
"summary_version": 123,
"summary_bucket": "<string>",
"summary_updated_at": "<string>",
"folder_name": "<string>",
"end_user_id": "<string>",
"app_id": "<string>",
"folder_path": "<string>",
"folder_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Headers
Path Parameters
Body
Request model for ingesting text content
Raw text content to store as a document.
Optional filename hint used when inferring MIME type or displaying the document.
User-defined metadata stored with the document (JSON-serializable).
Optional per-field type hints: 'string', 'number', 'decimal', 'datetime', 'date', 'boolean', 'array', 'object'. Enables typed comparisons with $eq, $gt, etc. Types are inferred if omitted.
Show child attributes
Show child attributes
When provided, uses Morphik's finetuned ColPali style embeddings (recommended to be True for high quality retrieval).
Optional folder scope for the operation
Optional end-user scope for the operation
Response
Successful Response
Represents a document stored in the database documents collection
Show child attributes
Show child attributes
Was this page helpful?

