Skip to main content
POST
/
v1
/
beta
/
visualize
/
stream
cURL
curl --request POST \
  --url https://trytako.com/api/v1/beta/visualize/stream \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "csv": [
    "<string>"
  ],
  "file_id": "<string>",
  "query": "<string>",
  "debug": false,
  "file_ids": [],
  "viz_component_type": "bar",
  "output_settings": {
    "knowledge_card_settings": {
      "image_dark_mode": true
    }
  },
  "model": "o3",
  "segment_id": "<string>",
  "connected_private_index_id": "<string>",
  "extra_params": "<string>"
}
'
"<string>"

Notes

  • To authenticate, you’ll need a Tako API key. It’s best practice to store it as an environment variable to avoid hardcoding sensitive credentials in your code.
  • This endpoint returns a Server-Sent Events (SSE) stream, providing real-time progress updates during the visualization pipeline execution.
  • The stream will emit progress events during processing and a final result event with the complete visualization data.

Example Usage

import requests
import json

response = requests.post(
    "https://trytako.com/api/v1/beta/visualize/stream",
    headers={"X-API-Key": "your-api-key"},
    json={"query": "Show Tesla stock price over time"},
    stream=True
)

for line in response.iter_lines():
    if line:
        line_str = line.decode('utf-8')
        if line_str.startswith('data:'):
            data = json.loads(line_str[5:])  # Remove 'data:' prefix
            print(f"Received: {data}")

When to Use Streaming vs Regular Endpoint

Use the streaming endpoint when:
  • You want to show progress indicators to users
  • Processing large datasets that may take time
  • Building interactive UIs that need real-time feedback
Use the regular /v1/beta/visualize endpoint when:
  • You only need the final result
  • Building batch processing workflows
  • Integrating with systems that don’t support streaming

Authorizations

X-API-Key
string
header
required

Body

application/json
csv
string[] | null

List of serialized CSV strings to visualize

file_id
string | null
deprecated

The file id of the dataset to visualize. This is deprecated and will be removed in the future. Use file_ids instead.

query
string | null

Query with instructions to visualize the dataset

debug
boolean
default:false

Whether to return debug information

file_ids

The file ids of the datasets to visualize

viz_component_type
enum<string> | null

The type of visualization component to use

Available options:
bar,
grouped_bar,
stacked_bar,
timeseries,
area_timeseries,
stacked_area_timeseries,
pie,
choropleth,
map,
scatter,
boxplot,
heatmap,
timeline,
waterfall,
histogram,
table,
treemap
output_settings
KnowledgeSearchRequestOutputSettings · object

Settings for controlling outputs of the knowledge search request

model
enum<string> | null

The model to use for the visualization

Available options:
o3,
o4-mini,
gpt-5-mini,
gpt-5-nano,
llama-3.3-70b,
gpt-oss-120b,
zai-glm-4.6,
zai-glm-4.7
segment_id
string | null

The segment id of the dataset to visualize

connected_private_index_id
string | null

The connected private index id of the dataset to visualize

extra_params
string | null

Extra parameters to pass to the visualization

Response

Server-Sent Events stream with progress updates and final results

SSE stream with event types: progress (pipeline updates), result (final data)