API documentation
Get Stream Task Logs
Stream task execution logs in real-time using Server-Sent Events (SSE). Perfect for live monitoring and building real-time dashboards.
GET
This endpoint provides real-time streaming of task execution logs using Server-Sent Events (SSE). Instead of polling for updates, you receive logs as they’re generated, making it ideal for live monitoring, debugging, and building real-time user interfaces.Documentation Index
Fetch the complete documentation index at: https://docs.blackbox.ai/llms.txt
Use this file to discover all available pages before exploring further.
Authentication
Required - You need a BLACKBOX API Key to use this API. Follow these steps to get your API key:- Click on your Profile Image in the top right corner at cloud.blackbox.ai
- Click on “BLACKBOX API Token” from the dropdown menu
- Copy the existing token or click “Generate” if you don’t have one yet
bb_xxxxxxxxxxxxxxxxxxxxxx
Headers
API Key of the form
Bearer <api_key>.Example: Bearer bb_b41b647ffbfed27f61656049d3eaeef3d903cc503345d9eb80080d98bc0Path Parameters
The unique identifier of the task you want to stream logs for.Example:
9qQe2F8Z_nXx9-eJA0BD6Query Parameters
Start streaming from this log index. Useful for resuming after disconnection.Default: 0 (stream from beginning)Example:
fromIndex=50 (resume from log index 50)Include periodic task status updates in the stream.Default: trueExample:
includeStatus=false (only stream logs, no status updates)Event Types
The stream sends different event types to provide comprehensive real-time updates:Initial connection confirmation sent when stream starts.Data Fields:
taskId- Task identifierfromIndex- Starting log indexmessage- Connection confirmation messagetimestamp- ISO 8601 timestamp
Individual log entry from task execution.Data Fields:
index- Log position in arraylog- Log entry object containing:type- Log type (info, error, success, warning, system)contentType- Content format (agentResponse, ansi, system, message, plain-text)message- Log message contenttimestamp- When log was createdagent- Agent that generated the log (claude, blackbox, codex, gemini)step- Execution step identifier
timestamp- ISO 8601 timestamp when log was sent
Periodic task status update (sent every 2 seconds if
includeStatus=true).Data Fields:status- Current task status (pending, processing, saving, completed, error, stopped, timeout)error- Error message if task failed (null otherwise)
Stream completion notification sent when task finishes.Data Fields:
status- Final task statustotalLogs- Total number of logs sentmessage- Completion messagetimestamp- ISO 8601 timestamp
Error notification if something goes wrong during streaming.Data Fields:
error- Error messagedetails- Additional error details (optional)
Response Format
The endpoint returns a Server-Sent Events (SSE) stream withContent-Type: text/event-stream. Each event follows this format:
Security & Access Control
The streaming endpoint implements comprehensive security measures:- ✅ Authentication Required - Valid API key or session required
- ✅ Access Control - Users can only stream logs for:
- Their own tasks
- Tasks from teams they’re members of
- Public tasks
- ✅ No Sensitive Data - Only logs and status are streamed (no API keys, tokens, user IDs, or credentials)
- ✅ Automatic Cleanup - Stream closes automatically when task completes or client disconnects
Use Cases
Real-Time Log Viewer
Build a live log viewer that displays logs as they arrive:Resume After Disconnection
Handle reconnection and resume from last received log:Error Codes
| Status Code | Error | Description |
|---|---|---|
| 200 | Success | Stream established successfully |
| 401 | Unauthorized | Invalid or missing API key |
| 404 | Not Found | Task not found or user does not have access |
| 500 | Internal Server Error | Failed to start log stream |