Skip to main content
This page is the authoritative reference for every class, method, and field in the FlexOrch Python SDK. For conceptual guides and code walkthroughs, see the pages linked at the bottom.

Client constructor

from flexorch import FlexOrch

client = FlexOrch(
    api_key="dfx_your_key_here",
    base_url="https://api.flexorch.com/v1",  # optional
    timeout=30,                              # optional, seconds
)
api_key
string
required
Your FlexOrch API key. Format: dfx_<random_string>. Defaults to the FLEXORCH_API_KEY environment variable if not provided.
base_url
string
Override the API base URL. Defaults to https://api.flexorch.com/v1. Useful for testing against a staging environment.
timeout
int
HTTP request timeout in seconds. Defaults to 30.

client.documents

upload(file_path)

Uploads a single file and returns a Job object.
job = client.documents.upload("invoice.pdf")
file_path
str
required
Path to the local file to upload. Accepts absolute or relative paths.
Returns: Job

upload_many(file_paths)

Uploads multiple files concurrently. Returns a list of Job objects in the same order as the input.
jobs = client.documents.upload_many(["file1.pdf", "file2.docx"])
file_paths
list[str]
required
List of local file paths to upload.
Returns: list[Job]

upload_from_connector(connector_id, keys)

Pulls files from a connected storage source and creates one job per key.
jobs = client.documents.upload_from_connector(
    connector_id=1,
    keys=["reports/q1.pdf"],
)
connector_id
int
required
Numeric ID of the connector. Find this in Settings → Connectors.
keys
list[str]
required
Object keys (paths) within the connector’s storage source.
Returns: list[Job]

client.jobs

get(job_id)

Fetches the current state of a job.
job = client.jobs.get("job_abc123")
job_id
str
required
The unique identifier of the job.
Returns: Job

list(limit, offset)

Returns a paginated list of jobs for the authenticated workspace, newest first.
jobs = client.jobs.list(limit=25, offset=0)
limit
int
Maximum number of jobs to return. Defaults to 20. Maximum 100.
offset
int
Number of jobs to skip for pagination. Defaults to 0.
Returns: list[Job]

submit_feedback(job_id, rating, issue)

Submits human feedback on a job’s extraction quality.
client.jobs.submit_feedback(
    job_id="job_abc123",
    rating="negative",
    issue="wrong_fields",
)
job_id
str
required
The unique identifier of the job.
rating
str
required
"positive" or "negative".
issue
str
Short code describing the problem. Common values: "wrong_fields", "missed_pii", "incorrect_summary", "poor_extraction".
Returns: None

client.datasets

build(job_ids, name)

Assembles a dataset from a list of completed job IDs.
dataset = client.datasets.build(
    job_ids=["job_abc123", "job_def456"],
    name="my-dataset",
)
job_ids
list[str]
required
IDs of the completed jobs to include in the dataset.
name
str
required
Human-readable name for the dataset. Must be unique within the workspace.
Returns: Dataset

export(dataset_id, format)

Exports a dataset and returns its contents as bytes.
data = client.datasets.export("ds_xyz789", format="jsonl")
dataset_id
str
required
The unique identifier of the dataset.
format
str
required
Export format. One of: "jsonl", "csv", "parquet", "markdown", "arrow".
Returns: bytes

profile(dataset_id)

Returns statistical metadata about the dataset.
profile = client.datasets.profile("ds_xyz789")
dataset_id
str
required
The unique identifier of the dataset.
Returns: DatasetProfile

delete(dataset_id)

Permanently deletes the dataset export artifact. Underlying jobs are not affected.
client.datasets.delete("ds_xyz789")
dataset_id
str
required
The unique identifier of the dataset to delete.
Returns: None

Object fields

Job

FieldTypeDescription
idstrUnique job identifier (job_…).
statusstrCurrent state: queued, running, completed, or failed.
quality_gradestr | NoneLetter grade: "A", "B", "C", or "D". None until completed.
quality_scorefloat | NoneNumeric score from 0.0 to 1.0. None until completed.
pii_findings_countint | NoneNumber of PII entities detected. None until completed.
privacy_appliedboolTrue if redaction or masking was applied during processing.
is_duplicateboolTrue if the file matches a previously processed document.
original_job_idstr | NoneJob ID of the original upload when is_duplicate is True.
processing_summarystr | NoneHuman-readable description of the pipeline result or failure reason.
created_atdatetimeUTC timestamp when the job was created.

Dataset

FieldTypeDescription
idstrUnique dataset identifier (ds_…).
namestrHuman-readable name provided at creation.
statusstr"building" or "ready".
job_countintNumber of jobs included in the dataset.
created_atdatetimeUTC timestamp when the dataset was created.

DatasetProfile

FieldTypeDescription
record_countintTotal number of records in the dataset.
total_tokensintEstimated total token count across all records.
avg_quality_scorefloatMean quality score across included jobs.
grade_countsdict[str, int]Record counts keyed by grade ("A", "B", "C", "D").
pii_type_countintNumber of distinct PII entity types detected.

Exceptions

ExceptionRaised when
AuthenticationErrorAPI key is missing, malformed, or revoked.
FileTooLargeErrorUploaded file exceeds the plan’s size limit.
JobTimeoutErrorwait_until_done() exceeded the configured timeout.
IncompleteJobErrordatasets.build() called with strict=True and a non-completed job.
NotFoundErrorThe requested job or dataset ID does not exist.
RateLimitErrorAPI rate limit exceeded; retry after the indicated interval.

Quickstart

Get up and running in five minutes.

Upload

Single, batch, and connector upload patterns.

Jobs

Polling, filtering, and feedback submission.

Datasets

Building, exporting, and profiling datasets.