v1

latestOpenAPI 3.0.02026-07-2455104.8 MB
Query

Execute query

Execute a query synchronously on the Analytics platform and get result table (Redshift dialect). The number of records that you receive as results is limited to a reasonable amount. This endpoint is mainly for viewing the data. Use the export endpoints in order to fetch all results.

post/api/v1/analytics/query

Query parameters

previewboolean

If true, only a limited amount of records will be returned, but the request does not cost any credits. If true, all results are returned up to a max number of 500 rows.

Request body

querystring required

SQL query to execute

Example request

{
  "query": "SELECT * FROM users",
  "settings": {
    "exportFormat": "csv",
    "delimiter": ","
  },
  "parameters": [
    {
      "name": "date",
      "type": "string",
      "defaultValue": "2021-01-01"
    }
  ]
}

Response

Query response

Example response

{
  "data": {
    "header": [
      "id",
      "name"
    ],
    "rows": [
      [
        "1",
        "Alice"
      ],
      [
        "2",
        "Bob"
      ]
    ]
  },
  "meta": {
    "query": "SELECT * FROM users",
    "executionTime": 0.123,
    "totalResults": 2,
    "columnTypes": [
      "integer",
      "string"
    ]
  }
}