SDKs

Bash / cURL

Shell one-liners and jq pipelines for ad-hoc work

Useful for quick checks, CI scripts, or piping markdown straight into another tool. Pair curl with jq to slice the response.

Configure

export THUNDERBIT_API_KEY="..."
export API="https://openapi.thunderbit.com/openapi/v1"

Distill a page

curl -sX POST "$API/distill" \
  -H "Authorization: Bearer $THUNDERBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://thunderbit.com/playground"}' \
  | jq -r '.data.markdown'

Pipe straight to a file or another tool:

curl -sX POST "$API/distill" \
  -H "Authorization: Bearer $THUNDERBIT_API_KEY" \
  -d '{"url": "'"$1"'"}' \
  | jq -r '.data.markdown' > out.md

Extract structured data

curl -sX POST "$API/extract" \
  -H "Authorization: Bearer $THUNDERBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/product/iphone-15-pro",
    "schema": {
      "type": "object",
      "properties": {
        "name":  { "type": "string" },
        "price": { "type": "number" }
      },
      "required": ["name", "price"]
    }
  }' \
  | jq '.data'

Batch + poll

For ad-hoc batch runs from a shell:

JOB=$(curl -sX POST "$API/batch/distill" \
  -H "Authorization: Bearer $THUNDERBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["https://example.com/p1", "https://example.com/p2"]}' \
  | jq -r '.data.id')

while :; do
  STATUS=$(curl -s "$API/batch/distill/$JOB" \
    -H "Authorization: Bearer $THUNDERBIT_API_KEY" \
    | jq -r '.data.status')
  echo "$STATUS"
  [[ "$STATUS" == "COMPLETED" || "$STATUS" == "FAILED" ]] && break
  sleep 10
done

For production, prefer webhooks over polling — see Webhooks.

URL-list driven batch

xargs -a urls.txt -I {} echo '"{}"' \
  | paste -sd, - \
  | xargs -I {} curl -sX POST "$API/batch/distill" \
      -H "Authorization: Bearer $THUNDERBIT_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"urls": [{}]}'