from retab import Retab
client = Retab()
classification = client.classifications.get("cls_01G34H8J2K")
print(classification.output.category)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const classification = await client.classifications.get("cls_01G34H8J2K");
console.log(classification.output.category);
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)
}
classification, err := client.Classifications.Get(ctx, "cls_01G34H8J2K", nil)
if err != nil {
log.Fatal(err)
}
fmt.Println(classification.Output.Category)
}
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
classification = client.classifications.get(classification_id: 'cls_01G34H8J2K')
puts classification.output.category
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 classification = client.classifications().get("cls_01G34H8J2K", retab::resources::classifications::GetParams::default()).await?;
println!("{}", classification.output.as_ref().unwrap().category);
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->classifications()->get(
classificationId: 'cls_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.Classifications.GetAsync("cls_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.classifications().get("cls_abc123", null);
System.out.println(result);
}
}
curl -X GET \
'https://api.retab.com/v1/classifications/cls_01G34H8J2K' \
-H "Authorization: Bearer $RETAB_API_KEY"
{
"id": "cls_01G34H8J2K",
"file": {
"id": "file_6dd6eb00688ad8d1",
"filename": "invoice.pdf",
"mime_type": "application/pdf"
},
"model": "retab-small",
"categories": [
{ "name": "invoice", "description": "Invoice documents" },
{ "name": "receipt", "description": "Receipts" }
],
"n_consensus": 1,
"output": {
"category": "invoice",
"reasoning": "Contains invoice header, line items, and total due."
},
"consensus": {
"choices": [],
"likelihood": null
},
"created_at": "2024-03-15T10:30:00Z"
}
{
"detail": "Classification not found"
}
Get Classification
Retrieve a classification.
Fetches a single classification by its classification_id. Returns the
classification with its file reference, categories, and result; responds
with 404 if no classification with that id exists.
from retab import Retab
client = Retab()
classification = client.classifications.get("cls_01G34H8J2K")
print(classification.output.category)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const classification = await client.classifications.get("cls_01G34H8J2K");
console.log(classification.output.category);
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)
}
classification, err := client.Classifications.Get(ctx, "cls_01G34H8J2K", nil)
if err != nil {
log.Fatal(err)
}
fmt.Println(classification.Output.Category)
}
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
classification = client.classifications.get(classification_id: 'cls_01G34H8J2K')
puts classification.output.category
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 classification = client.classifications().get("cls_01G34H8J2K", retab::resources::classifications::GetParams::default()).await?;
println!("{}", classification.output.as_ref().unwrap().category);
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->classifications()->get(
classificationId: 'cls_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.Classifications.GetAsync("cls_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.classifications().get("cls_abc123", null);
System.out.println(result);
}
}
curl -X GET \
'https://api.retab.com/v1/classifications/cls_01G34H8J2K' \
-H "Authorization: Bearer $RETAB_API_KEY"
{
"id": "cls_01G34H8J2K",
"file": {
"id": "file_6dd6eb00688ad8d1",
"filename": "invoice.pdf",
"mime_type": "application/pdf"
},
"model": "retab-small",
"categories": [
{ "name": "invoice", "description": "Invoice documents" },
{ "name": "receipt", "description": "Receipts" }
],
"n_consensus": 1,
"output": {
"category": "invoice",
"reasoning": "Contains invoice header, line items, and total due."
},
"consensus": {
"choices": [],
"likelihood": null
},
"created_at": "2024-03-15T10:30:00Z"
}
{
"detail": "Classification not found"
}
from retab import Retab
client = Retab()
classification = client.classifications.get("cls_01G34H8J2K")
print(classification.output.category)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const classification = await client.classifications.get("cls_01G34H8J2K");
console.log(classification.output.category);
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)
}
classification, err := client.Classifications.Get(ctx, "cls_01G34H8J2K", nil)
if err != nil {
log.Fatal(err)
}
fmt.Println(classification.Output.Category)
}
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
classification = client.classifications.get(classification_id: 'cls_01G34H8J2K')
puts classification.output.category
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 classification = client.classifications().get("cls_01G34H8J2K", retab::resources::classifications::GetParams::default()).await?;
println!("{}", classification.output.as_ref().unwrap().category);
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->classifications()->get(
classificationId: 'cls_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.Classifications.GetAsync("cls_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.classifications().get("cls_abc123", null);
System.out.println(result);
}
}
curl -X GET \
'https://api.retab.com/v1/classifications/cls_01G34H8J2K' \
-H "Authorization: Bearer $RETAB_API_KEY"
{
"id": "cls_01G34H8J2K",
"file": {
"id": "file_6dd6eb00688ad8d1",
"filename": "invoice.pdf",
"mime_type": "application/pdf"
},
"model": "retab-small",
"categories": [
{ "name": "invoice", "description": "Invoice documents" },
{ "name": "receipt", "description": "Receipts" }
],
"n_consensus": 1,
"output": {
"category": "invoice",
"reasoning": "Contains invoice header, line items, and total due."
},
"consensus": {
"choices": [],
"likelihood": null
},
"created_at": "2024-03-15T10:30:00Z"
}
{
"detail": "Classification 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 classification result: the categories a document was scored against and the chosen output decision.
Unique identifier of the classification
Information about the classified file
Show child attributes
Show child attributes
Model used for classification
Categories the document was classified against
Show child attributes
Show child attributes
Number of consensus votes used
Free-form instructions supplied with the classification request.
The classification result with reasoning. A degenerate empty decision until status == 'completed'; gate reads on status.
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 classification runs
Show child attributes
Show child attributes
Usage information for the classification
Show child attributes
Show child attributes