Loading...

Please wait...

API Access

Integrate Roysa's traceable multimodal AI — documents, images, audio, and video — into your applications

Credits

Balance: -- credits

One balance — shared across the app and the API

Top up credits

Buy credits on the pricing page — one balance, used across the app and the API.

Your API Key

Beta

Loading your API key...

Quick Start

Works with documents, images, audio & video

Python SDK Typed errors, automatic retries, and grounding built in — every endpoint below as one method call.
pip install truetrace
from truetrace import TrueTrace

tt = TrueTrace(api_key="YOUR_API_KEY")   # or TrueTrace.from_env()

out = tt.extract("invoice.pdf", fields=[{"name": "Total"}])
print(out["extracted_features"]["Total"])            # "$12,480.00"
print(out["confidence_scores"]["Total"])             # 0.97
print(out["bounding_boxes"]["Total"]["boxes"][0])    # {page: 1, x1: .62, ...}
Endpoint: POST /extract Input: PDF, Image, Audio, Video Output: JSON — fields, confidence, bounding boxes, speakers, timestamps Cost: 1 credit / page · 3 credits / minute for audio & video
Extract structured fields from a PDF, image, audio, or video
# Works for PDF, image, audio (mp3/wav/...), and video (mp4/mov/...)
curl -X POST https://roysa-chatbot-781352878414.us-central1.run.app/extract \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "file=@invoice.pdf" \
  -F 'fields=[{"name":"Vendor"},{"name":"Invoice Number"},{"name":"Total Amount"},{"name":"Due Date"}]'

Input Formats

In the table below, Docs means any document format here. Every document endpoint (extract, extract-schema, generate-schema, parse, classify, split, ask, review, verify, compute, geo, redact, translate) accepts all of them — non-PDF documents are converted to PDF automatically before grounded extraction, so behavior is identical across formats.

PDFscanned & digital
ImagesJPEG, PNG, TIFF, WEBP, GIF, BMP
Word.doc, .docx, ODT, RTF
Excel / CSV.xls, .xlsx, ODS, .csv, .tsv
PowerPoint.ppt, .pptx, ODP
Plain text.txt, .md, .json, .xml, .yaml, .html
AudioMP3, WAV, FLAC, M4A, AAC, OGG, OPUS, WMA
VideoMP4, MOV, AVI, MKV, WEBM, WMV, FLV, M4V

Max file size 30 MB per upload. Audio/Video are accepted by /extract, /transcribe, and /process-media; for Ask/Review/Compute on media, transcribe first then pass the transcript as text / transcript_text.

Endpoint Reference

1 · Extract data

Turn a document into structured data. Don't know the fields yet? Start with Generate schema. Want a few flat fields? Use Extract. Nested data or repeating rows? Use Extract (schema). Need the whole doc as markdown/blocks? Use Parse.

TaskEndpointWhat it does · when to useCost
Generate schema POST /generate-schema Infers the field list (a JSON Schema) from sample docs. Use first, when you don't know what fields exist — then feed it into Extract. 1 / sample
Extract POST /extract Pulls a flat list of fields you name (e.g. name, date, total) → values + confidence + bounding boxes. Also reads audio/video. 1 / page
Extract (schema) POST /extract-schema Same idea, but for nested objects & repeating rows (line items, multiple policies) described by a JSON Schema. Every extracted leaf gets its own bounding box, keyed by path (policies[1].expiration_date) — duplicate values snap to their own row. 1 / page
Parse POST /parse Converts the whole document to clean markdown + typed layout blocks (headings/tables/…); grounded=true adds a box per block. Very large PDFs (>200 pages) are capped and return truncated:true with pages_parsed & the true page_count. 1 / page
Re-extract POST /re-extract Re-run one field against an already-processed document — cheaper than reprocessing the whole file when a single value looks wrong. 1 / req
Vision POST /vision Raw OCR / vision pass → words + boxes, with no field schema. Use when you want the primitives rather than an answer. 1 / req

2 · Understand & route

Figure out what a document is, where it splits, or just ask it a question.

