Skip to main content
GET
/
api
/
v2
/
platform
/
agents
/
{agent_handle}
/
tasks
Get Tasks by Agent Handle
curl --request GET \
  --url https://unpod.ai/api/v2/platform/agents/{agent_handle}/tasks/ \
  --header 'Authorization: <api-key>' \
  --header 'Org-Handle: <org-handle>'
{
  "count": 1,
  "status_code": 200,
  "message": "Tasks Fetched Successfully",
  "data": [
    {
      "_id": "697debb84c27faa892bfa0cc",
      "thread_id": "thread_9xkL2mQpR7vNwY4sZ3cJ8hF1",
      "user_info": {
        "email": "user@example.com",
        "full_name": "John Doe"
      },
      "task_id": "T8ff2ccdffe9a11f0878d43cd8a99e069",
      "run_id": "R8ff2ccdefe9a11f0878d43cd8a99e069",
      "task": {
        "objective": "Call the lead and discuss the project requirements."
      },
      "input": {
        "name": "John Doe",
        "contact_number": "1234567890",
        "email": "john@example.com",
        "context": "Follow up on proposal"
      },
      "output": {
        "call_id": "CALL_7dAb3kR9mXvQ2pLw",
        "call_end_reason": "caller_hangup",
        "start_time": "2026-02-07T05:57:45Z",
        "end_time": "2026-02-07T06:02:30Z",
        "assistant_number": "+911234567890",
        "call_summary": "The agent successfully connected with John Doe and discussed project requirements. Lead expressed interest.",
        "duration": 285,
        "recording_url": "https://cdn.unpod.ai/recordings/CALL_7dAb3kR9mXvQ2pLw.mp3",
        "transcript": [
          {
            "role": "agent",
            "content": "Hello, this is an AI assistant calling on behalf of Unpod. Am I speaking with John Doe?"
          },
          {
            "role": "user",
            "content": "Yes, this is John."
          }
        ],
        "post_call_data": {
          "summary": "The agent successfully connected with John Doe and discussed project requirements.",
          "outcome": "interested",
          "sentiment": "positive"
        },
        "call_type": "outbound",
        "call_status": "completed"
      },
      "attachments": [],
      "assignee": "space-agent-8qmk42nslp91wrh3dz7btxc4",
      "status": "completed",
      "execution_type": "call",
      "ref_id": "6902fb5840a736e125e80ebc",
      "failure_count": 0,
      "last_failure_reason": null,
      "retry_attempt": 0,
      "last_status_change": "2026-02-07T06:02:35Z",
      "scheduled_timestamp": null
    }
  ]
}
{
  "count": 1,
  "status_code": 200,
  "message": "Tasks Fetched Successfully",
  "data": [
    {
      "_id": "697debb84c27faa892bfa0cc",
      "thread_id": "thread_9xkL2mQpR7vNwY4sZ3cJ8hF1",
      "user_info": {
        "email": "user@example.com",
        "full_name": "John Doe"
      },
      "task_id": "T8ff2ccdffe9a11f0878d43cd8a99e069",
      "run_id": "R8ff2ccdefe9a11f0878d43cd8a99e069",
      "task": {
        "objective": "Call the lead and discuss the project requirements."
      },
      "input": {
        "name": "John Doe",
        "contact_number": "1234567890",
        "email": "john@example.com",
        "context": "Follow up on proposal"
      },
      "output": {
        "call_id": "CALL_7dAb3kR9mXvQ2pLw",
        "call_end_reason": "caller_hangup",
        "start_time": "2026-02-07T05:57:45Z",
        "end_time": "2026-02-07T06:02:30Z",
        "assistant_number": "+911234567890",
        "call_summary": "The agent successfully connected with John Doe and discussed project requirements. Lead expressed interest.",
        "duration": 285,
        "recording_url": "https://cdn.unpod.ai/recordings/CALL_7dAb3kR9mXvQ2pLw.mp3",
        "transcript": [
          {
            "role": "agent",
            "content": "Hello, this is an AI assistant calling on behalf of Unpod. Am I speaking with John Doe?"
          },
          {
            "role": "user",
            "content": "Yes, this is John."
          }
        ],
        "post_call_data": {
          "summary": "The agent successfully connected with John Doe and discussed project requirements.",
          "outcome": "interested",
          "sentiment": "positive"
        },
        "call_type": "outbound",
        "call_status": "completed"
      },
      "attachments": [],
      "assignee": "space-agent-8qmk42nslp91wrh3dz7btxc4",
      "status": "completed",
      "execution_type": "call",
      "ref_id": "6902fb5840a736e125e80ebc",
      "failure_count": 0,
      "last_failure_reason": null,
      "retry_attempt": 0,
      "last_status_change": "2026-02-07T06:02:35Z",
      "scheduled_timestamp": null
    }
  ]
}

