JavaScript
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.ingest.ingestFile({ file: fs.createReadStream('path/to/file') });
console.log(document.app_id);curl https://api.morphik.ai/ingest/file \
-H 'Content-Type: multipart/form-data' \
-H "Authorization: Bearer $MORPHIK_API_KEY" \
-F 'file=@/path/to/file'{
"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>"
}
]
}Ingestion
Ingest File
Ingest a file asynchronously.
The file is uploaded to object storage, a Document stub is persisted
with status='processing' and a background worker picks up the heavy
parsing / chunking work.
POST
/
ingest
/
file
JavaScript
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.ingest.ingestFile({ file: fs.createReadStream('path/to/file') });
console.log(document.app_id);curl https://api.morphik.ai/ingest/file \
-H 'Content-Type: multipart/form-data' \
-H "Authorization: Bearer $MORPHIK_API_KEY" \
-F 'file=@/path/to/file'{
"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
Body
multipart/form-data
Response
Successful Response
Represents a document stored in the database documents collection
Show child attributes
Show child attributes
Was this page helpful?

