from retab import Retab
client = Retab()
result = client.extractions.sources("extr_01G34H8J2K")
print(result)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const result = await client.extractions.sources("extr_01G34H8J2K");
console.log(result);
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)
}
result, err := client.Extractions.Sources(ctx, "extr_01G34H8J2K")
if err != nil {
log.Fatal(err)
}
fmt.Println(*result)
}
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
result = client.extractions.sources(extraction_id: 'extr_01G34H8J2K')
puts result
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 result = client.extractions().sources("extr_01G34H8J2K").await?;
println!("{:?}", result);
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->extractions()->sources(
extractionId: 'extr_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.Extractions.SourcesAsync("extr_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.extractions().sources("extr_abc123");
System.out.println(result);
}
}
curl -X 'GET' \
'https://api.retab.com/v1/extractions/extr_01G34H8J2K/sources' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <your-api-key>'
{
"object": "extraction.sources",
"extraction_id": "extr_01G34H8J2K",
"document_type": "pdf",
"file": {
"id": "file_abc123",
"filename": "invoice_001.pdf",
"mime_type": "application/pdf"
},
"extraction": {
"invoice_number": "INV-1032",
"customer": {
"name": "Acme Inc."
},
"total_amount": 1240.0
},
"sources": {
"invoice_number": {
"value": "INV-1032",
"source": {
"content": "INV-1032",
"anchor": {
"kind": "pdf_bbox",
"page": 1,
"left": 0.6,
"top": 0.12,
"width": 0.25,
"height": 0.03
}
}
},
"customer": {
"name": {
"value": "Acme Inc.",
"source": {
"content": "Acme Inc.",
"anchor": {
"kind": "pdf_bbox",
"page": 1,
"left": 0.1,
"top": 0.25,
"width": 0.3,
"height": 0.03
}
}
}
},
"total_amount": {
"value": 1240.0,
"source": {
"content": "1,240.00",
"anchor": {
"kind": "pdf_bbox",
"page": 1,
"left": 0.65,
"top": 0.85,
"width": 0.2,
"height": 0.03
}
}
}
}
}
{
"detail": "No extraction found for extraction_id 'extr_01G34H8J2K'"
}
{
"detail": "Extraction has no output to source"
}
Get Sources
Return the extraction result enriched with per-leaf source provenance.
Each extracted leaf value is wrapped as where source contains citation content, surrounding context, and a format-specific anchor (bbox for PDFs, cell ref for spreadsheets, text span for plain text, etc.).
from retab import Retab
client = Retab()
result = client.extractions.sources("extr_01G34H8J2K")
print(result)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const result = await client.extractions.sources("extr_01G34H8J2K");
console.log(result);
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)
}
result, err := client.Extractions.Sources(ctx, "extr_01G34H8J2K")
if err != nil {
log.Fatal(err)
}
fmt.Println(*result)
}
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
result = client.extractions.sources(extraction_id: 'extr_01G34H8J2K')
puts result
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 result = client.extractions().sources("extr_01G34H8J2K").await?;
println!("{:?}", result);
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->extractions()->sources(
extractionId: 'extr_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.Extractions.SourcesAsync("extr_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.extractions().sources("extr_abc123");
System.out.println(result);
}
}
curl -X 'GET' \
'https://api.retab.com/v1/extractions/extr_01G34H8J2K/sources' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <your-api-key>'
{
"object": "extraction.sources",
"extraction_id": "extr_01G34H8J2K",
"document_type": "pdf",
"file": {
"id": "file_abc123",
"filename": "invoice_001.pdf",
"mime_type": "application/pdf"
},
"extraction": {
"invoice_number": "INV-1032",
"customer": {
"name": "Acme Inc."
},
"total_amount": 1240.0
},
"sources": {
"invoice_number": {
"value": "INV-1032",
"source": {
"content": "INV-1032",
"anchor": {
"kind": "pdf_bbox",
"page": 1,
"left": 0.6,
"top": 0.12,
"width": 0.25,
"height": 0.03
}
}
},
"customer": {
"name": {
"value": "Acme Inc.",
"source": {
"content": "Acme Inc.",
"anchor": {
"kind": "pdf_bbox",
"page": 1,
"left": 0.1,
"top": 0.25,
"width": 0.3,
"height": 0.03
}
}
}
},
"total_amount": {
"value": 1240.0,
"source": {
"content": "1,240.00",
"anchor": {
"kind": "pdf_bbox",
"page": 1,
"left": 0.65,
"top": 0.85,
"width": 0.2,
"height": 0.03
}
}
}
}
}
{
"detail": "No extraction found for extraction_id 'extr_01G34H8J2K'"
}
{
"detail": "Extraction has no output to source"
}
from retab import Retab
client = Retab()
result = client.extractions.sources("extr_01G34H8J2K")
print(result)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const result = await client.extractions.sources("extr_01G34H8J2K");
console.log(result);
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)
}
result, err := client.Extractions.Sources(ctx, "extr_01G34H8J2K")
if err != nil {
log.Fatal(err)
}
fmt.Println(*result)
}
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
result = client.extractions.sources(extraction_id: 'extr_01G34H8J2K')
puts result
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 result = client.extractions().sources("extr_01G34H8J2K").await?;
println!("{:?}", result);
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->extractions()->sources(
extractionId: 'extr_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.Extractions.SourcesAsync("extr_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.extractions().sources("extr_abc123");
System.out.println(result);
}
}
curl -X 'GET' \
'https://api.retab.com/v1/extractions/extr_01G34H8J2K/sources' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <your-api-key>'
{
"object": "extraction.sources",
"extraction_id": "extr_01G34H8J2K",
"document_type": "pdf",
"file": {
"id": "file_abc123",
"filename": "invoice_001.pdf",
"mime_type": "application/pdf"
},
"extraction": {
"invoice_number": "INV-1032",
"customer": {
"name": "Acme Inc."
},
"total_amount": 1240.0
},
"sources": {
"invoice_number": {
"value": "INV-1032",
"source": {
"content": "INV-1032",
"anchor": {
"kind": "pdf_bbox",
"page": 1,
"left": 0.6,
"top": 0.12,
"width": 0.25,
"height": 0.03
}
}
},
"customer": {
"name": {
"value": "Acme Inc.",
"source": {
"content": "Acme Inc.",
"anchor": {
"kind": "pdf_bbox",
"page": 1,
"left": 0.1,
"top": 0.25,
"width": 0.3,
"height": 0.03
}
}
}
},
"total_amount": {
"value": 1240.0,
"source": {
"content": "1,240.00",
"anchor": {
"kind": "pdf_bbox",
"page": 1,
"left": 0.65,
"top": 0.85,
"width": 0.2,
"height": 0.03
}
}
}
}
}
{
"detail": "No extraction found for extraction_id 'extr_01G34H8J2K'"
}
{
"detail": "Extraction has no output to source"
}
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Response
Successful Response
An extraction's output annotated with the source that backs each value.
Returned when fetching the sources for an extraction. Carries the source file
and its detected document_type, the original extraction output, and a
parallel sources tree where each leaf is a {value, source} object locating
the value in the document (a page region for PDFs, a cell for spreadsheets, a
text span for plain text, and so on).
ID of the extraction
Detected document type of the source file
pdf, image, csv, xlsx, docx, txt Source file metadata (id, filename, mime_type).
Show child attributes
Show child attributes
Original extraction output
Same shape as extraction but leaves are {value, source} objects. Non-null source entries include file_id.
"extraction.sources"