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.ingest.batchIngestFiles({
files: [fs.createReadStream('path/to/file')],
});
console.log(response.documents);curl https://api.morphik.ai/ingest/files \
-H 'Content-Type: multipart/form-data' \
-H "Authorization: Bearer $MORPHIK_API_KEY" \
-F files=[null]{
"documents": [
{
"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>"
}
],
"errors": [
{}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Ingestion
Batch Ingest Files
Batch ingest multiple files (async).
Each file is treated the same as :func:ingest_file but sharing the same
request avoids many round-trips. All heavy work is still delegated to the
background worker pool.
POST
/
ingest
/
files
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.ingest.batchIngestFiles({
files: [fs.createReadStream('path/to/file')],
});
console.log(response.documents);curl https://api.morphik.ai/ingest/files \
-H 'Content-Type: multipart/form-data' \
-H "Authorization: Bearer $MORPHIK_API_KEY" \
-F files=[null]{
"documents": [
{
"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>"
}
],
"errors": [
{}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Headers
Body
multipart/form-data
Was this page helpful?

