from retab import Retab
client = Retab()
result = client.extractions.sources.get("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.get("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.Get(ctx, "extr_01G34H8J2K", nil)
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.get(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().get("extr_01G34H8J2K", Default::default()).await?;
println!("{:?}", result);
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->extractions()->sources()->get(
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.Sources.GetAsync("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().get("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.get("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.get("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.Get(ctx, "extr_01G34H8J2K", nil)
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.get(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().get("extr_01G34H8J2K", Default::default()).await?;
println!("{:?}", result);
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->extractions()->sources()->get(
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.Sources.GetAsync("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().get("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"
}
mode=located or mode=cited. Follow the returned
Location, including job_id, to pin polling to the extraction output and schema.
A changed extraction returns 409 instead of silently switching results. Polling
never starts a new computation or upgrades a located request to paid citations.
A mode that has not been requested returns 404.
The progressive response adds job and evidence. Job status describes processing:
pending, running, completed, or error. Completed does not mean every
field has a match. Inspect each field’s evidence status. Available locations remain
usable while the job runs. Located results complete independently of citation work.
evidence is keyed by dotted extraction paths, including array indexes (items.0.price).
Each field has a kind (direct, supporting, or unavailable), a status, and a list
of sources. A source has content, file_id, a format-specific anchor, a role
(answer, input, or comparison), and a qualification (direct, partial, or legacy).
Supporting evidence identifies inputs; it does not verify an inferred answer.
Missing, ambiguous, unsupported, and errored matches are distinct field outcomes.
job.is_partial and job.error describe incomplete processing. A missing match alone
is not an error. The original sources tree remains available for existing highlight
renderers; evidence can carry multiple locations per field.
Progressive reads return an ETag. Send it in If-None-Match to receive 304 when the
snapshot has not changed. Use the same mode and job_id when polling.
from retab import Retab
client = Retab()
result = client.extractions.sources.get("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.get("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.Get(ctx, "extr_01G34H8J2K", nil)
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.get(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().get("extr_01G34H8J2K", Default::default()).await?;
println!("{:?}", result);
Ok(())
}
<?php
require 'vendor/autoload.php';
use Retab\Client;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->extractions()->sources()->get(
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.Sources.GetAsync("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().get("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.
Headers
Path Parameters
Query Parameters
Opt into progressive sources for this mode. Omit to retain the legacy synchronous response.
located, cited Expected job identity returned by POST. A changed extraction returns 409.
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"Show child attributes
Show child attributes
Show child attributes
Show child attributes