Skip to main content
Zark comes with a set of core tools that are always available inside your Space. You interact with them through natural language in the chat interface, or programmatically via the API. Zark automatically selects the right tools, runs them in parallel when possible, and combines the results.

API Overview

Every capability is accessible through a single endpoint:
POST https://api.zarkai.xyz/v1/chat
The request body follows this structure:
{
  "messages": [
    {"role": "user", "content": "Your question or instruction"}
  ],
  "workspace_id": "wks-xxxxx",
  "tools": ["web_search", "file_manager", "image_gen"],
  "tool_choice": "auto",
  "temperature": 0,
  "max_tokens": 4000,
  "stream": false,
  "file_ids": [],
  "folder_ids": [],
  "model": null
}

Parameters

ParameterTypeRequiredDescription
messagesarrayYesConversation messages. Each has role ("user", "assistant", "system") and content
workspace_idstringYesYour Space ID — scopes all file access and tool execution
toolsarrayNoWhich tools to make available. null or omitted = all tools available
tool_choicestringNo"auto" (default) — Zark decides. Or a specific tool ID to prefer it
temperaturenumberNo0-1. Lower = more focused. Default: 0
max_tokensintegerNoMaximum response length. Default: 4000
streambooleanNoEnable SSE streaming. Default: false
file_idsarrayNoFile IDs to reference in this request
folder_idsarrayNoFolder IDs to scope file operations
modelstringNoModel override. null = default model

Authentication

All requests require an API key in the x-api-key header:
curl -X POST https://api.zarkai.xyz/v1/chat \
  -H "x-api-key: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"messages": [{"role": "user", "content": "Hello"}], "workspace_id": "wks-xxxxx"}'

Streaming

When stream: true is set, Zark sends Server-Sent Events (SSE) as the response is generated:
Python
import requests
import json

response = requests.post(
    "https://api.zarkai.xyz/v1/chat",
    headers={"x-api-key": "your_api_key", "Content-Type": "application/json"},
    json={
        "messages": [{"role": "user", "content": "What are the latest AI developments?"}],
        "workspace_id": "wks-xxxxx",
        "stream": True,
    },
    stream=True,
)

for line in response.iter_lines():
    if line:
        event = json.loads(line.decode("utf-8").removeprefix("data: "))
        event_type = event.get("type")

        if event_type == "ai_chunk":
            print(event["content"], end="", flush=True)
        elif event_type == "ai_complete":
            print("\n\nDone.")

Event Types

EventDescription
ai_chunkIncremental text content of the response
ai_completeFinal complete response
media_itemGenerated media (image/video) file reference
file_search_resultsList of matching files from a file query
tableTable data with rows and columns from a data query

Available Tools

Search & Research

Tool IDNameDescription
web_searchWeb SearchReal-time internet search for news, research, prices, current events
chat_searchChat History SearchSearch past conversations for previous discussions and context

Files & Media

Tool IDNameDescription
file_managerFile ManagerRead, organize, search, tag, and analyze uploaded files
media_processorMedia ProcessorTranscribe and index audio/video — speech-to-text, visual analysis

Creation

Tool IDNameDescription
image_genImage GeneratorGenerate images, illustrations, diagrams from text descriptions
video_genVideo GeneratorGenerate or edit video from text, images, or existing video
artifactArtifact CreatorBuild code, apps, scripts, documents, and reports

Data & Compute

Tool IDNameDescription
databaseDatabase QueriesQuery uploaded data files with natural language
table_workshopTable WorkshopCreate, modify, merge, and transform tables
code_runnerCode RunnerExecute Python for calculations, statistics, and modeling

Beyond Core Tools

When core tools don’t cover a domain-specific question, Zark automatically searches the Marketplace — an ecosystem of community-built skills, API integrations, and shared datasets. This happens transparently. Learn more about the Marketplace →