from retab import Retab
client = Retab()
result = client.extractions.create_extraction_source(
"extr_123", mode="located", background=True
)
print(result.job)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const result = await client.extractions.create_extraction_source(
"extr_123", true, undefined, "located"
);
console.log(result.job);
package main
import (
"context"
"fmt"
"log"
retab "github.com/retab-dev/retab/clients/go"
)
func main() {
client, err := retab.NewClient("")
if err != nil { log.Fatal(err) }
background := true
mode := retab.CreateSourcesRequestModeLocated
result, err := client.Extractions.CreateSource(context.Background(), "extr_123",
&retab.ExtractionsCreateSourceParams{Background: &background, Mode: &mode})
if err != nil { log.Fatal(err) }
fmt.Println(result.Job)
}
import com.retab.RetabClient;
import com.retab.models.CreateSourcesRequest;
import com.retab.types.CreateSourcesRequestMode;
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().createSource("extr_123",
new CreateSourcesRequest(true, null, CreateSourcesRequestMode.LOCATED, false));
System.out.println(result.getJob());
}
}
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
result = client.extractions.create_extraction_source(
extraction_id: 'extr_123', mode: 'located', background: true
)
puts result
use retab::{Retab, enums::CreateSourcesRequestMode, models::CreateSourcesRequest};
use retab::resources::extractions::CreateExtractionSourceParams;
#[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().create_extraction_source("extr_123",
CreateExtractionSourceParams::new(CreateSourcesRequest {
mode: Some(CreateSourcesRequestMode::Located),
background: Some(true),
..Default::default()
})).await?;
println!("{:?}", result.job);
Ok(())
}
using Retab;
using RetabClient = Retab.Retab;
var client = new RetabClient(Environment.GetEnvironmentVariable("RETAB_API_KEY")!);
var result = await client.Extractions.CreateSourceAsync("extr_123",
new ExtractionsCreateSourceOptions {
Mode = CreateSourcesRequestMode.Located, Background = true
});
Console.WriteLine(result.Job);
<?php
require 'vendor/autoload.php';
use Retab\Client;
use Retab\Resource\SourceJobMode;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->extractions()->createExtractionSource(
extractionId: 'extr_123', background: true, mode: SourceJobMode::Located,
);
print_r($result);
curl -X POST 'https://api.retab.com/v1/extractions/extr_123/sources' \
-H "Authorization: Bearer $RETAB_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"mode":"located","background":true}'
{
"extraction_id": "<string>",
"document_type": "pdf",
"file": {
"id": "<string>",
"filename": "<string>",
"mime_type": "<string>"
},
"extraction": {},
"sources": {},
"object": "extraction.sources",
"evidence": {},
"job": {
"id": "<string>",
"is_partial": true,
"mode": "located",
"object": "extraction.sources.job",
"revision": 123,
"status": "pending",
"updated_at": "2023-11-07T05:31:56Z",
"error": {
"code": "<string>",
"is_retryable": true,
"message": "<string>"
}
}
}{
"extraction_id": "<string>",
"document_type": "pdf",
"file": {
"id": "<string>",
"filename": "<string>",
"mime_type": "<string>"
},
"extraction": {},
"sources": {},
"object": "extraction.sources",
"evidence": {},
"job": {
"id": "<string>",
"is_partial": true,
"mode": "located",
"object": "extraction.sources.job",
"revision": 123,
"status": "pending",
"updated_at": "2023-11-07T05:31:56Z",
"error": {
"code": "<string>",
"is_retryable": true,
"message": "<string>"
}
}
}{
"detail": []
}{
"detail": []
}{
"detail": []
}{
"detail": []
}{
"detail": []
}{
"detail": []
}{
"detail": []
}{
"detail": []
}{
"detail": []
}Create Sources
Create or join a durable sources computation. Located finds printed answers; cited also seeks supporting inputs. Background requests return immediately; synchronous requests wait up to 20 seconds before returning 202 with a version-pinned Location. Repeated requests reuse work and never bill twice. Processing completion does not guarantee evidence for every field. A cited request during a located-only computation returns 409; retry after that computation finishes.
from retab import Retab
client = Retab()
result = client.extractions.create_extraction_source(
"extr_123", mode="located", background=True
)
print(result.job)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const result = await client.extractions.create_extraction_source(
"extr_123", true, undefined, "located"
);
console.log(result.job);
package main
import (
"context"
"fmt"
"log"
retab "github.com/retab-dev/retab/clients/go"
)
func main() {
client, err := retab.NewClient("")
if err != nil { log.Fatal(err) }
background := true
mode := retab.CreateSourcesRequestModeLocated
result, err := client.Extractions.CreateSource(context.Background(), "extr_123",
&retab.ExtractionsCreateSourceParams{Background: &background, Mode: &mode})
if err != nil { log.Fatal(err) }
fmt.Println(result.Job)
}
import com.retab.RetabClient;
import com.retab.models.CreateSourcesRequest;
import com.retab.types.CreateSourcesRequestMode;
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().createSource("extr_123",
new CreateSourcesRequest(true, null, CreateSourcesRequestMode.LOCATED, false));
System.out.println(result.getJob());
}
}
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
result = client.extractions.create_extraction_source(
extraction_id: 'extr_123', mode: 'located', background: true
)
puts result
use retab::{Retab, enums::CreateSourcesRequestMode, models::CreateSourcesRequest};
use retab::resources::extractions::CreateExtractionSourceParams;
#[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().create_extraction_source("extr_123",
CreateExtractionSourceParams::new(CreateSourcesRequest {
mode: Some(CreateSourcesRequestMode::Located),
background: Some(true),
..Default::default()
})).await?;
println!("{:?}", result.job);
Ok(())
}
using Retab;
using RetabClient = Retab.Retab;
var client = new RetabClient(Environment.GetEnvironmentVariable("RETAB_API_KEY")!);
var result = await client.Extractions.CreateSourceAsync("extr_123",
new ExtractionsCreateSourceOptions {
Mode = CreateSourcesRequestMode.Located, Background = true
});
Console.WriteLine(result.Job);
<?php
require 'vendor/autoload.php';
use Retab\Client;
use Retab\Resource\SourceJobMode;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->extractions()->createExtractionSource(
extractionId: 'extr_123', background: true, mode: SourceJobMode::Located,
);
print_r($result);
curl -X POST 'https://api.retab.com/v1/extractions/extr_123/sources' \
-H "Authorization: Bearer $RETAB_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"mode":"located","background":true}'
{
"extraction_id": "<string>",
"document_type": "pdf",
"file": {
"id": "<string>",
"filename": "<string>",
"mime_type": "<string>"
},
"extraction": {},
"sources": {},
"object": "extraction.sources",
"evidence": {},
"job": {
"id": "<string>",
"is_partial": true,
"mode": "located",
"object": "extraction.sources.job",
"revision": 123,
"status": "pending",
"updated_at": "2023-11-07T05:31:56Z",
"error": {
"code": "<string>",
"is_retryable": true,
"message": "<string>"
}
}
}{
"extraction_id": "<string>",
"document_type": "pdf",
"file": {
"id": "<string>",
"filename": "<string>",
"mime_type": "<string>"
},
"extraction": {},
"sources": {},
"object": "extraction.sources",
"evidence": {},
"job": {
"id": "<string>",
"is_partial": true,
"mode": "located",
"object": "extraction.sources.job",
"revision": 123,
"status": "pending",
"updated_at": "2023-11-07T05:31:56Z",
"error": {
"code": "<string>",
"is_retryable": true,
"message": "<string>"
}
}
}{
"detail": []
}{
"detail": []
}{
"detail": []
}{
"detail": []
}{
"detail": []
}{
"detail": []
}{
"detail": []
}{
"detail": []
}{
"detail": []
}from retab import Retab
client = Retab()
result = client.extractions.create_extraction_source(
"extr_123", mode="located", background=True
)
print(result.job)
import { Retab } from "@retab/node";
const client = new Retab({ apiKey: process.env.RETAB_API_KEY });
const result = await client.extractions.create_extraction_source(
"extr_123", true, undefined, "located"
);
console.log(result.job);
package main
import (
"context"
"fmt"
"log"
retab "github.com/retab-dev/retab/clients/go"
)
func main() {
client, err := retab.NewClient("")
if err != nil { log.Fatal(err) }
background := true
mode := retab.CreateSourcesRequestModeLocated
result, err := client.Extractions.CreateSource(context.Background(), "extr_123",
&retab.ExtractionsCreateSourceParams{Background: &background, Mode: &mode})
if err != nil { log.Fatal(err) }
fmt.Println(result.Job)
}
import com.retab.RetabClient;
import com.retab.models.CreateSourcesRequest;
import com.retab.types.CreateSourcesRequestMode;
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().createSource("extr_123",
new CreateSourcesRequest(true, null, CreateSourcesRequestMode.LOCATED, false));
System.out.println(result.getJob());
}
}
require 'retab'
client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])
result = client.extractions.create_extraction_source(
extraction_id: 'extr_123', mode: 'located', background: true
)
puts result
use retab::{Retab, enums::CreateSourcesRequestMode, models::CreateSourcesRequest};
use retab::resources::extractions::CreateExtractionSourceParams;
#[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().create_extraction_source("extr_123",
CreateExtractionSourceParams::new(CreateSourcesRequest {
mode: Some(CreateSourcesRequestMode::Located),
background: Some(true),
..Default::default()
})).await?;
println!("{:?}", result.job);
Ok(())
}
using Retab;
using RetabClient = Retab.Retab;
var client = new RetabClient(Environment.GetEnvironmentVariable("RETAB_API_KEY")!);
var result = await client.Extractions.CreateSourceAsync("extr_123",
new ExtractionsCreateSourceOptions {
Mode = CreateSourcesRequestMode.Located, Background = true
});
Console.WriteLine(result.Job);
<?php
require 'vendor/autoload.php';
use Retab\Client;
use Retab\Resource\SourceJobMode;
$client = new Client(apiKey: getenv('RETAB_API_KEY'));
$result = $client->extractions()->createExtractionSource(
extractionId: 'extr_123', background: true, mode: SourceJobMode::Located,
);
print_r($result);
curl -X POST 'https://api.retab.com/v1/extractions/extr_123/sources' \
-H "Authorization: Bearer $RETAB_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"mode":"located","background":true}'
locatedfinds printed answers without paid citation calls. It supports the existing PDF, image, CSV, spreadsheet, Word, and text source formats.citedalso searches for supporting inputs for inferred answers. It supports PDF and images, is subject to citation availability and plan limits, and uses existing citation billing. Retries do not bill the extraction a second time.
background: true, an unfinished job returns 202 immediately. Otherwise the
request waits up to 20 seconds; unfinished work then returns 202 and continues on
the server. Terminal snapshots return 200. Follow Location to poll, respecting
Retry-After. Both responses contain the extraction, available sources, field
evidence, and the job lifecycle described by Get Sources.
An explicit job_id guards a create or retry against an extraction edit. A mismatch
returns 409. Located and cited have distinct identities. A located request can use
the first snapshot of a cited job; a cited request while a located-only job is running
returns 409. Retry that cited request after the located job finishes.
Set retry: true to retry terminal failed or incomplete work. Concurrent requests
join the active attempt. Processing limits may prevent further citation work; inspect
job.error.is_retryable. Available evidence is retained on failure.
To prevent automatic citations when creating an extraction or workflow run, include
"sources": {"mode": "located"} in the creation request. Omit it to inherit the
organization policy. "sources": {"mode": "cited"} requests automatic citations,
subject to deployment policy. A later explicit sources request can still request
cited evidence after a located extraction.
Processing completion does not guarantee that all fields have matches. An unavailable
source is not evidence that an extracted value is correct or incorrect.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
Return immediately when true. Otherwise wait up to 20 seconds, then return 202 with Location while the same durable job continues.
Optional expected sources job identity. Returns 409 if the extraction changed.
located, cited Retry a terminal failed or incomplete computation. Concurrent requests join the current attempt; billing remains once per extraction.
Response
Requested computation is terminal; inspect job.status and evidence.
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