Documentation Index
Fetch the complete documentation index at: https://docs.okrapdf.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Every okra command that outputs JSON supports the --jq flag for inline filtering. This mirrors the gh CLI pattern — no separate | jq pipe needed.
--jq implies --json automatically.
Filter completed jobs
okra jobs list --jq '[.[] | select(.status=="completed")] | .[0:5]'
Output:
[
{ "job_id": "ocr-F84H8rAjY...", "status": "completed", "filename": "Q3-2024.pdf" },
{ "job_id": "ocr-qKLuQqM8T...", "status": "completed", "filename": "Annual-Report.pdf" }
]
okra jobs list --jq '[.[] | select(.status=="completed")] | map(.job_id)'
["ocr-F84H8rAjY...", "ocr-qKLuQqM8T...", "ocr-gaSpuGK3P..."]
Comma-separated IDs (for piping into okra task)
okra jobs list --jq '[.[] | select(.status=="completed")] | .[0:3] | map(.job_id) | join(",")'
"ocr-F84H8rAjY...,ocr-qKLuQqM8T...,ocr-gaSpuGK3P..."
One-liner: pipe 3 completed jobs into a multi-doc task
okra task $(okra jobs list --jq '[.[] | select(.status=="completed")] | .[0:3] | map(.job_id) | join(",")' | tr -d '"') \
-m "compare revenue across these documents"
This:
- Lists all jobs as JSON
- Filters to completed only
- Takes the first 3
- Joins their IDs with commas
- Passes the result as the document list to
okra task
Filter by filename pattern
# Only annual reports
okra jobs list --jq '[.[] | select(.filename | test("annual"; "i"))]'
# Only PDFs from 2024
okra jobs list --jq '[.[] | select(.filename | test("2024"))]'
Sort by page count
okra jobs list --jq 'sort_by(.total_pages) | reverse | .[0:5] | map({filename, total_pages})'
Count jobs by status
okra jobs list --jq 'group_by(.status) | map({status: .[0].status, count: length})'
[
{ "status": "completed", "count": 42 },
{ "status": "processing", "count": 3 },
{ "status": "failed", "count": 1 }
]
Combine with other commands
# Get results for the most recent completed job
JOB=$(okra jobs list --jq '[.[] | select(.status=="completed")][0].job_id' | tr -d '"')
okra jobs results "$JOB" -o markdown
# Export tables from all completed jobs to CSV directories
for id in $(okra jobs list --jq '[.[] | select(.status=="completed")] | .[].job_id' | tr -d '"[],' | tr ' ' '\n'); do
okra elements export "$id" -t tables -f csv -d "exports/${id}" -o json >/dev/null
done
Bulk cancel last N jobs
# Cancel the last 4 jobs
okra jobs list --jq '.[-4:].[].job_id' | tr -d '"' | xargs -I{} okra jobs cancel {}
Reference
The --jq flag is available on any command that supports --json output. It uses your system’s jq binary, so any valid jq expression works.
# These are equivalent:
okra jobs list --json | jq '.[0:3]'
okra jobs list --jq '.[0:3]'