---
title: "Get sql history queries"
method: GET
path: "/api/v1/services/stats/queries/history"
tags: ["stats_service"]
---

# Get sql history queries

`GET /api/v1/services/stats/queries/history`

## Request

- Base URL: `http://localhost:8888`
- URL: `http://localhost:8888/api/v1/services/stats/queries/history`
- Auth: none declared

## Query parameters

- `project_id` integer, required
- `offset` integer
- `limit` integer
- `type` StatsQueryType[]
- `is_repetitive` boolean
- `chain` 'mainnet' | 'testnet'

## Response `200`

History of queries

- object
  - `count` integer, required
  - `items` StatsQueryResult[], required
    - `id` string, required
    - `name` string
    - `status` 'executing' | 'success' | 'error', required
    - `query` StatsQuery
      - `name` string
      - `addresses` string[]
      - `only_between` boolean
      - `sql` string
      - `gpt_message` string
      - `repeat_interval` integer: cyclic execution of requests
    - `type` 'graph' | 'base_query' | 'chat_gpt_query'
    - `estimate` StatsEstimateQuery
      - `approximate_time` integer, required
      - `approximate_usd_cost` number, required
      - `explain` string
    - `url` string
    - `meta_url` string
    - `spent_time` integer
    - `last_repeat_date` integer
    - `total_repetitions` integer
    - `total_usd_cost` number
    - `usd_cost` number
    - `error` string
    - `all_data_in_preview` boolean
    - `preview` array[]
      - string[]
    - `testnet` boolean, required
    - `is_gpt` boolean
    - `date_create` integer, required

## Other responses

- `400`: Something went wrong on client side
- `403`: Access token is missing or invalid
- `404`: The specified resource was not found
- `500`: Something went wrong on server side

## Changes

- **2025-10-21** `356252841f50`: 1 breaking, 2 warning, 3 info
  - removed the required property `items/items/estimate/approximate_cost` from the response with the `200` status
  - removed the optional property `items/items/cost` from the response with the `200` status
  - removed the optional property `items/items/total_cost` from the response with the `200` status
  - added the optional property `items/items/total_usd_cost` to the response with the `200` status
  - …2 more
- **2024-11-08** `dc03bb6c514d`: 3 info
  - added the new optional `query` request parameter `chain`
  - added the optional property `items/items/name` to the response with the `200` status
  - added the optional property `items/items/query/name` to the response with the `200` status
- **2024-03-22** `dbd561304b3b`: 1 info
  - added the required property `items/items/testnet` to the response with the `200` status
- **2023-12-26** `fc9bd368b423`: 1 warning, 2 info
  - added the new `chat_gpt_query` enum value to the `items/items/type` response property for the response status `200`
  - added the new optional `query` request parameter `is_repetitive`
  - added the new optional `query` request parameter `type`
- …earlier changes not shown

[Operation history](https://skmtc.dev/tonkeeper/apis/rest-api-to-ton-console/changes/api/v1/services/stats/queries/history/get.md)

---

[API](https://skmtc.dev/tonkeeper/apis/rest-api-to-ton-console.md) - [All operations](https://skmtc.dev/tonkeeper/apis/rest-api-to-ton-console/llms.txt) - [OpenAPI document](https://skmtc.dev/tonkeeper/apis/rest-api-to-ton-console/revisions/bffcc11719d3?raw)
