Skip to main content
POST
/
documents
/
{document_id}
/
update_text
JavaScript
import Morphik from 'morphik';

const client = new Morphik({
  apiKey: 'My API Key',
});

const document = await client.documents.updateText('document_id', { content: 'content' });

console.log(document.app_id);
{
  "external_id": "<string>",
  "content_type": "<string>",
  "filename": "<string>",
  "metadata": {},
  "metadata_types": {},
  "storage_info": {},
  "storage_files": [
    {
      "bucket": "<string>",
      "key": "<string>",
      "version": 1,
      "filename": "<string>",
      "content_type": "<string>",
      "timestamp": "2023-11-07T05:31:56Z"
    }
  ],
  "system_metadata": {},
  "additional_metadata": {},
  "chunk_ids": [
    "<string>"
  ],
  "folder_name": "<string>",
  "end_user_id": "<string>",
  "app_id": "<string>"
}

Headers

authorization
string

Path Parameters

document_id
string
required

Query Parameters

update_strategy
string
default:add

Body

application/json

Request model for ingesting text content

content
string
required

Raw text content to store as a document.

filename
string | null

Optional filename hint used when inferring MIME type or displaying the document.

metadata
object

User-defined metadata stored with the document (JSON-serializable).

metadata_types
object | null

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.

use_colpali
boolean | null

When provided, uses Morphik's finetuned ColPali style embeddings (recommended to be True for high quality retrieval).

folder_name
string | null

Optional folder scope for the operation

end_user_id
string | null

Optional end-user scope for the operation

Response

Successful Response

Represents a document stored in the database documents collection

content_type
string
required
external_id
string
filename
string | null
metadata
object
metadata_types
object
storage_info
object
storage_files
StorageFileInfo · object[]
system_metadata
object
additional_metadata
object
chunk_ids
string[]
folder_name
string | null
end_user_id
string | null
app_id
string | null