For the complete documentation index, see llms.txt. This page is also available as Markdown.

User Context

User context domain data, like Saved SQL queries and query execution history

get

Lists saved SQL queries for the current user.

Authorizations
AuthorizationstringRequired

The bearer token can be obtained by creating a ServiceAccount.

Responses
200

List of saved SQL queries.

application/json

Contains all saved SQL queries for the current user.

get/api/v1/users/me/sql-queries/saved
GET /api/v1/users/me/sql-queries/saved HTTP/1.1
Host: api.example.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "items": [
    {
      "name": "text",
      "display_name": "text",
      "sql": "text",
      "environment_name": "text",
      "created_at": "2026-01-01T00:00:00.000Z",
      "updated_at": "2026-01-01T00:00:00.000Z"
    }
  ]
}
post

Creates a saved SQL query for the current user.

Authorizations
AuthorizationstringRequired

The bearer token can be obtained by creating a ServiceAccount.

Body

Creates a saved SQL query for the current user.

namestring · hq-resource-name · min: 1 · max: 63Required

Sets the name of the new saved SQL query. It must be a valid HQ resource name: it can only contain lowercase alphanumeric characters or hyphens; hyphens cannot appear at the end or start; the length is 63 characters at most.

display_namestring · min: 1 · max: 150Optional

Sets the display name of the saved query. If not provided, the value of "name" will be used.

sqlstringRequired

The saved SQL statement.

environment_namestringRequired

Name of the environment the query targets.

Responses
201

SQL query saved.

application/json

A SQL query saved by the current user for future execution in SQL Studio.

namestring · hq-resource-nameRequired
display_namestring · min: 1 · max: 150Required

User-facing label for the saved query.

sqlstringRequired

The saved SQL statement.

environment_namestringRequired

Name of the environment the query targets. The saved query can outlive the environment, so the data object may contain a name of the environment, that does not exist anymore.

created_atstring · date-timeRequired

When the query was first saved.

updated_atstring · date-timeRequired

When the query was last modified.

post/api/v1/users/me/sql-queries/saved
POST /api/v1/users/me/sql-queries/saved HTTP/1.1
Host: api.example.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 76

{
  "name": "text",
  "display_name": "text",
  "sql": "text",
  "environment_name": "text"
}
{
  "name": "text",
  "display_name": "text",
  "sql": "text",
  "environment_name": "text",
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_at": "2026-01-01T00:00:00.000Z"
}
get

Retrieves a saved SQL query by name.

Authorizations
AuthorizationstringRequired

The bearer token can be obtained by creating a ServiceAccount.

Path parameters
namestring · hq-resource-nameRequired

Name of the saved SQL query (HQ resource name).

Responses
200

Saved SQL query.

application/json

A SQL query saved by the current user for future execution in SQL Studio.

namestring · hq-resource-nameRequired
display_namestring · min: 1 · max: 150Required

User-facing label for the saved query.

sqlstringRequired

The saved SQL statement.

environment_namestringRequired

Name of the environment the query targets. The saved query can outlive the environment, so the data object may contain a name of the environment, that does not exist anymore.

created_atstring · date-timeRequired

When the query was first saved.

updated_atstring · date-timeRequired

When the query was last modified.

get/api/v1/users/me/sql-queries/saved/{name}
GET /api/v1/users/me/sql-queries/saved/{name} HTTP/1.1
Host: api.example.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "name": "text",
  "display_name": "text",
  "sql": "text",
  "environment_name": "text",
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_at": "2026-01-01T00:00:00.000Z"
}
delete

Deletes a saved SQL query.

Authorizations
AuthorizationstringRequired

The bearer token can be obtained by creating a ServiceAccount.

Path parameters
namestring · hq-resource-nameRequired

Name of the saved SQL query (HQ resource name).

Responses
204

Successful deletion.

No content

delete/api/v1/users/me/sql-queries/saved/{name}
DELETE /api/v1/users/me/sql-queries/saved/{name} HTTP/1.1
Host: api.example.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*

No content

patch

Updates a saved SQL query.

Authorizations
AuthorizationstringRequired

The bearer token can be obtained by creating a ServiceAccount.

Path parameters
namestring · hq-resource-nameRequired

Name of the saved SQL query (HQ resource name).

Body

Updates a saved SQL query. Absent fields are left unchanged.

display_namestring · min: 1 · max: 150Optional

User-facing label for the saved query.

sqlstringOptional

The saved SQL statement.

environment_namestringOptional

Name of the environment the query targets.

Responses
200

Updated saved SQL query.

application/json

A SQL query saved by the current user for future execution in SQL Studio.

namestring · hq-resource-nameRequired
display_namestring · min: 1 · max: 150Required

User-facing label for the saved query.

sqlstringRequired

The saved SQL statement.

environment_namestringRequired

Name of the environment the query targets. The saved query can outlive the environment, so the data object may contain a name of the environment, that does not exist anymore.

created_atstring · date-timeRequired

When the query was first saved.

updated_atstring · date-timeRequired

When the query was last modified.

patch/api/v1/users/me/sql-queries/saved/{name}
PATCH /api/v1/users/me/sql-queries/saved/{name} HTTP/1.1
Host: api.example.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 62

{
  "display_name": "text",
  "sql": "text",
  "environment_name": "text"
}
{
  "name": "text",
  "display_name": "text",
  "sql": "text",
  "environment_name": "text",
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_at": "2026-01-01T00:00:00.000Z"
}
get

Lists executed SQL queries for the current user.

Authorizations
AuthorizationstringRequired

The bearer token can be obtained by creating a ServiceAccount.

Responses
200

List of executed SQL query records.

application/json

List of executed SQL queries for the current user.

get/api/v1/users/me/sql-queries/executed
GET /api/v1/users/me/sql-queries/executed HTTP/1.1
Host: api.example.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "items": [
    {
      "executed_at": "2026-01-01T00:00:00.000Z",
      "sql": "text",
      "environment_name": "text"
    }
  ]
}
post

Records a SQL Studio query before execution for the current user.

Authorizations
AuthorizationstringRequired

The bearer token can be obtained by creating a ServiceAccount.

Body

Records a SQL query before execution for the current user.

sqlstringRequired

The SQL statement to execute.

environment_namestringRequired

Name of the environment the query will be executed against.

Responses
201

Executed SQL query recorded.

application/json

A record of a SQL query execution.

executed_atstring · date-timeRequired

When the query was submitted for execution.

sqlstringRequired

The executed SQL statement.

environment_namestringRequired

Name of the environment the query was executed against. The executed query can outlive the environment, so the data object may contain a name of the environment, that does not exist anymore.

post/api/v1/users/me/sql-queries/executed
POST /api/v1/users/me/sql-queries/executed HTTP/1.1
Host: api.example.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 40

{
  "sql": "text",
  "environment_name": "text"
}
{
  "executed_at": "2026-01-01T00:00:00.000Z",
  "sql": "text",
  "environment_name": "text"
}

Last updated

Was this helpful?