> For the complete documentation index, see [llms.txt](https://docs.concurrence.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.concurrence.com/developer-guide/classic-api/data-access/sql-api.md).

# SQL API (Serverless)

Run read-only SQL queries against organization tables over HTTPS with serverless compute.

Run read-only SQL queries against your organization's data over HTTPS. Queries execute on serverless compute managed by Concurrence, so you don't need to provision or operate any infrastructure.

## Access and Permissions

* The feature must be enabled for your organization by Concurrence (request via Slack).
* Beta: behavior and limits of the SQL API can change.
* The endpoint requires elevated privileges. Use an admin or service account token per your internal security policy.
* Standard Concurrence authentication applies (`Authorization: Bearer <token>`).
  * See [Getting Started → Authentication](https://docs.concurrence.com/developer-guide/reference-guides/authentication.md)
  * See [Getting Started → Regions & Endpoints](https://docs.concurrence.com/developer-guide/getting-started/regions-and-endpoints.md)

## Endpoint Reference

The embedded contract defines the authenticated request body and response schema. The current implementation accepts read-only `SELECT` statements and supports only synchronous execution with `async_query: false`.

{% openapi src="<https://api.amigo.ai/v1/openapi.json>" path="/v1/{organization}/admin/sql\_query" method="post" %}
<https://api.amigo.ai/v1/openapi.json>
{% endopenapi %}

{% hint style="warning" %}
Only `SELECT` is allowed. DDL, DML, and administrative statements are rejected.
{% endhint %}

## Query Execution Flow

Submit the supported read query and consume its result according to the selected synchronous or asynchronous mode. The operation reference defines limits and response fields. Returned rows remain scoped to authorized organization data.

## Example Request

{% tabs %}
{% tab title="cURL" %}

```bash
curl --request POST \
  --url "https://<REGIONAL-BASE-URL>/v1/<YOUR-ORG-ID>/admin/sql_query" \
  --header "Authorization: Bearer <AUTH-TOKEN-OF-USER>" \
  --header "Content-Type: application/json" \
  --data '{
    "sql_query": "SELECT * FROM <TABLE> LIMIT 10",
    "async_query": false
  }'
```

{% endtab %}

{% tab title="Python SDK" %}

```python
from amigo_sdk import AmigoClient

# The SDK resource layer does not include the SQL API.
with AmigoClient() as client:
    resp = client._http.request(
        "POST",
        f"/v1/{client.config.organization_id}/admin/sql_query",
        json={
            "sql_query": "SELECT * FROM conversation LIMIT 10",
            "async_query": False,
        },
    )
    result = resp.json()
    print(f"Execution time: {result['execution_time_ms']}ms")
    for row in result["result"]:
        print(row)
```

{% endtab %}

{% tab title="TypeScript SDK" %}

```typescript
// The SDK resource layer does not include the SQL API.
const response = await fetch(
  `${baseUrl}/v1/${orgId}/admin/sql_query`,
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${token}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      sql_query: "SELECT * FROM conversation LIMIT 10",
      async_query: false,
    }),
  }
);
const result = await response.json();
console.log(`Execution time: ${result.execution_time_ms}ms`);
result.result.forEach((row: any) => console.log(row));
```

{% endtab %}
{% endtabs %}

Replace `<REGIONAL-BASE-URL>` with your region's API host (see [Getting Started → Regions & Endpoints](https://docs.concurrence.com/developer-guide/getting-started/regions-and-endpoints.md)) and `<TABLE>` with a table available to your organization.

## Limits and Behavior

* Read-only: `SELECT` statements only. DDL, DML, and admin commands are not allowed.
* Result size: up to 1000 rows per synchronous request.
* Timeout: 30 seconds per synchronous query.
* Rate limiting: 6 requests per minute per user.

{% hint style="info" %}
If you need to extract larger result sets or run recurring analytics jobs, use Delta Sharing.
{% endhint %}

## JDBC/ODBC Connectivity (Optional)

If you plan to connect BI tools or ETL platforms via standard database drivers:

* Private preview: JDBC/ODBC connectivity is available only to select customers.
* Request consideration by messaging your Concurrence representative via Slack. Availability is limited and not guaranteed for all tenants.
* You will receive driver and connection details (host or URL, authentication method, and any required parameters).
* Configure your client or tool using the details provided, along with your admin or service account credentials.

{% hint style="info" %}
Environments vary, so always use the exact connection information Concurrence provides for your tenant. Don't guess driver names, ports, or parameters.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.concurrence.com/developer-guide/classic-api/data-access/sql-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
