Scripting FlipLink: Pipe CLI Output to jq
Scripting the FlipLink CLI? Pipe --json output to jq to extract IDs and URLs, filter, chain commands, and build automation that exits cleanly.
Published on June 21, 2026 · 6 min read
The FlipLink CLI prints friendly, human-readable tables by default. That's great when you're working at the terminal — but the moment you want to script something, you want raw, machine-readable data instead. That's exactly what the --json flag gives you, and once you pair it with jq, you can extract IDs, pull share links, filter by status, and chain commands into real automation.
This guide is about scripting the FlipLink CLI: turning a few commands into a small, reliable pipeline. If you're brand new to the tool, start with Getting Started with the FlipLink CLI, then come back here. For the full command surface, the CLI documentation is the reference.
The one flag that makes scripting possible: --json
Almost every read or write command accepts --json. Add it, and the CLI emits raw JSON to standard output instead of a formatted table:
fliplink flipbook list --json
Pipe that straight into jq and you can reshape it however you like. The single most important habit when scripting: inspect the raw output first so you know the exact field names before you reach for them.
# See the full shape of a single item — keys, casing, everything
fliplink flipbook list --json | jq '.[0]'
The examples below use plausible field names like .ID and .URL, but you should never assume them — field casing can differ. Run the command above once, read the keys, and adjust your jq paths to match what you actually see.
Extract just the IDs
The classic first move: get a flat list of flipbook IDs you can loop over.
fliplink flipbook list --json | jq '.[].ID'
jq walks the array (.[]) and pulls the ID field from each item. Wrap the field in -r (raw output) when you want clean strings with no surrounding quotes — that's what you need when feeding the values into another command:
fliplink flipbook list --json | jq -r '.[].ID'
Pull share links into a clean list
The same pattern works for any field. If your list items include a URL, you can extract every share link at once:
fliplink flipbook list --json | jq -r '.[].URL'
Want a two-column report of title and link? Build a tab-separated row per item with jq's string interpolation:
fliplink flipbook list --json \
| jq -r '.[] | "\(.Title)\t\(.URL)"'
Again — confirm .Title and .URL against your own --json output before trusting them. If the keys differ, swap them in.
Filter before you act
jq's select() lets you keep only the items that match a condition. Suppose each item carries a published flag and you want just the IDs of published flipbooks:
fliplink flipbook list --json \
| jq -r '.[] | select(.IsPublished == true) | .ID'
Inspect your output to learn the real flag name and type — it might be a boolean, a string, or a status field. Adjust the select() expression accordingly. The pattern stays the same: filter the array, then project the field you need.
Chain commands: list, filter, then act
Here's where it gets useful. Pipe the filtered IDs into a shell loop and run a second command against each one. This example finds every flipbook that is not yet published and publishes it:
fliplink flipbook list --json \
| jq -r '.[] | select(.IsPublished == false) | .ID' \
| while read -r id; do
echo "Publishing $id..."
fliplink flipbook publish "$id"
done
The while read -r id loop consumes one ID per line and calls fliplink flipbook publish on each. Because jq -r strips the quotes, $id is a clean value ready to pass straight through. The same shape works for any action command — swap in set-expiry, share-link, or delete.
Note: every command shown here is a real FlipLink CLI command. If you need an action the curated commands don't cover, use the
fliplink apiescape hatch (for examplefliplink api PUT /api/set-skin/<id> --data '{"SkinName":"Modern"}') — the same REST API sits underneath.
Try FlipLink Free
Convert your PDF in seconds. No sign-up, no credit card — just upload and go.
Drop your PDF here or click to browse
Max 40MB
Paid plans from $39 raise this to 150 MB.
Build a tiny report
Once you can extract and filter, a quick status report is just one more jq expression. Count your total flipbooks and how many are published:
fliplink flipbook list --json | jq '{
total: length,
published: ([.[] | select(.IsPublished == true)] | length)
}'
That prints a compact JSON summary you can log, email, or post to a channel. Prefer a human line instead?
fliplink flipbook list --json \
| jq -r '"Total: \(length) flipbooks"'
Write scripts that know whether they worked
A pipeline is only trustworthy if it reacts to failure. The FlipLink CLI uses meaningful exit codes, so your scripts can branch on them:
0— success1— request or HTTP error (network, bad key, a401)2— application error (the API returnedResult: ERROR)
Check the exit code after a command and handle each case:
fliplink flipbook publish "$id"
status=$?
if [ "$status" -eq 0 ]; then
echo "Published $id"
elif [ "$status" -eq 2 ]; then
echo "Application error publishing $id (check the response)" >&2
else
echo "Request failed for $id (exit $status)" >&2
fi
For a fail-fast script, add set -e at the top so the whole run stops on the first non-zero exit. For a resilient batch job, keep going but log the failures — the exit-code branch above is how you tell “done” from “done with errors.”
If you script in CI rather than from your laptop, set your key with the FLIPLINK_API_KEY environment variable instead of the local config file, and read the deeper walkthrough in Automate Flipbook Publishing in CI/CD.
Cron it
The final step in any automation: put it on a schedule. Save your pipeline as a script, make it executable, and add a cron entry. This runs a nightly publish-and-report at 02:00:
# crontab -e
0 2 * * * FLIPLINK_API_KEY=your_key /home/you/scripts/nightly-publish.sh >> /var/log/fliplink.log 2>&1
Redirecting both stdout and stderr to a log file (>> ... 2>&1) means your exit-code branches and jq reports are captured every run — so when something breaks at 2 a.m., you have a record of exactly what happened.
The pattern, in one line
Every script in this guide is the same idea: --json to get raw data → jq to extract or filter → a loop to act → exit codes to verify. Start by inspecting your own --json output so the field names are right, build the pipeline one stage at a time, and you'll have dependable FlipLink automation in minutes.
Related Reading
Ready to Create Your First Flipbook?
Transform your PDFs into interactive flipbooks and documents. Get started with FlipLink's Lifetime Deal — lifetime access that starts at just $39.
Pay Once, Use Forever
10, 50 or 100 flipbooks · All 35 features · Unlimited domains
No feature gates. Every Lifetime Deal tier unlocks all 35 features.
- Every feature unlocked — no feature gates
- Stackable — buy more codes anytime
- Replaceable — swap old for new
- Unlimited custom domains (CNAME)
- No recurring fees, ever
Related Reading
Automate Flipbook Publishing in CI/CD with the FlipLink CLI
Automate flipbook publishing in any CI/CD pipeline with the FlipLink CLI — create, publish, capture the URL, and fail fast on exit codes.
Batch-Convert a Folder of PDFs to Flipbooks
Batch convert PDF to flipbook from a whole folder with one shell loop using the FlipLink CLI — capture URLs to CSV and skip bad files.
FlipLink CLI vs API vs MCP: Which Integration Should You Use?
CLI vs API vs MCP for FlipLink — compare effort, audience, and use case, then see the same flipbook created three ways. Pick the right integration.