TaskEndpointWhat it does · when to useCost
Classify POST /classify Identifies the document type (invoice, COI, resume…) + confidence + alternatives. 1 / req
Split POST /split Finds boundaries inside a multi-document PDF pack and labels each segment. 1 / req
Ask POST /document-ask Free-form Q&A / summaries → answer + grounded references. Reuse session_id for follow-ups. 1 / req
Ask (streaming) POST /document-ask-stream Same as Ask, streamed token-by-token (SSE) so you can render as it generates. References arrive with the final frame. 1 / req
Compare POST /compare 2–20 documents → field-by-field delta with source boxes per document. Fields are auto-discovered when you don't name them. export_xlsx=true returns an audit-trail spreadsheet. 1 / doc
Organize POST /organize A set of documents → a proposed folder tree, discovered from their content (no fixed taxonomy). Returns per-document assignments + the assembled tree. 1 / doc

3 · Verify deterministic

Check declared rules against grounded values — the same document + same rules always give the identical verdict. Define review saves the rules once; Review runs them on an incoming doc; Verify is the same check framed as a yes/no gate for a doc you're about to send out; Compute derives new numbers from grounded fields.

TaskEndpointWhat it does · when to useCost
Define review POST /reviews Saves a named set of criteria once → review_id. A reusable template; checks nothing by itself.
Review POST /review Runs the check: document + criteria (or a saved review_id) → pass/fail per criterion, each with the field, operator, reference, extracted value, and source box. 1 / req
Verify POST /verify Alias of /review with gate=true — same engine, same cost. Kept for callers already on it; new integrations should use /review. 1 / req
Compute POST /compute Derives new values from grounded fields (sum/avg/min/max…) with provenance — e.g. a total that isn't printed in the doc. 1 / req
Workflow POST /workflow/run One call: extract → assert → route. Runs a schema extraction, evaluates your assertions against the grounded values, and returns a routing decision — the glue for straight-through processing. 1 / page

4 · Transform

Hand back a modified version or a derived view of the document.

TaskEndpointWhat it does · when to useCost
Redact POST /redact Finds sensitive info (PII) and, with apply=true, blacks it out. The opposite of Extract — remove vs read. 1 / req
Translate POST /translate-document Translates the document into another language → translated PDF. 1 / page
Geo POST /geo Extracts geographic entities (addresses, parcels, coordinates) with boxes — for mapping. 1 / req

5 · Media audio & video

Speech-to-text and media analysis. Grounding for media is temporal — answers cite start_sec/end_sec, not boxes. Use /process-media/extract-media to pull fields with timestamps. Flattening the transcript to text for Ask/Review/Compute also works, but discards the timestamps.

TaskEndpointWhat it does · when to useCost
Transcribe POST /transcribe Audio/video → speaker-labeled transcript as a PDF. Want JSON? Use /process-media — same pass, same price, machine-readable output. 3 / min
Process media POST /process-media Audio/video → transcript_segments + video_intelligence JSON (feed into Ask/Review/Compute). 3 / min
Extract from media POST /extract-media Named fields out of audio/video → values + confidence + timestamps (and object boxes for video frames). Takes the transcript_segments / video_intelligence from /process-media. 1 / req

6 · Forms write, not read

Every other task reads a document. These two write one — take a blank PDF form and produce a completed, flattened document. Call /detect-form first to see the field list, then /fill-form with your values.

TaskEndpointWhat it does · when to useCost
Detect form fields POST /detect-form Enumerates a blank form's fields → name, type and bounding box per field. Works on flat scans, not just AcroForm PDFs. 1 / req
Fill form POST /fill-form Writes your values into the form and returns the completed PDF, plus the bounding_box of every field it filled so you can audit placement. 2 / doc

7 · Provenance verifiable export

A tamper-evident receipt for a processed document: a SHA-256 of the file, a Merkle tree over its pages, and a hash of the extraction. Lets a third party confirm that a specific page produced a specific answer — and lets you disclose one page's proof without revealing the rest (selective disclosure). Pure cryptography: no chain, no wallet, no gas. Requires the Pro plan or above.

