Skip to main content
GET
/
api
/
v2
/
platform
/
spaces
/
{space_token}
/
tasks
Get Tasks by Space Token
curl --request GET \
  --url https://unpod.ai/api/v2/platform/spaces/{space_token}/tasks/ \
  --header 'Authorization: <api-key>' \
  --header 'Org-Handle: <org-handle>'
{
  "count": 45,
  "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",
        "start_time": "2026-02-07T05:57:45Z",
        "end_time": "2026-02-07T06:02:30Z",
        "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"
      },
      "assignee": "space-agent-8qmk42nslp91wrh3dz7btxc4",
      "status": "completed",
      "execution_type": "call",
      "run_mode": "prod",
      "created": "2026-02-07T05:57:45Z",
      "modified": "2026-02-07T06:02:35Z"
    }
  ]
}
{
  "count": 45,
  "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",
        "start_time": "2026-02-07T05:57:45Z",
        "end_time": "2026-02-07T06:02:30Z",
        "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"
      },
      "assignee": "space-agent-8qmk42nslp91wrh3dz7btxc4",
      "status": "completed",
      "execution_type": "call",
      "run_mode": "prod",
      "created": "2026-02-07T05:57:45Z",
      "modified": "2026-02-07T06:02:35Z"
    }
  ]
}

Get Tasks by Space Token

Fetch all tasks for a specific space using the space token. Supports pagination with page and page_size query parameters for efficient data retrieval.
Prerequisites: Make sure you have your API Token ready. See Authentication for details.

Get Tasks by Space Token

Retrieve all tasks associated with a specific space, with optional pagination.
GET /api/v2/platform/spaces/{space_token}/tasks/

Path Parameters

NameTypeRequiredDescription
space_tokenstringYesPublic token identifying the workspace
You can get the space_token by hitting the Get All Spaces API. The token field in the response is your Space Token.

Query Parameters

NameTypeRequiredDescription
pageintegerNoPage number for pagination (default = 1)
page_sizeintegerNoNumber of tasks per page (default = 20)

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
assigneestringAgent handle assigned to the task
statusstringTask status: pending, completed, failed
execution_typestringType of execution: call, email, etc.
run_modestringExecution mode: dev, prod, etc.
createdstringTask creation timestamp
modifiedstringLast modified timestamp

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 - Space 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 space token with pagination
const getTasksBySpace = async (spaceToken, page = 1, pageSize = 20) => {
  const response = await axios.get(
    `https://unpod.ai/api/v2/platform/spaces/${spaceToken}/tasks/`,
    {
      headers,
      params: { page, page_size: pageSize }
    }
  );
  console.log(`Total tasks: ${response.data.count}`);
  response.data.data.forEach(task => {
    console.log(`Task ${task.task_id}: ${task.status}`);
  });
  return response.data.data;
};

// Example usage
getTasksBySpace('your-space-token', 1, 20);

Best Practices

  1. Pagination: Use page and page_size parameters for efficient data retrieval in large datasets
  2. Space Token: Ensure you are using a valid space token from your organization
  3. Error Handling: Always handle potential errors and edge cases
  4. Status Filtering: Filter tasks by status in your application logic to focus on relevant tasks
  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

space_token
string
required
Example:

"8KZAMRAHSXXXXXXMAYNASMJC"

Query Parameters

page
integer
Example:

1

page_size
integer
Example:

20

Response

List of tasks in the space