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:

URL="https://thunderbit.com/playground"
curl -sX POST "$API/distill" \
  -H "Authorization: Bearer $THUNDERBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d "$(jq -nc --arg u "$URL" '{url:$u}')" \
  | 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/products/sample",
    "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

# urls.txt: one URL per line
URLS=$(jq -R . urls.txt | jq -s .)
curl -sX POST "$API/batch/distill" \
  -H "Authorization: Bearer $THUNDERBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d "$(jq -nc --argjson u "$URLS" '{urls:$u}')"