Workspace Data Queries
Register, manage, and invoke parameterized SQL queries against workspace custom tables.
Workspace data queries let you register parameterized SQL templates that the agent can invoke as tools during conversations. Unlike platform functions (which execute against an external data warehouse), data queries run directly against the custom tables you have provisioned in your workspace.
The agent runtime registers each query as a tool named wsq_<name>, so the agent can call it mid-conversation to fetch data from your workspace's custom tables.
Prerequisites
Your workspace must have at least one custom table provisioned through Workspace Tables before you can deploy a data query.
query_id (a UUID returned by create) is the immutable route handle. name is a mutable, workspace-unique label that registers the agent tool wsq_<name>.
Permissions
List / Get / Invoke: Requires
Workspace.viewpermission.Create / Update / Delete: Requires
Workspace.updatepermission.
Create a Data Query
API key issued via POST /v1/{workspace_id}/api-keys. Pass the returned api_key value as a Bearer token.
Create body — the authored shape of a new workspace data query.
The SQL template + parameters parity check + multi-statement /
session-state-command refusal runs inside :meth:_validate_template
so a bad payload surfaces as a Pydantic 422 with the standard wire
shape — no try/except in the handler.
^[a-z][a-z0-9_]*$5000Successful Response
Wire shape for the response of every read + create/update handler.
id (UUID) is the stable handle — every URL except list takes it.
name is the workspace-visible label (UNIQUE per workspace) and is
still what the LLM tool registry keys on (wsq_<name>), but it is
not the route identifier.
input_schema is deliberately NOT exposed — it is fully derivable
from parameters[]. UI consumers can build the JSON Schema view
locally if they need it.
A workspace data query with the given name already exists
Validation or precondition failure
POST /v1/{workspace_id}/data_queries HTTP/1.1
Host: platform.api-us.concurrence.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 301
{
"name": "text",
"description": "text",
"sql_template": "text",
"parameters": [
{
"name": "text",
"type": "string",
"description": "text",
"default": "text",
"authorization_binding": {
"source": "text",
"resource_type": "text",
"access": "read",
"encoding": "csv"
},
"authorization_binding_test_value": "text"
}
],
"timeout_ms": 5000
}{
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "text",
"description": "text",
"sql_template": "text",
"parameters": [
{
"name": "text",
"type": "string",
"description": "text",
"default": "text",
"authorization_binding": {
"source": "text",
"resource_type": "text",
"access": "read",
"encoding": "csv"
},
"authorization_binding_test_value": "text"
}
],
"timeout_ms": 1,
"last_invoked_at": "2026-01-01T00:00:00.000Z",
"deployed_at": "2026-01-01T00:00:00.000Z",
"deployed_by": "123e4567-e89b-12d3-a456-426614174000"
}Creates a new data query and returns it with a server-generated query_id (201 Created). Creating a query whose name already exists in the workspace returns 409 Conflict. To change an existing query, use PATCH on its query_id (see Update a Data Query).
Deploy-Time Validation
The platform validates the query before storing it:
SQL must parse as a single valid statement.
Multi-statement SQL is rejected.
Session-state commands are rejected.
Every
:nameplaceholder in the SQL must have a matching entry inparameters, and every declared parameter must appear as a placeholder in the SQL.Default values must match their declared type.
Example Request
Example Response
Update a Data Query
API key issued via POST /v1/{workspace_id}/api-keys. Pass the returned api_key value as a Bearer token.
PATCH body — every field optional. Present ⇒ overwrite; absent ⇒ keep.
^[a-z][a-z0-9_]*$Successful Response
Wire shape for the response of every read + create/update handler.
id (UUID) is the stable handle — every URL except list takes it.
name is the workspace-visible label (UNIQUE per workspace) and is
still what the LLM tool registry keys on (wsq_<name>), but it is
not the route identifier.
input_schema is deliberately NOT exposed — it is fully derivable
from parameters[]. UI consumers can build the JSON Schema view
locally if they need it.
Workspace data query not found
A workspace data query with the given name already exists
Validation failure
PATCH /v1/{workspace_id}/data_queries/{query_id} HTTP/1.1
Host: platform.api-us.concurrence.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 298
{
"name": "text",
"description": "text",
"sql_template": "text",
"parameters": [
{
"name": "text",
"type": "string",
"description": "text",
"default": "text",
"authorization_binding": {
"source": "text",
"resource_type": "text",
"access": "read",
"encoding": "csv"
},
"authorization_binding_test_value": "text"
}
],
"timeout_ms": 1
}{
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "text",
"description": "text",
"sql_template": "text",
"parameters": [
{
"name": "text",
"type": "string",
"description": "text",
"default": "text",
"authorization_binding": {
"source": "text",
"resource_type": "text",
"access": "read",
"encoding": "csv"
},
"authorization_binding_test_value": "text"
}
],
"timeout_ms": 1,
"last_invoked_at": "2026-01-01T00:00:00.000Z",
"deployed_at": "2026-01-01T00:00:00.000Z",
"deployed_by": "123e4567-e89b-12d3-a456-426614174000"
}Partially updates an existing data query, addressed by its immutable query_id. Any subset of name, description, sql_template, parameters, and timeout_ms may be supplied; omitted fields are left unchanged. The name is mutable but must remain unique within the workspace. The same deploy-time validation applies to any updated SQL.
List Data Queries
List every registered query for a workspace. Sort via repeated sort_by query params; each entry is +field or -field (allowed field: deployed_at). Default: -deployed_at. Cursor opaque — round-trip continuation_token unchanged with the same sort_by. Requires Workspace.view permission.
API key issued via POST /v1/{workspace_id}/api-keys. Pass the returned api_key value as a Bearer token.
Sort axes, applied left-to-right. +field ascending, -field
descending. Defaults to [("deployed_at", -1)] (newest first).
[]Maximum number of queries to return per page.
50Opaque continuation token from a prior response. Treat as a black box — the server decodes it.
Successful Response
Missing or invalid API key.
Insufficient permissions.
Query parameter failed validation or continuation_token is unparseable.
GET /v1/{workspace_id}/data_queries HTTP/1.1
Host: platform.api-us.concurrence.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"items": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "text",
"description": "text",
"sql_template": "text",
"parameter_count": 1,
"timeout_ms": 1,
"last_invoked_at": "2026-01-01T00:00:00.000Z",
"deployed_at": "2026-01-01T00:00:00.000Z",
"deployed_by": "123e4567-e89b-12d3-a456-426614174000"
}
],
"has_more": true,
"continuation_token": null
}Returns the workspace's registered data queries, ordered newest first. Results are paginated: when has_more is true, pass the returned continuation_token on the next request to fetch the following page.
Example Response
List items carry a parameter_count instead of the full parameters array. Fetch a single query by ID to get its parameter definitions.
Get a Data Query
API key issued via POST /v1/{workspace_id}/api-keys. Pass the returned api_key value as a Bearer token.
Successful Response
Wire shape for the response of every read + create/update handler.
id (UUID) is the stable handle — every URL except list takes it.
name is the workspace-visible label (UNIQUE per workspace) and is
still what the LLM tool registry keys on (wsq_<name>), but it is
not the route identifier.
input_schema is deliberately NOT exposed — it is fully derivable
from parameters[]. UI consumers can build the JSON Schema view
locally if they need it.
Workspace data query not found
Validation Error
GET /v1/{workspace_id}/data_queries/{query_id} HTTP/1.1
Host: platform.api-us.concurrence.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "text",
"description": "text",
"sql_template": "text",
"parameters": [
{
"name": "text",
"type": "string",
"description": "text",
"default": "text",
"authorization_binding": {
"source": "text",
"resource_type": "text",
"access": "read",
"encoding": "csv"
},
"authorization_binding_test_value": "text"
}
],
"timeout_ms": 1,
"last_invoked_at": "2026-01-01T00:00:00.000Z",
"deployed_at": "2026-01-01T00:00:00.000Z",
"deployed_by": "123e4567-e89b-12d3-a456-426614174000"
}Returns a single data query by its query_id.
Delete a Data Query
API key issued via POST /v1/{workspace_id}/api-keys. Pass the returned api_key value as a Bearer token.
Successful Response
No content
Workspace data query not found
Validation Error
DELETE /v1/{workspace_id}/data_queries/{query_id} HTTP/1.1
Host: platform.api-us.concurrence.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
No content
Removes a registered data query, addressed by its query_id. Deleting a query cascades to its parameter rows automatically. Returns 204 No Content on success.
Invoke a Data Query
API key issued via POST /v1/{workspace_id}/api-keys. Pass the returned api_key value as a Bearer token.
Successful Response
00Workspace data query not found
Validation Error
Execution failed
POST /v1/{workspace_id}/data_queries/{query_id}/invoke HTTP/1.1
Host: platform.api-us.concurrence.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 48
{
"input": {
"ANY_ADDITIONAL_PROPERTY": "anything"
}
}{
"result": [
{
"ANY_ADDITIONAL_PROPERTY": "anything"
}
],
"duration_ms": 0,
"row_count": 0
}Executes a registered data query, addressed by its query_id, with the provided arguments. An unknown or missing required argument returns 422; fix the call rather than retrying it. 503 means execution failed.
Example Request
Example Response
Agent Tool Registration
When a conversation session starts, the platform loads all data queries for the workspace and registers each one as a tool available to the agent. The tool name follows the pattern wsq_<name> (for example, a query named active_patients_by_location becomes the tool wsq_active_patients_by_location). The agent sees the query's description and input schema, and can call it like any other tool.
Data query tools are constrained to tables provisioned for the workspace. This is distinct from platform function tools (prefixed fn_), which use their configured external data source.
Last updated
Was this helpful?

