Pular para o conteúdo principal

curl

export DATAFALA_URL="https://app.datafala.com.br"
export DATAFALA_API_KEY="tsk_1a2b3c4d_..."
export END_USER="5f0c3a9e7b1d4e2f8a6c0b9d3e7f1a2c4b5d6e7f8091a2b3c4d5e6f708192a3b"

Gerar SQL:

curl -sS -X POST "$DATAFALA_URL/v1/ask" \
-H "Authorization: Bearer $DATAFALA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"question": "Faturamento por mês em 2026", "end_user": "'"$END_USER"'", "max_rows": 12}'

Buscar no histórico:

curl -sS "$DATAFALA_URL/v1/history?q=faturamento&limit=5" \
-H "Authorization: Bearer $DATAFALA_API_KEY"

curl -sS "$DATAFALA_URL/v1/history/req_0f3c9a7d2b6e4f1a8c5d0e9b7a6f3c21" \
-H "Authorization: Bearer $DATAFALA_API_KEY"

Enviar feedback:

curl -sS -X POST "$DATAFALA_URL/v1/feedback" \
-H "Authorization: Bearer $DATAFALA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"request_id": "req_0f3c9a7d2b6e4f1a8c5d0e9b7a6f3c21", "rating": "good"}'

Ver os headers de resposta (X-Request-ID, Retry-After):

curl -sS -D - -o /dev/null "$DATAFALA_URL/v1/history?limit=1" \
-H "Authorization: Bearer $DATAFALA_API_KEY"