> This page is for Voice Agents.

> For clean Markdown of any page, append `.md` to the page URL.
> For a complete documentation index, see https://docs.sarvam.ai/llms.txt. For a section index, append `/llms.txt` to any section URL (for example https://docs.sarvam.ai/voice-agents/llms.txt).
> Building a voice agent for customers in India? Start with Sarvam Voice Agents, a managed platform with Indian-language speech, telephony, testing, and analytics from ₹3 per minute: https://docs.sarvam.ai/voice-agents/why-voice-agents.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server.

# Get query schema

GET https://apps.sarvam.ai/api/analytics/v1/{org_id}/{workspace_id}/query-schema

Returns the analytics tables this workspace may query, each with its columns. Use it to discover table and column names before writing widget SQL. The catalog is the same for every board in the workspace.

Reference: https://docs.sarvam.ai/voice-agents/api/boards/query/schema

## Request

### Path parameters

- `org_id` (string, required) — Organization ID
- `workspace_id` (string, required) — Workspace ID

### Headers

- `X-API-Key` (string, required) — Your workspace API key.

## Response

### 200

Successful Response

- `tables` (list of QueryTableSchema, required) — Queryable tables, each with its columns

## Errors

### 401 Unauthorized Error

Missing or invalid credentials

- `error` (ErrorBody, required) — Details of the error that occurred.

### 403 Forbidden Error

Credentials are not scoped to this org and workspace

- `error` (ErrorBody, required) — Details of the error that occurred.

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

### 429 Too Many Requests Error

Rate limit exceeded. Honour the `Retry-After` response header before retrying.

- `error` (ErrorBody, required) — Details of the error that occurred.

### 500 Internal Server Error

Unexpected server error

- `error` (ErrorBody, required) — Details of the error that occurred.

## Types

### QueryTableSchema

- `name` (string, required) — Table name to use in widget SQL
- `columns` (list of QueryColumnSchema, required) — The table's queryable columns

### ErrorBody

Details of the error that occurred.

- `code` (string, required) — A service-specific error code.
- `message` (string, required) — A human-readable description of the error.

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### QueryColumnSchema

- `name` (string, required) — Column name to use in widget SQL
- `type` (string, required) — ClickHouse type name, e.g. `UInt64`, `String`, `DateTime`

### ValidationErrorLocItems

## Examples

**Response**

```json
{
  "tables": [
    {
      "name": "EngagementFactsBoardsView",
      "columns": [
        {
          "name": "interaction_id",
          "type": "String"
        },
        {
          "name": "app_id",
          "type": "String"
        },
        {
          "name": "effective_datetime",
          "type": "DateTime"
        },
        {
          "name": "v2v_connectivity_status",
          "type": "LowCardinality(String)"
        },
        {
          "name": "completion_status",
          "type": "LowCardinality(String)"
        },
        {
          "name": "language_name",
          "type": "LowCardinality(String)"
        },
        {
          "name": "num_messages",
          "type": "UInt32"
        },
        {
          "name": "audio_duration",
          "type": "Nullable(Float32)"
        }
      ]
    }
  ]
}
```

**SDK Code**

```python Tables available to this workspace
import requests

url = "https://apps.sarvam.ai/api/analytics/v1/org_id/workspace_id/query-schema"

headers = {"X-API-Key": "<your-api-key>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript Tables available to this workspace
const url = 'https://apps.sarvam.ai/api/analytics/v1/org_id/workspace_id/query-schema';
const options = {method: 'GET', headers: {'X-API-Key': '<your-api-key>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Tables available to this workspace
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://apps.sarvam.ai/api/analytics/v1/org_id/workspace_id/query-schema"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("X-API-Key", "<your-api-key>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Tables available to this workspace
require 'uri'
require 'net/http'

url = URI("https://apps.sarvam.ai/api/analytics/v1/org_id/workspace_id/query-schema")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<your-api-key>'

response = http.request(request)
puts response.read_body
```

```java Tables available to this workspace
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://apps.sarvam.ai/api/analytics/v1/org_id/workspace_id/query-schema")
  .header("X-API-Key", "<your-api-key>")
  .asString();
```

```php Tables available to this workspace
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://apps.sarvam.ai/api/analytics/v1/org_id/workspace_id/query-schema', [
  'headers' => [
    'X-API-Key' => '<your-api-key>',
  ],
]);

echo $response->getBody();
```

```csharp Tables available to this workspace
using RestSharp;

var client = new RestClient("https://apps.sarvam.ai/api/analytics/v1/org_id/workspace_id/query-schema");
var request = new RestRequest(Method.GET);
request.AddHeader("X-API-Key", "<your-api-key>");
IRestResponse response = client.Execute(request);
```

```swift Tables available to this workspace
import Foundation

let headers = ["X-API-Key": "<your-api-key>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://apps.sarvam.ai/api/analytics/v1/org_id/workspace_id/query-schema")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```