import os
from meibel import MeibelClient
from meibel.models import CreateDatasourceRequest, MetadataConfigRequest, MetadataField
client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])
metadata_config = MetadataConfigRequest(
type="custom",
fields=[
MetadataField(
name="document_title",
type="string",
description="Title of the document",
index=True,
),
MetadataField(
name="published_date",
type="datetime",
description="Date the document was published",
index=True,
),
],
)
datasource = client.datasources.create(
CreateDatasourceRequest(
name="Support Knowledge Base",
description="Uploaded PDFs and docs used for customer support answers",
metadata_config=metadata_config,
)
)
print(f"{datasource.id}: {datasource.name} ({datasource.last_sync_status})")import { MeibelClient } from "meibel";
const client = new MeibelClient({ apiKey: process.env.MEIBEL_API_KEY });
const datasource = await client.datasources.create({
name: "Support Ticket Attachments",
description: "Uploaded PDFs and screenshots from customer support tickets",
metadata_config: {
type: "custom",
fields: [
{
name: "ticket_id",
type: "string",
description: "Support ticket identifier referenced in the document",
index: true,
},
{
name: "uploaded_at",
type: "datetime",
description: "Timestamp the file was uploaded",
index: false,
},
],
},
});
console.log(`Created datasource ${datasource.id} (${datasource.name})`);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")))
ds, err := client.Datasources.Create(context.Background(), v2.CreateDatasourceRequest{
Name: "Support Ticket Uploads",
Description: "Customer support tickets uploaded as PDF and text files",
MetadataConfig: &v2.MetadataConfigRequest{
Type: "custom",
Fields: []v2.MetadataField{
{
Name: "ticket_priority",
Type: "string",
Description: "Priority level assigned to the support ticket",
Index: true,
},
},
},
})
if err != nil {
fmt.Println("error creating datasource:", err)
return
}
fmt.Println("Datasource ID:", ds.ID)
fmt.Println("Last sync status:", ds.LastSyncStatus)
}curl --request POST \
--url https://api.meibel.ai/v2/datasources \
--header 'Content-Type: application/json' \
--header 'Meibel-API-Key: <api-key>' \
--data '
{
"name": "<string>",
"description": "",
"connector": {
"database": {
"host": "<string>",
"port": 123,
"database": "<string>",
"schema_name": "<string>"
},
"cloud_storage": {
"bucket": "<string>",
"prefix": "<string>",
"role_arn": "<string>",
"region": "<string>"
},
"web_crawl": {
"base_url": "<string>",
"javascript_render": false,
"domains": [
{
"domain": "<string>",
"include_pattern": "<string>",
"exclude_pattern": ""
}
]
}
},
"metadata_config": {
"model_id": "<string>",
"fields": [
{
"name": "<string>",
"description": "<string>",
"index": true
}
]
}
}
'const options = {
method: 'POST',
headers: {'Meibel-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '',
connector: {
database: {host: '<string>', port: 123, database: '<string>', schema_name: '<string>'},
cloud_storage: {
bucket: '<string>',
prefix: '<string>',
role_arn: '<string>',
region: '<string>'
},
web_crawl: {
base_url: '<string>',
javascript_render: false,
domains: [{domain: '<string>', include_pattern: '<string>', exclude_pattern: ''}]
}
},
metadata_config: {
model_id: '<string>',
fields: [{name: '<string>', description: '<string>', index: true}]
}
})
};
fetch('https://api.meibel.ai/v2/datasources', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '',
'connector' => [
'database' => [
'host' => '<string>',
'port' => 123,
'database' => '<string>',
'schema_name' => '<string>'
],
'cloud_storage' => [
'bucket' => '<string>',
'prefix' => '<string>',
'role_arn' => '<string>',
'region' => '<string>'
],
'web_crawl' => [
'base_url' => '<string>',
'javascript_render' => false,
'domains' => [
[
'domain' => '<string>',
'include_pattern' => '<string>',
'exclude_pattern' => ''
]
]
]
],
'metadata_config' => [
'model_id' => '<string>',
'fields' => [
[
'name' => '<string>',
'description' => '<string>',
'index' => true
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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")
.header("Meibel-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"\",\n \"connector\": {\n \"database\": {\n \"host\": \"<string>\",\n \"port\": 123,\n \"database\": \"<string>\",\n \"schema_name\": \"<string>\"\n },\n \"cloud_storage\": {\n \"bucket\": \"<string>\",\n \"prefix\": \"<string>\",\n \"role_arn\": \"<string>\",\n \"region\": \"<string>\"\n },\n \"web_crawl\": {\n \"base_url\": \"<string>\",\n \"javascript_render\": false,\n \"domains\": [\n {\n \"domain\": \"<string>\",\n \"include_pattern\": \"<string>\",\n \"exclude_pattern\": \"\"\n }\n ]\n }\n },\n \"metadata_config\": {\n \"model_id\": \"<string>\",\n \"fields\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"index\": true\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meibel.ai/v2/datasources")
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"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"\",\n \"connector\": {\n \"database\": {\n \"host\": \"<string>\",\n \"port\": 123,\n \"database\": \"<string>\",\n \"schema_name\": \"<string>\"\n },\n \"cloud_storage\": {\n \"bucket\": \"<string>\",\n \"prefix\": \"<string>\",\n \"role_arn\": \"<string>\",\n \"region\": \"<string>\"\n },\n \"web_crawl\": {\n \"base_url\": \"<string>\",\n \"javascript_render\": false,\n \"domains\": [\n {\n \"domain\": \"<string>\",\n \"include_pattern\": \"<string>\",\n \"exclude_pattern\": \"\"\n }\n ]\n }\n },\n \"metadata_config\": {\n \"model_id\": \"<string>\",\n \"fields\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"index\": true\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"connector": {
"cloud_storage": {},
"web_crawl": {
"base_url": "<string>",
"javascript_render": false,
"domains": [
{
"domain": "<string>",
"include_pattern": "<string>",
"exclude_pattern": ""
}
]
}
},
"created_at": "<string>",
"updated_at": "<string>",
"last_sync_at": "<string>",
"last_sync_status": "<string>",
"total_ingested_files": 123,
"metadata_config": {
"fields": [
{
"name": "<string>",
"description": "<string>",
"index": true
}
],
"model_id": "<string>"
},
"files": {
"total": 123,
"deleted": 123
},
"ingest_counts": {
"rag": {
"total": 123,
"new": 123,
"updated": 123
},
"tag": {
"total": 123,
"new": 123,
"updated": 123
},
"ref_graph": {
"total": 123,
"new": 123,
"updated": 123
}
},
"tables": [
{
"name": "<string>",
"column_count": 123,
"description": "<string>"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Create Datasource
import os
from meibel import MeibelClient
from meibel.models import CreateDatasourceRequest, MetadataConfigRequest, MetadataField
client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])
metadata_config = MetadataConfigRequest(
type="custom",
fields=[
MetadataField(
name="document_title",
type="string",
description="Title of the document",
index=True,
),
MetadataField(
name="published_date",
type="datetime",
description="Date the document was published",
index=True,
),
],
)
datasource = client.datasources.create(
CreateDatasourceRequest(
name="Support Knowledge Base",
description="Uploaded PDFs and docs used for customer support answers",
metadata_config=metadata_config,
)
)
print(f"{datasource.id}: {datasource.name} ({datasource.last_sync_status})")import { MeibelClient } from "meibel";
const client = new MeibelClient({ apiKey: process.env.MEIBEL_API_KEY });
const datasource = await client.datasources.create({
name: "Support Ticket Attachments",
description: "Uploaded PDFs and screenshots from customer support tickets",
metadata_config: {
type: "custom",
fields: [
{
name: "ticket_id",
type: "string",
description: "Support ticket identifier referenced in the document",
index: true,
},
{
name: "uploaded_at",
type: "datetime",
description: "Timestamp the file was uploaded",
index: false,
},
],
},
});
console.log(`Created datasource ${datasource.id} (${datasource.name})`);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")))
ds, err := client.Datasources.Create(context.Background(), v2.CreateDatasourceRequest{
Name: "Support Ticket Uploads",
Description: "Customer support tickets uploaded as PDF and text files",
MetadataConfig: &v2.MetadataConfigRequest{
Type: "custom",
Fields: []v2.MetadataField{
{
Name: "ticket_priority",
Type: "string",
Description: "Priority level assigned to the support ticket",
Index: true,
},
},
},
})
if err != nil {
fmt.Println("error creating datasource:", err)
return
}
fmt.Println("Datasource ID:", ds.ID)
fmt.Println("Last sync status:", ds.LastSyncStatus)
}curl --request POST \
--url https://api.meibel.ai/v2/datasources \
--header 'Content-Type: application/json' \
--header 'Meibel-API-Key: <api-key>' \
--data '
{
"name": "<string>",
"description": "",
"connector": {
"database": {
"host": "<string>",
"port": 123,
"database": "<string>",
"schema_name": "<string>"
},
"cloud_storage": {
"bucket": "<string>",
"prefix": "<string>",
"role_arn": "<string>",
"region": "<string>"
},
"web_crawl": {
"base_url": "<string>",
"javascript_render": false,
"domains": [
{
"domain": "<string>",
"include_pattern": "<string>",
"exclude_pattern": ""
}
]
}
},
"metadata_config": {
"model_id": "<string>",
"fields": [
{
"name": "<string>",
"description": "<string>",
"index": true
}
]
}
}
'const options = {
method: 'POST',
headers: {'Meibel-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '',
connector: {
database: {host: '<string>', port: 123, database: '<string>', schema_name: '<string>'},
cloud_storage: {
bucket: '<string>',
prefix: '<string>',
role_arn: '<string>',
region: '<string>'
},
web_crawl: {
base_url: '<string>',
javascript_render: false,
domains: [{domain: '<string>', include_pattern: '<string>', exclude_pattern: ''}]
}
},
metadata_config: {
model_id: '<string>',
fields: [{name: '<string>', description: '<string>', index: true}]
}
})
};
fetch('https://api.meibel.ai/v2/datasources', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '',
'connector' => [
'database' => [
'host' => '<string>',
'port' => 123,
'database' => '<string>',
'schema_name' => '<string>'
],
'cloud_storage' => [
'bucket' => '<string>',
'prefix' => '<string>',
'role_arn' => '<string>',
'region' => '<string>'
],
'web_crawl' => [
'base_url' => '<string>',
'javascript_render' => false,
'domains' => [
[
'domain' => '<string>',
'include_pattern' => '<string>',
'exclude_pattern' => ''
]
]
]
],
'metadata_config' => [
'model_id' => '<string>',
'fields' => [
[
'name' => '<string>',
'description' => '<string>',
'index' => true
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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")
.header("Meibel-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"\",\n \"connector\": {\n \"database\": {\n \"host\": \"<string>\",\n \"port\": 123,\n \"database\": \"<string>\",\n \"schema_name\": \"<string>\"\n },\n \"cloud_storage\": {\n \"bucket\": \"<string>\",\n \"prefix\": \"<string>\",\n \"role_arn\": \"<string>\",\n \"region\": \"<string>\"\n },\n \"web_crawl\": {\n \"base_url\": \"<string>\",\n \"javascript_render\": false,\n \"domains\": [\n {\n \"domain\": \"<string>\",\n \"include_pattern\": \"<string>\",\n \"exclude_pattern\": \"\"\n }\n ]\n }\n },\n \"metadata_config\": {\n \"model_id\": \"<string>\",\n \"fields\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"index\": true\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meibel.ai/v2/datasources")
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"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"\",\n \"connector\": {\n \"database\": {\n \"host\": \"<string>\",\n \"port\": 123,\n \"database\": \"<string>\",\n \"schema_name\": \"<string>\"\n },\n \"cloud_storage\": {\n \"bucket\": \"<string>\",\n \"prefix\": \"<string>\",\n \"role_arn\": \"<string>\",\n \"region\": \"<string>\"\n },\n \"web_crawl\": {\n \"base_url\": \"<string>\",\n \"javascript_render\": false,\n \"domains\": [\n {\n \"domain\": \"<string>\",\n \"include_pattern\": \"<string>\",\n \"exclude_pattern\": \"\"\n }\n ]\n }\n },\n \"metadata_config\": {\n \"model_id\": \"<string>\",\n \"fields\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"index\": true\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"connector": {
"cloud_storage": {},
"web_crawl": {
"base_url": "<string>",
"javascript_render": false,
"domains": [
{
"domain": "<string>",
"include_pattern": "<string>",
"exclude_pattern": ""
}
]
}
},
"created_at": "<string>",
"updated_at": "<string>",
"last_sync_at": "<string>",
"last_sync_status": "<string>",
"total_ingested_files": 123,
"metadata_config": {
"fields": [
{
"name": "<string>",
"description": "<string>",
"index": true
}
],
"model_id": "<string>"
},
"files": {
"total": 123,
"deleted": 123
},
"ingest_counts": {
"rag": {
"total": 123,
"new": 123,
"updated": 123
},
"tag": {
"total": 123,
"new": 123,
"updated": 123
},
"ref_graph": {
"total": 123,
"new": 123,
"updated": 123
}
},
"tables": [
{
"name": "<string>",
"column_count": 123,
"description": "<string>"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Body
Body for creating a new datasource.
Human-readable datasource name
What this datasource contains
Connection configuration — omit for file-upload datasources
Show child attributes
Show child attributes
Optional metadata extraction config to apply after creation
Show child attributes
Show child attributes
Response
Successful Response
A datasource with its latest sync/ingest state and (optionally) table details.
Unique datasource ID
Human-readable datasource name
What this datasource contains
Connection configuration (summary — infra details like buckets, roles, and hosts are not echoed back)
Show child attributes
Show child attributes
ISO 8601 creation timestamp
ISO 8601 last-update timestamp
ISO 8601 timestamp of the most recent ingest run
Status of the most recent ingest run (e.g. 'completed', 'failed')
Total number of files ingested across all runs
Current metadata extraction configuration
Show child attributes
Show child attributes
File counts for the datasource
Show child attributes
Show child attributes
Per-method counts from the latest ingest run
Show child attributes
Show child attributes
Tables discovered on a structured datasource — only populated when include_tables=true
Show child attributes
Show child attributes
Was this page helpful?