Headers
Body
multipart/form-data
import Morphik from 'morphik';
const client = new Morphik({
apiKey: 'My API Key',
});
const response = await client.ingest.batchIngestFiles({ files: [fs.createReadStream('path/to/file')] });
console.log(response.documents);{
"documents": [
{
"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>"
}
],
"errors": [
{}
]
}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.
import Morphik from 'morphik';
const client = new Morphik({
apiKey: 'My API Key',
});
const response = await client.ingest.batchIngestFiles({ files: [fs.createReadStream('path/to/file')] });
console.log(response.documents);{
"documents": [
{
"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>"
}
],
"errors": [
{}
]
}Was this page helpful?