Get Tasks by Agent Handle

Fetch all tasks assigned to a specific agent/pilot using their handle. This returns full task metadata including user info, input payloads, call output, transcripts, and execution details.
Prerequisites: Make sure you have your API Token ready. See Authentication for details.

Path Parameters

NameTypeRequiredDescription
agent_handlestringYesUnique handle/identifier of the agent
You can get the agent_handle by hitting the Get All Agents API. The handle field in the response is your Agent Handle.

Headers

NameTypeRequiredDescription
AuthorizationstringYesAPI Key format: Token <token>
Content-TypestringYesapplication/json

Response Fields

FieldTypeDescription
countintegerTotal number of tasks
status_codeintegerHTTP status code
messagestringResponse message
dataarrayArray of task objects

Task Object Fields

FieldTypeDescription
_idstringInternal task document ID
thread_idstringThread identifier
user_infoobjectUser details (email, full_name)
task_idstringUnique task identifier
run_idstringParent run identifier
taskobjectTask definition with objective
inputobjectInput data for the task
outputobjectTask output with call details
attachmentsarrayList of attachments
assigneestringAgent handle assigned to the task
statusstringTask status: pending, completed, failed
execution_typestringType of execution: call, email, etc.
ref_idstringReference ID linking to input data
failure_countintegerNumber of failed attempts
last_failure_reasonstringReason for last failure (null if none)
retry_attemptintegerCurrent retry attempt number
last_status_changestringTimestamp of last status change
scheduled_timestampstringScheduled execution timestamp (null if now)

Output Object Fields

FieldTypeDescription
call_idstringUnique call identifier
call_end_reasonstringReason for call ending
start_timestringCall start timestamp
end_timestringCall end timestamp
assistant_numberstringOutbound phone number used
call_summarystringAI-generated summary of the call
durationnumberCall duration in seconds
recording_urlstringURL to call recording
transcriptarrayArray of conversation messages
post_call_dataobjectPost-call analysis data
call_typestringDirection of call: outbound, inbound
call_statusstringStatus of the call: completed, etc.

Common Error Codes

Status CodeDescription
200Success - Data fetched successfully
206Partial Content - Business logic error occurred
400Bad Request - Invalid parameters provided
401Unauthorized - Invalid or missing API token
403Forbidden - Access denied to the resource
404Not Found - Agent not found
500Internal Server Error - Server-side error

Code Examples

const axios = require('axios');

const headers = {
  'Authorization': 'Token your-api-token',
  'Content-Type': 'application/json'
};

// Get tasks by agent handle
const getTasksByAgentHandle = async (agentHandle) => {
  const response = await axios.get(
    `https://unpod.ai/api/v2/platform/agents/${agentHandle}/tasks/`,
    { headers }
  );
  console.log(`Total tasks: ${response.data.count}`);
  response.data.data.forEach(task => {
    console.log(`Task ${task.task_id}: ${task.status} (${task.execution_type})`);
  });
  return response.data.data;
};

// Example usage
getTasksByAgentHandle('space-agent-8qmk42nslp91wrh3dz7btxc4');

Best Practices

  1. Agent Handle: Use the exact agent handle from the Get All Agents response
  2. Transcript Analysis: Use the transcript field in the output for detailed conversation analysis
  3. Retry Logic: Check failure_count and last_failure_reason for failed tasks to understand issues
  4. Recording Access: Store recording_url from output for compliance and quality review
  5. Security: Keep API tokens secure and rotate them regularly

Authorizations

Authorization
string
header
required

Format: Token

Headers

Org-Handle
string
required

Organization domain handle

Example:

"unpod.tv"

Path Parameters

agent_handle
string
required
Example:

"space-agent-8qmk42nslp91wrh3dz7btxc4"

Response

List of tasks for the agent