Python
import os
from meibel import MeibelClient
client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])
with open("quarterly_report.pdf", "rb") as file:
result = client.datasources.file_uploads.upload_and_list_content(
datasource_id="ds_8f3a1c2e9b",
file=file,
)
print(f"Uploaded to datasource: {result.datasource_id}")
for item in result.items:
print(f"{item.name} ({item.size} bytes, {item.media_type})")import { MeibelClient } from "meibel";
import fs from "fs";
const client = new MeibelClient({ apiKey: process.env.MEIBEL_API_KEY });
const response = await client.datasources.fileUploads.uploadAndListContent({
datasourceId: "ds_8f3a1c2b9e",
file: fs.createReadStream("./reports/q3-financials.pdf"),
triggerIngest: true,
});
console.log(`Uploaded to datasource: ${response.datasourceId}`);
response.items.forEach((item) => {
console.log(`${item.name} (${item.size} bytes, ${item.mediaType})`);
});package main
import (
"context"
"fmt"
"os"
v2 "github.com/meibel-ai/meibel-go/v2"
)
func main() {
client := v2.NewClient(v2.WithAPIKey(os.Getenv("MEIBEL_API_KEY")))
resp, err := client.Datasources.FileUploads.UploadAndListContent(
context.Background(),
"ds_9f8a7b6c5d4e",
v2.BodyUploadAndListContent{},
)
if err != nil {
panic(err)
}
for _, item := range resp.Items {
fmt.Printf("%s (%d bytes)\n", item.Name, *item.Size)
}
}curl --request POST \
--url https://api.meibel.ai/v2/datasources/{datasource_id}/content/process \
--header 'Content-Type: multipart/form-data' \
--header 'Meibel-API-Key: <api-key>' \
--form 'files=<string>' \
--form files.items='@example-file'const form = new FormData();
form.append('files', '<string>');
form.append('files.items', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {'Meibel-API-Key': '<api-key>'}};
options.body = form;
fetch('https://api.meibel.ai/v2/datasources/{datasource_id}/content/process', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.meibel.ai/v2/datasources/{datasource_id}/content/process",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data; boundary=---011000010111000001101001",
"Meibel-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.meibel.ai/v2/datasources/{datasource_id}/content/process")
.header("Meibel-API-Key", "<api-key>")
.header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meibel.ai/v2/datasources/{datasource_id}/content/process")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Meibel-API-Key"] = '<api-key>'
request["Content-Type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"datasource_id": "<string>",
"items": [
{
"name": "<string>",
"path": "<string>",
"type": "<string>",
"size": 123,
"media_type": "<string>",
"last_modified": "<string>",
"etag": "<string>"
}
],
"continuation_token": "<string>",
"ingest_url": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}File uploads
Upload Content (sync)
POST
/
datasources
/
{datasource_id}
/
content
/
process
Python
import os
from meibel import MeibelClient
client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])
with open("quarterly_report.pdf", "rb") as file:
result = client.datasources.file_uploads.upload_and_list_content(
datasource_id="ds_8f3a1c2e9b",
file=file,
)
print(f"Uploaded to datasource: {result.datasource_id}")
for item in result.items:
print(f"{item.name} ({item.size} bytes, {item.media_type})")import { MeibelClient } from "meibel";
import fs from "fs";
const client = new MeibelClient({ apiKey: process.env.MEIBEL_API_KEY });
const response = await client.datasources.fileUploads.uploadAndListContent({
datasourceId: "ds_8f3a1c2b9e",
file: fs.createReadStream("./reports/q3-financials.pdf"),
triggerIngest: true,
});
console.log(`Uploaded to datasource: ${response.datasourceId}`);
response.items.forEach((item) => {
console.log(`${item.name} (${item.size} bytes, ${item.mediaType})`);
});package main
import (
"context"
"fmt"
"os"
v2 "github.com/meibel-ai/meibel-go/v2"
)
func main() {
client := v2.NewClient(v2.WithAPIKey(os.Getenv("MEIBEL_API_KEY")))
resp, err := client.Datasources.FileUploads.UploadAndListContent(
context.Background(),
"ds_9f8a7b6c5d4e",
v2.BodyUploadAndListContent{},
)
if err != nil {
panic(err)
}
for _, item := range resp.Items {
fmt.Printf("%s (%d bytes)\n", item.Name, *item.Size)
}
}curl --request POST \
--url https://api.meibel.ai/v2/datasources/{datasource_id}/content/process \
--header 'Content-Type: multipart/form-data' \
--header 'Meibel-API-Key: <api-key>' \
--form 'files=<string>' \
--form files.items='@example-file'const form = new FormData();
form.append('files', '<string>');
form.append('files.items', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {'Meibel-API-Key': '<api-key>'}};
options.body = form;
fetch('https://api.meibel.ai/v2/datasources/{datasource_id}/content/process', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.meibel.ai/v2/datasources/{datasource_id}/content/process",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data; boundary=---011000010111000001101001",
"Meibel-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.meibel.ai/v2/datasources/{datasource_id}/content/process")
.header("Meibel-API-Key", "<api-key>")
.header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meibel.ai/v2/datasources/{datasource_id}/content/process")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Meibel-API-Key"] = '<api-key>'
request["Content-Type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"datasource_id": "<string>",
"items": [
{
"name": "<string>",
"path": "<string>",
"type": "<string>",
"size": 123,
"media_type": "<string>",
"last_modified": "<string>",
"etag": "<string>"
}
],
"continuation_token": "<string>",
"ingest_url": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Path Parameters
Query Parameters
Start ingestion after upload completes. Returns ingest_url to poll for status.
Body
multipart/form-data
One or more files to upload
Response
Successful Response
Result of a synchronous upload — waits until files are persisted, optionally triggers ingest, and returns the resulting content listing.
ID of the datasource the files were uploaded to
Content items present on the datasource after the upload completes
Show child attributes
Show child attributes
Set when the listing is truncated — pass to GET /datasources/{id}/content to fetch the rest
URL to poll for ingest status. Only set when trigger_ingest=true was supplied
Was this page helpful?
⌘I