TaskEndpointWhat it does · when to useCost
Verifiable export POST /provenance/export File + extraction → {file_hash, units_merkle_root, extraction_hash, units[{index, hash, proof}], signature}. Store it alongside your result. 1 / doc
Verify export POST /provenance/verify Re-checks a receipt against the original file: re-hashes the file and extraction, verifies every page's Merkle proof, and validates the signature. Returns verified plus a per-check breakdown. free

8 · Async long jobs & batches

Every endpoint above is synchronous and must finish inside the request. That is fine for a handful of pages, but a 300-page PDF, an hour of video, or a folder of 500 files needs to outlive the connection. Submit a batch, then poll it — the job keeps running whether or not you stay connected.

TaskEndpointWhat it does · when to useCost
Submit batch POST /batch-extract Queue an extraction over many files → {job_id, status:"queued"}. Up to 500 files per job. Billed at submit, not per poll. 2 / file
Run batch POST /batch-extract/{job_id}/run Starts the runner for a queued job. Files are processed in parallel and each file's status is written back live.
Poll batch GET /batch-extract/{job_id} Current state → {status, succeeded, failed, outputFolderId}. Poll until status is completed or failed; consolidated results.json and results.csv land in the output folder. free

Grounding (boxes & timestamps): every value we read off a page ships with the place it came from. Documents ground spatially: { "page": 1, "bbox": { "x1": 0.06, "y1": 0.94, "x2": 0.21, "y2": 0.96 } } — coordinates are normalised 0.0–1.0 with the origin at the top-left, so they survive any render scale. Audio and video ground temporally instead, as { "start_sec": 16.5, "end_sec": 19.7 }; there is no box for a spoken sentence. A value we could not locate returns bbox: null with confidence: 0 — never a missing key and never a guessed rectangle. Verdict endpoints cite their reasoning the same way: /classify returns evidence[] (the exact text that decided the type) and /split returns boundary_evidence[] per segment (what shows a new document starts on that page).

Authentication: Pass your key as X-API-Key: rk_... or Authorization: Bearer rk_....

Deterministic review (the differentiator): POST /review takes declared criteria (field, operator, value) and returns a white-box, reproducible verdict — the same document + same criteria yield identical verdicts every run. Operators: equals, not_equals, gt/gte/lt/lte, before/after/on_or_before/on_or_after, contains/not_contains, in/not_in, matches, starts_with/ends_with (+ not_), between, is_empty/is_not_empty, is_true/is_false. The token today resolves to as_of for reproducible date checks. Persist a named review with POST /reviews and re-invoke it with /review?review_id=….

Computed fields: POST /compute derives values (sum, difference, product, quotient, average, min, max, count, concat) from grounded inputs and returns provenance (which inputs fed each value). A missing input yields null — never a fabricated number.

Audio/Video with Ask: Call POST /process-media first to get transcript_segments, join the text, then send it as transcript_text to POST /document-ask. For Review / Compute on audio/video, pass that same joined transcript as text / transcript_text to POST /review or POST /compute (no new media path).

Sessions: The session_id in every /document-ask response can be reused for follow-up questions on the same document — no re-upload and 1 credit per question.

Supported audio: MP3, WAV, FLAC, OGG, M4A, AAC, WMA, OPUS  ·  Video: MP4, MOV, AVI, MKV, WEBM, WMV, FLV, M4V

Error codes: 402 Insufficient credits  ·  400 Bad request  ·  429 Rate limit exceeded (see Retry-After)  ·  500 Processing error

Rate Limits

1,000
Requests per day
30 MB
Max file size per upload

Requests per minute is set by your plan, not by the key:

PlanRequests / minuteBurst
Free trial2020
Pay-as-you-go6060
Pro120120
Scale300300
Enterprise600 (or custom)600

The per-minute limit is a token bucket, not a fixed window. You may spend a full minute's allowance at once — which is what a parallel batch does — and the bucket then refills continuously at your plan's rate. There is no point at which you are locked out for the remainder of a minute.

Exceeding it returns 429 with an accurate Retry-After (usually a few seconds) and a body of {"error":"rate_limit_exceeded","limit":60,"burst":60,"window":"1 minute"}. The daily limit returns {"error":"daily_limit_exceeded"}. Larger audio/video files can be sent via /transcribe-upload-url/transcribe-from-gcs. Need higher limits? Contact us for custom plans.