User Context
The bearer token can be obtained by creating a ServiceAccount.
List of saved SQL queries.
Contains all saved SQL queries for the current user.
Error object.
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"
}
]
}The bearer token can be obtained by creating a ServiceAccount.
Creates a saved SQL query for the current user.
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.
Sets the display name of the saved query. If not provided, the value of "name" will be used.
The saved SQL statement.
Name of the environment the query targets.
SQL query saved.
A SQL query saved by the current user for future execution in SQL Studio.
User-facing label for the saved query.
The saved SQL statement.
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.
When the query was first saved.
When the query was last modified.
Error object.
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"
}The bearer token can be obtained by creating a ServiceAccount.
Name of the saved SQL query (HQ resource name).
Saved SQL query.
A SQL query saved by the current user for future execution in SQL Studio.
User-facing label for the saved query.
The saved SQL statement.
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.
When the query was first saved.
When the query was last modified.
Error object.
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"
}The bearer token can be obtained by creating a ServiceAccount.
Name of the saved SQL query (HQ resource name).
Successful deletion.
No content
Error object.
DELETE /api/v1/users/me/sql-queries/saved/{name} HTTP/1.1
Host: api.example.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
No content
The bearer token can be obtained by creating a ServiceAccount.
Name of the saved SQL query (HQ resource name).
Updates a saved SQL query. Absent fields are left unchanged.
User-facing label for the saved query.
The saved SQL statement.
Name of the environment the query targets.
Updated saved SQL query.
A SQL query saved by the current user for future execution in SQL Studio.
User-facing label for the saved query.
The saved SQL statement.
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.
When the query was first saved.
When the query was last modified.
Error object.
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"
}The bearer token can be obtained by creating a ServiceAccount.
List of executed SQL query records.
List of executed SQL queries for the current user.
Error object.
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"
}
]
}The bearer token can be obtained by creating a ServiceAccount.
Records a SQL query before execution for the current user.
The SQL statement to execute.
Name of the environment the query will be executed against.
Executed SQL query recorded.
A record of a SQL query execution.
When the query was submitted for execution.
The executed SQL statement.
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.
Error object.
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?

