from retab import Retab
client = Retab()
partition = client.partitions.get("part_01G34H8J2K")
for chunk in partition.output:
print(chunk.key, chunk.pages)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const partition = await client.partitions.get("part_01G34H8J2K");
for (const chunk of partition.output) {
console.log(chunk.key, chunk.pages);
}
package main
import (
"context"
"fmt"
"log"
retab "github.com/retab-dev/retab/clients/go"
)
func ptr[T any](v T) *T { return &v }
func main() {
ctx := context.Background()
client, err := retab.NewClient("")
if err != nil {
log.Fatal(err)
}
partition, err := client.Partitions.Get(ctx, "part_01G34H8J2K", nil)
if err != nil {
log.Fatal(err)
}
for _, chunk := range partition.Output {
fmt.Println(chunk.Key, chunk.Pages)
}
}
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
partition = client.partitions.get(partition_id: 'part_01G34H8J2K')
partition.output.each do |chunk|
puts "#{chunk.key} #{chunk.pages}"
end
use retab::Retab;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Retab::new(std::env::var("RETAB_API_KEY")?);
let partition = client.partitions().get("part_01G34H8J2K", retab::resources::partitions::GetParams::default()).await?;
for chunk in partition.output.as_ref().map(|v| v.as_slice()).unwrap_or_default() {
println!("{} {:?}", chunk.key, chunk.pages.as_ref().unwrap_or(&vec![]));
}
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->partitions()->get(
partitionId: 'part_01G34H8J2K',
);
print_r($result);
using Retab;
using RetabClient = Retab.Retab;
var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;
var client = new RetabClient(apiKey);
var result = await client.Partitions.GetAsync("part_01G34H8J2K");
Console.WriteLine(result);
import com.retab.RetabClient;
public final class Example {
public static void main(String[] args) throws Exception {
RetabClient client = new RetabClient(System.getenv("RETAB_API_KEY"));
var result = client.partitions().get("part_abc123", null);
System.out.println(result);
}
}
curl -X GET \
'https://api.retab.com/v1/partitions/part_01G34H8J2K' \
-H "Authorization: Bearer $RETAB_API_KEY"
{
"id": "part_01G34H8J2K",
"file": {
"id": "file_6dd6eb00688ad8d1",
"filename": "invoice_batch.pdf",
"mime_type": "application/pdf"
},
"model": "retab-small",
"key": "invoice_number",
"instructions": "Return one chunk per invoice number and keep all pages for the same invoice together.",
"n_consensus": 3,
"allow_overlap": true,
"output": [
{ "key": "INV-001", "pages": [1, 2] },
{ "key": "INV-002", "pages": [3, 4] }
],
"consensus": {
"likelihoods": [
{ "key": 0.99, "pages": [0.99, 0.98] },
{ "key": 0.96, "pages": [0.95, 0.95] }
],
"choices": [
[
{ "key": "INV-001", "pages": [1, 2] },
{ "key": "INV-002", "pages": [3, 4] }
]
]
},
"usage": {
"credits": 3.0
},
"created_at": "2024-03-15T10:30:00Z"
}
{
"detail": "Partition not found"
}
Get Partition
Retrieve a partition.
Fetches a single partition by its partition_id within the authenticated environment
and returns the full Partition including its output chunks. Responds with 404 if
no partition with that id exists.
from retab import Retab
client = Retab()
partition = client.partitions.get("part_01G34H8J2K")
for chunk in partition.output:
print(chunk.key, chunk.pages)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const partition = await client.partitions.get("part_01G34H8J2K");
for (const chunk of partition.output) {
console.log(chunk.key, chunk.pages);
}
package main
import (
"context"
"fmt"
"log"
retab "github.com/retab-dev/retab/clients/go"
)
func ptr[T any](v T) *T { return &v }
func main() {
ctx := context.Background()
client, err := retab.NewClient("")
if err != nil {
log.Fatal(err)
}
partition, err := client.Partitions.Get(ctx, "part_01G34H8J2K", nil)
if err != nil {
log.Fatal(err)
}
for _, chunk := range partition.Output {
fmt.Println(chunk.Key, chunk.Pages)
}
}
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
partition = client.partitions.get(partition_id: 'part_01G34H8J2K')
partition.output.each do |chunk|
puts "#{chunk.key} #{chunk.pages}"
end
use retab::Retab;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Retab::new(std::env::var("RETAB_API_KEY")?);
let partition = client.partitions().get("part_01G34H8J2K", retab::resources::partitions::GetParams::default()).await?;
for chunk in partition.output.as_ref().map(|v| v.as_slice()).unwrap_or_default() {
println!("{} {:?}", chunk.key, chunk.pages.as_ref().unwrap_or(&vec![]));
}
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->partitions()->get(
partitionId: 'part_01G34H8J2K',
);
print_r($result);
using Retab;
using RetabClient = Retab.Retab;
var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;
var client = new RetabClient(apiKey);
var result = await client.Partitions.GetAsync("part_01G34H8J2K");
Console.WriteLine(result);
import com.retab.RetabClient;
public final class Example {
public static void main(String[] args) throws Exception {
RetabClient client = new RetabClient(System.getenv("RETAB_API_KEY"));
var result = client.partitions().get("part_abc123", null);
System.out.println(result);
}
}
curl -X GET \
'https://api.retab.com/v1/partitions/part_01G34H8J2K' \
-H "Authorization: Bearer $RETAB_API_KEY"
{
"id": "part_01G34H8J2K",
"file": {
"id": "file_6dd6eb00688ad8d1",
"filename": "invoice_batch.pdf",
"mime_type": "application/pdf"
},
"model": "retab-small",
"key": "invoice_number",
"instructions": "Return one chunk per invoice number and keep all pages for the same invoice together.",
"n_consensus": 3,
"allow_overlap": true,
"output": [
{ "key": "INV-001", "pages": [1, 2] },
{ "key": "INV-002", "pages": [3, 4] }
],
"consensus": {
"likelihoods": [
{ "key": 0.99, "pages": [0.99, 0.98] },
{ "key": 0.96, "pages": [0.95, 0.95] }
],
"choices": [
[
{ "key": "INV-001", "pages": [1, 2] },
{ "key": "INV-002", "pages": [3, 4] }
]
]
},
"usage": {
"credits": 3.0
},
"created_at": "2024-03-15T10:30:00Z"
}
{
"detail": "Partition not found"
}
from retab import Retab
client = Retab()
partition = client.partitions.get("part_01G34H8J2K")
for chunk in partition.output:
print(chunk.key, chunk.pages)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const partition = await client.partitions.get("part_01G34H8J2K");
for (const chunk of partition.output) {
console.log(chunk.key, chunk.pages);
}
package main
import (
"context"
"fmt"
"log"
retab "github.com/retab-dev/retab/clients/go"
)
func ptr[T any](v T) *T { return &v }
func main() {
ctx := context.Background()
client, err := retab.NewClient("")
if err != nil {
log.Fatal(err)
}
partition, err := client.Partitions.Get(ctx, "part_01G34H8J2K", nil)
if err != nil {
log.Fatal(err)
}
for _, chunk := range partition.Output {
fmt.Println(chunk.Key, chunk.Pages)
}
}
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
partition = client.partitions.get(partition_id: 'part_01G34H8J2K')
partition.output.each do |chunk|
puts "#{chunk.key} #{chunk.pages}"
end
use retab::Retab;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Retab::new(std::env::var("RETAB_API_KEY")?);
let partition = client.partitions().get("part_01G34H8J2K", retab::resources::partitions::GetParams::default()).await?;
for chunk in partition.output.as_ref().map(|v| v.as_slice()).unwrap_or_default() {
println!("{} {:?}", chunk.key, chunk.pages.as_ref().unwrap_or(&vec![]));
}
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->partitions()->get(
partitionId: 'part_01G34H8J2K',
);
print_r($result);
using Retab;
using RetabClient = Retab.Retab;
var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;
var client = new RetabClient(apiKey);
var result = await client.Partitions.GetAsync("part_01G34H8J2K");
Console.WriteLine(result);
import com.retab.RetabClient;
public final class Example {
public static void main(String[] args) throws Exception {
RetabClient client = new RetabClient(System.getenv("RETAB_API_KEY"));
var result = client.partitions().get("part_abc123", null);
System.out.println(result);
}
}
curl -X GET \
'https://api.retab.com/v1/partitions/part_01G34H8J2K' \
-H "Authorization: Bearer $RETAB_API_KEY"
{
"id": "part_01G34H8J2K",
"file": {
"id": "file_6dd6eb00688ad8d1",
"filename": "invoice_batch.pdf",
"mime_type": "application/pdf"
},
"model": "retab-small",
"key": "invoice_number",
"instructions": "Return one chunk per invoice number and keep all pages for the same invoice together.",
"n_consensus": 3,
"allow_overlap": true,
"output": [
{ "key": "INV-001", "pages": [1, 2] },
{ "key": "INV-002", "pages": [3, 4] }
],
"consensus": {
"likelihoods": [
{ "key": 0.99, "pages": [0.99, 0.98] },
{ "key": 0.96, "pages": [0.95, 0.95] }
],
"choices": [
[
{ "key": "INV-001", "pages": [1, 2] },
{ "key": "INV-002", "pages": [3, 4] }
]
]
},
"usage": {
"credits": 3.0
},
"created_at": "2024-03-15T10:30:00Z"
}
{
"detail": "Partition not found"
}
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Query Parameters
When false, returns a cheap status-only projection (no output), served from cache for in-flight background runs.
Response
Successful Response
A partition result: a document segmented into chunks along the requested key.
Unique identifier of the partition
Information about the partitioned file
Show child attributes
Show child attributes
Model used for the partition operation
Partition key used for the run
Free-form instructions supplied with the partition request
Number of consensus votes used
Whether pages were allowed to appear in more than one partition chunk
The list of partition chunks with their assigned pages. Empty [] until status == 'completed'.
Show child attributes
Show child attributes
Lifecycle status. The synchronous path returns 'completed'. Background runs progress pending -> queued -> in_progress -> completed | failed | cancelled.
pending, queued, in_progress, completed, failed, cancelled Error details when a background run fails; null otherwise. Always present so consumers can read it without an existence check.
Show child attributes
Show child attributes
Consensus metadata for multi-vote partition runs
Show child attributes
Show child attributes
Usage information for the partition operation
Show child attributes
Show child attributes