SDKs
Bash / cURL
One-liner shell e pipeline jq per il lavoro ad hoc
Utili per controlli rapidi, script CI o per inviare il Markdown direttamente in un altro tool. Abbina curl a jq per filtrare la risposta.
Configurazione
export THUNDERBIT_API_KEY="..."
export API="https://openapi.thunderbit.com/openapi/v1"Distill di una pagina
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'Invia il risultato direttamente a un file o a un altro tool:
curl -sX POST "$API/distill" \
-H "Authorization: Bearer $THUNDERBIT_API_KEY" \
-d '{"url": "'"$1"'"}' \
| jq -r '.data.markdown' > out.mdExtract di dati strutturati
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 + polling
Per esecuzioni batch ad hoc da una 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
doneIn produzione, preferisci i Webhook al polling — vedi Webhooks.
Batch guidato da lista URL
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": [{}]}'