GET
/api/v1/public/threads/{thread_id}/responseGet Task Results
Fetches results from a completed or running task. Use this endpoint to poll for task completion and retrieve the generated content.
Request
curl -X GET \
"https://api.he2.ai/api/v1/public/threads/thread_456/response?project_id=proj_123" \
-H "X-API-Key: he-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"Path Parameters
| Parameter | Type | Description |
|---|---|---|
thread_id | string (required) | The thread ID from the create task response |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
project_id | string (required) | Project ID from quick action response |
timeout | integer (optional) | Max wait time in seconds (0-600, default: 300) |
realtime | boolean (optional) | Enable WebSocket-based streaming (default: false) |
include_file_content | boolean (optional) | Include file content inline (default: false) |
page | integer (optional) | Page number for pagination (default: 1) |
page_size | integer (optional) | Items per page (1-1000, default: 100) |
Response
200
{
"success": true,
"thread_id": "thread_456",
"project_id": "proj_123",
"agent_run_id": "run_789",
"status": "completed",
"response": {
"role": "assistant",
"content": "Here is your website...",
"message_id": "msg_1"
},
"has_code": true,
"has_files": true,
"code_blocks": [
{
"language": "html",
"code": "<!DOCTYPE html>..."
}
],
"files": [
{
"file_id": "file_1",
"file_name": "index.html",
"file_size": 2048,
"included_inline": true,
"content": "<!DOCTYPE html>...",
"encoding": "utf-8"
}
]
}Status Values
completed: Task finished successfullyrunning: Task still in progressfailed: Task encountered an errorstopped: Task was manually stoppedno_run: No task exists for this thread
Real-Time Streaming
Get live updates as the AI works using WebSocket-based streaming:
curl -X GET "https://api.he2.ai/api/v1/public/threads/thread_456/response?project_id=proj_123&realtime=true" \
-H "X-API-Key: he-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"Stream events:
data: {"type": "status", "status": "running"}
data: {"type": "content", "content": "First chunk..."}
data: {"type": "status", "status": "completed"}