Documentation Index
Fetch the complete documentation index at: https://docs.sigmic.ai/llms.txt
Use this file to discover all available pages before exploring further.
Quickstart
This guide walks you through making your first API request and handling the response.
Prerequisites
- An Sigmic AI account
- An API key (create one in Settings > Developer)
Step 1: Create Your First Task
The simplest way to test the API is with cURL:
# Create a task (returns JSON immediately)
curl -s -X POST https://api.sigmic.ai/api/v1/tasks \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "message=What is 2+2?"
You’ll get a JSON response with the task ID:
{
"success": true,
"data": {
"id": "c37c1d78-4d23-4e53-949a-ddd775f25e01",
"status": "pending"
}
}
Step 2: Stream the Execution
Connect to the stream endpoint to watch the task execute in real-time:
curl -N https://api.sigmic.ai/api/v1/tasks/YOUR_TASK_ID/stream \
-H "Authorization: Bearer YOUR_API_KEY"
You’ll see Server-Sent Events streaming back:
event: history_message
data: {"id":"msg-1","role":"user","content":"What is 2+2?","createdAt":"2026-01-26T15:50:54.870Z"}
event: history_done
data: {"messageCount":1,"isStreaming":true}
event: content
data: {"text":"2+2 equals 4.","isPartial":false}
event: done
data: {"finalResponse":"2+2 equals 4."}
Step 3: Send a Follow-up
Send a follow-up message, then reconnect to the stream:
# Send the follow-up (returns JSON immediately)
curl -s -X POST https://api.sigmic.ai/api/v1/tasks/YOUR_TASK_ID/messages \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"message": "Now multiply that by 10"}'
# Stream the response (includes full history)
curl -N https://api.sigmic.ai/api/v1/tasks/YOUR_TASK_ID/stream \
-H "Authorization: Bearer YOUR_API_KEY"
Complete Working Example
Here’s a minimal working example in Node.js:
const API_KEY = 'sigmic_your_key_here';
const BASE_URL = 'https://api.sigmic.ai';
async function runTask(message) {
// 1. Create the task
const formData = new FormData();
formData.append('message', message);
const createResponse = await fetch(`${BASE_URL}/api/v1/tasks`, {
method: 'POST',
headers: { 'Authorization': `Bearer ${API_KEY}` },
body: formData
});
const { data: { id: taskId } } = await createResponse.json();
console.log('Task ID:', taskId);
// 2. Stream the execution
const streamResponse = await fetch(`${BASE_URL}/api/v1/tasks/${taskId}/stream`, {
headers: { 'Authorization': `Bearer ${API_KEY}` }
});
const reader = streamResponse.body.getReader();
const decoder = new TextDecoder();
let buffer = '';
let finalResponse = '';
while (true) {
const { done, value } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
const events = buffer.split('\n\n');
buffer = events.pop() || '';
for (const eventStr of events) {
if (!eventStr.trim() || eventStr.startsWith(':')) continue;
const lines = eventStr.split('\n');
const eventType = lines[0]?.replace('event: ', '');
const dataLine = lines[1]?.replace('data: ', '');
if (!dataLine) continue;
const data = JSON.parse(dataLine);
if (eventType === 'history_done') {
console.log(`Loaded ${data.messageCount} history messages`);
}
if (eventType === 'content') {
process.stdout.write(data.text);
}
if (eventType === 'done') {
finalResponse = data.finalResponse;
console.log('\n');
}
}
}
return { taskId, finalResponse };
}
// Run it
const { taskId, finalResponse } = await runTask('Explain what an API is in one sentence');
console.log('Final response:', finalResponse);
What’s Next?
Upload Files
Learn how to include files in your tasks
Stream Events
Understand the unified SSE stream endpoint
Artifacts
List and download files generated by the agent
Tool Approval
Control which tools the agent can execute