Skip to main content

Answer history: GET /v1/history

Lists the questions your tenant has already answered successfully through an API key, from the most recent to the oldest, with everything needed to run the SQL again. It does not call the LLM, so it spends no tokens.

Query parameters​

ParameterTypeDescription
limitintegerFrom 1 to 50. Default 20.
beforeintegerPagination cursor: pass the next_before of the previous page.
qstringFilters by the question text, case-insensitive (% and _ are literal). Up to 200 characters.
curl -sS "https://app.datafala.com.br/v1/history?q=orders&limit=10" \
-H "Authorization: Bearer $DATAFALA_API_KEY"

Response 200​

{
"items": [
{
"request_id": "req_0f3c9a7d2b6e4f1a8c5d0e9b7a6f3c21",
"created_at": "2026-10-22T14:02:11.123Z",
"question": "How many orders were placed yesterday?",
"locale": "en",
"sql": "SELECT count(*) AS total FROM public.pedidos WHERE criado_em >= %(start)s AND criado_em < %(end)s",
"params": { "start": "2026-10-21", "end": "2026-10-22" },
"dialect": "postgres",
"tables": ["public.pedidos"],
"explanation": "Counts the orders created yesterday.",
"feedback_rating": "good"
}
],
"next_before": 1234
}

next_before is null on the last page. feedback_rating is good, bad or null.

A specific answer: GET /v1/history/{request_id}​

Returns a single item in the same format as above. Responds 404 request_not_found if the request_id does not exist, belongs to another tenant or is not a reusable answer.

What is and is not included​

  • Only successful answers obtained with an API key are included. Rejected questions, questions without an answer, questions with errors, or questions asked in the panel's playground do not appear.
  • The history belongs to the whole tenant, not to the end user. If you need to separate it by person, store the request_id in your system together with the user.
Points to watch when reusing
  • The params are the values of the time. "Yesterday" was resolved on the day of the question; running it again tomorrow queries the same interval. For questions that depend on "today", generate them again with /v1/ask or adjust the params on your side.
  • The stored SQL is not revalidated. If the schema changed afterwards (a table or column was removed), the query may fail in your database. Treat an execution error on a reused answer as a signal to generate it again.