Python
import os
from meibel import MeibelClient
client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])
with open("contract.pdf", "rb") as file:
response = client.documents.parse(file=file)
print(f"Job ID: {response.job_id}, Status: {response.status}")import { MeibelClient } from "meibel";
import fs from "fs";
const client = new MeibelClient({ apiKey: process.env.MEIBEL_API_KEY });
const response = await client.documents.parse({
file: fs.createReadStream("./contracts/acme-msa-2024.pdf"),
});
console.log(`Job ${response.job_id} status: ${response.status}`);package main
import (
"context"
"fmt"
"os"
"github.com/meibel-ai/meibel-go/v2"
)
func main() {
client := v2.NewClient(v2.WithAPIKey(os.Getenv("MEIBEL_API_KEY")))
resp, err := client.Documents.Parse(context.Background(), &v2.BodyParseDocument{
FileURL: "https://example.com/files/contract_2024.pdf",
FileName: "contract_2024.pdf",
})
if err != nil {
panic(err)
}
fmt.Printf("Job %s status: %s\n", resp.JobID, resp.Status)
}curl --request POST \
--url https://api.meibel.ai/v2/documents \
--header 'Content-Type: multipart/form-data' \
--header 'Meibel-API-Key: <api-key>' \
--form file='@example-file'const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {'Meibel-API-Key': '<api-key>'}};
options.body = form;
fetch('https://api.meibel.ai/v2/documents', 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/documents",
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=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\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/documents")
.header("Meibel-API-Key", "<api-key>")
.header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meibel.ai/v2/documents")
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=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"job_id": "<string>",
"status": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Documents
Parse a document (async)
Upload a document for asynchronous parsing. Returns a job ID to track progress.
POST
/
documents
Python
import os
from meibel import MeibelClient
client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])
with open("contract.pdf", "rb") as file:
response = client.documents.parse(file=file)
print(f"Job ID: {response.job_id}, Status: {response.status}")import { MeibelClient } from "meibel";
import fs from "fs";
const client = new MeibelClient({ apiKey: process.env.MEIBEL_API_KEY });
const response = await client.documents.parse({
file: fs.createReadStream("./contracts/acme-msa-2024.pdf"),
});
console.log(`Job ${response.job_id} status: ${response.status}`);package main
import (
"context"
"fmt"
"os"
"github.com/meibel-ai/meibel-go/v2"
)
func main() {
client := v2.NewClient(v2.WithAPIKey(os.Getenv("MEIBEL_API_KEY")))
resp, err := client.Documents.Parse(context.Background(), &v2.BodyParseDocument{
FileURL: "https://example.com/files/contract_2024.pdf",
FileName: "contract_2024.pdf",
})
if err != nil {
panic(err)
}
fmt.Printf("Job %s status: %s\n", resp.JobID, resp.Status)
}curl --request POST \
--url https://api.meibel.ai/v2/documents \
--header 'Content-Type: multipart/form-data' \
--header 'Meibel-API-Key: <api-key>' \
--form file='@example-file'const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {'Meibel-API-Key': '<api-key>'}};
options.body = form;
fetch('https://api.meibel.ai/v2/documents', 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/documents",
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=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\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/documents")
.header("Meibel-API-Key", "<api-key>")
.header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.meibel.ai/v2/documents")
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=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"job_id": "<string>",
"status": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Was this page helpful?
⌘I