Skip to main content
GET
/
api
/
v1
/
tasks
/
{id}
/
history
Get Message History
curl --request GET \
  --url https://api.example.com/api/v1/tasks/{id}/history

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.

Get Task Message History

Retrieve the complete message history for a task. This endpoint is designed for developers who want to render their own chat UI and manage conversation history independently.

Request

GET /api/v1/tasks/{id}/history
Authorization: Bearer {api_key}

Path Parameters

ParameterTypeDescription
idstringThe unique task identifier

Response

{
  "success": true,
  "data": {
    "taskId": "c37c1d78-4d23-4e53-949a-ddd775f25e01",
    "conversationId": "1769442659997-70avfyadp",
    "status": "completed",
    "messages": [
      {
        "id": "msg-1",
        "role": "user",
        "content": "Analyze this CSV file",
        "createdAt": "2026-01-26T15:50:54.870Z",
        "attachedFiles": [
          { "name": "data.csv", "path": "uploads/data.csv" }
        ]
      },
      {
        "id": "msg-2",
        "role": "assistant",
        "content": "I analyzed the CSV file. Here are my findings...",
        "createdAt": "2026-01-26T15:50:59.998Z",
        "thoughts": [
          { "subject": "Analyzing", "description": "Reading the CSV structure..." }
        ],
        "toolCalls": [
          {
            "callId": "tc-1",
            "toolName": "read_file",
            "status": "success",
            "args": { "path": "uploads/data.csv" },
            "output": "column1,column2\nvalue1,value2"
          }
        ]
      }
    ]
  }
}

Response Fields

FieldTypeDescription
taskIdstringThe task identifier
conversationIdstringThe conversation identifier
statusstringCurrent task status
messagesarrayAll messages in chronological order

Message Object

FieldTypeDescription
idstringUnique message identifier
rolestringuser or assistant
contentstringMessage text content
createdAtstringISO timestamp when message was created
attachedFilesarray | undefinedFiles attached to this message (user messages only)
thoughtsarray | undefinedAgent’s thinking/reasoning (assistant messages only)
toolCallsarray | undefinedTool executions (assistant messages only)
For user messages with file uploads, the content field contains only the user’s message text - the file upload prefix is stripped and the files are listed in attachedFiles instead.

Attached File Object

FieldTypeDescription
namestringOriginal filename (e.g., “data.csv”)
pathstringPath in workspace (e.g., “uploads/data.csv”)

Thought Object

FieldTypeDescription
subjectstringBrief subject of the thought
descriptionstringDetailed reasoning

Tool Call Object

FieldTypeDescription
callIdstringUnique tool call identifier
toolNamestringName of the tool executed
statusstringpending, executing, success, error, cancelled
argsobjectArguments passed to the tool
outputstringTool output (when completed)
descriptionstringHuman-readable description of the action

Examples

curl -s https://api.sigmic.ai/api/v1/tasks/c37c1d78-4d23-4e53-949a-ddd775f25e01/history \
  -H "Authorization: Bearer sigmic_your_key_here"

Use Cases

Building a Custom Chat UI

Use this endpoint to hydrate your chat interface with the full conversation history:
async function loadChatHistory(taskId) {
  const response = await fetch(`${API_BASE}/api/v1/tasks/${taskId}/history`, {
    headers: { 'Authorization': `Bearer ${apiKey}` }
  });

  const { data } = await response.json();

  return data.messages.map(msg => ({
    id: msg.id,
    sender: msg.role === 'user' ? 'You' : 'AI Assistant',
    text: msg.content,
    timestamp: new Date(msg.createdAt),
    files: msg.attachedFiles || [],
    thinking: msg.thoughts || [],
    tools: msg.toolCalls || []
  }));
}

Displaying File Attachments

function renderMessage(message) {
  // Show attached files for user messages
  if (message.attachedFiles?.length > 0) {
    return (
      <div>
        <div className="files">
          {message.attachedFiles.map(file => (
            <span key={file.path}>📎 {file.name}</span>
          ))}
        </div>
        <p>{message.content}</p>
      </div>
    );
  }

  return <p>{message.content}</p>;
}

Displaying Tool Executions

function renderToolCalls(toolCalls) {
  return toolCalls.map(tc => (
    <div key={tc.callId} className={`tool-call ${tc.status}`}>
      <span className="tool-name">{tc.toolName}</span>
      <span className="status">{tc.status}</span>
      {tc.output && <pre>{tc.output}</pre>}
    </div>
  ));
}

Errors

CodeDescription
AUTH_REQUIREDNo authentication provided
INVALID_API_KEYInvalid or expired API key
NOT_FOUNDTask with the specified ID was not found
NO_CONVERSATIONTask has no conversation history