> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ugc.inc/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Tasks

> Retrieve tasks with optional filters

## Endpoint

```
POST https://api.ugc.inc/tasks
```

## Overview

Retrieve tasks including warmup activities (scrolling, searching) and profile edit tasks. Use this endpoint to monitor and track all scheduled and completed tasks for your accounts.

## Task Types

* `warmup_scroll` - Account scrolling warmup activity
* `warmup_search_term` - Search term warmup activity
* `warmup_search_profile` - Profile search warmup activity
* `edit_profile` - Profile update task (nickname, avatar, bio)
* `update_posts` - Post update task

## Request Body

<ParamField body="accountIds" type="string[]">
  Array of account IDs to filter tasks by
</ParamField>

<ParamField body="startDate" type="string">
  Start date in ISO 8601 format (e.g., `2024-01-01T00:00:00Z`)
</ParamField>

<ParamField body="endDate" type="string">
  End date in ISO 8601 format (e.g., `2024-12-31T23:59:59Z`)
</ParamField>

<ParamField body="taskType" type="TaskType">
  Filter by specific task type

  Options: `warmup_scroll`, `warmup_search_term`, `warmup_search_profile`, `edit_profile`, `update_posts`
</ParamField>

## Response

<ResponseField name="data" type="Task[]">
  Array of task objects

  <Expandable title="Task properties">
    <ResponseField name="id" type="string">
      Unique task identifier
    </ResponseField>

    <ResponseField name="account_id" type="string">
      ID of the account this task belongs to
    </ResponseField>

    <ResponseField name="type" type="TaskType">
      Task type
    </ResponseField>

    <ResponseField name="status" type="string">
      Current status: `scheduled`, `pending`, `complete`, or `failed`
    </ResponseField>

    <ResponseField name="scheduled_time" type="string | null">
      ISO 8601 timestamp when task should execute
    </ResponseField>

    <ResponseField name="duration" type="number | null">
      Task duration in seconds (for warmup tasks)
    </ResponseField>

    <ResponseField name="keywords" type="string | null">
      Keywords for search tasks (text string)
    </ResponseField>

    <ResponseField name="edit_profile_info" type="object | null">
      Profile update details (for `edit_profile` tasks)

      <Expandable title="EditProfileInfo properties">
        <ResponseField name="avatarUrl" type="string">
          New avatar URL
        </ResponseField>

        <ResponseField name="nickName" type="string">
          New display name
        </ResponseField>

        <ResponseField name="bio" type="string">
          New bio text
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="created_at" type="string">
      ISO 8601 timestamp when task was created
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.ugc.inc/tasks \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "accountIds": ["acc_123456", "acc_789012"],
      "taskType": "edit_profile",
      "startDate": "2024-01-01T00:00:00Z",
      "endDate": "2024-12-31T23:59:59Z"
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.ugc.inc/tasks',
      headers={
          'Authorization': 'Bearer YOUR_API_KEY',
          'Content-Type': 'application/json'
      },
      json={
          'accountIds': ['acc_123456', 'acc_789012'],
          'taskType': 'edit_profile',
          'startDate': '2024-01-01T00:00:00Z',
          'endDate': '2024-12-31T23:59:59Z'
      }
  )

  data = response.json()

  if data['ok']:
      for task in data['data']:
          print(f"Task {task['id']}: {task['type']} - {task['status']}")
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.ugc.inc/tasks', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      accountIds: ['acc_123456', 'acc_789012'],
      taskType: 'edit_profile',
      startDate: '2024-01-01T00:00:00Z',
      endDate: '2024-12-31T23:59:59Z'
    })
  });

  const data = await response.json();

  if (data.ok) {
    data.data.forEach(task => {
      console.log(`Task ${task.id}: ${task.type} - ${task.status}`);
    });
  }
  ```

  ```typescript React theme={null}
  import { UGCClient } from 'ugcinc';

  const client = new UGCClient({
    apiKey: 'YOUR_API_KEY'
  });

  const response = await client.tasks.getTasks({
    accountIds: ['acc_123456', 'acc_789012'],
    taskType: 'edit_profile',
    startDate: '2024-01-01T00:00:00Z',
    endDate: '2024-12-31T23:59:59Z'
  });

  if (response.ok) {
    response.data.forEach(task => {
      console.log(`Task ${task.id}:`);
      console.log(`  Type: ${task.type}`);
      console.log(`  Status: ${task.status}`);
      console.log(`  Scheduled: ${task.scheduled_time}`);
    });
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "ok": true,
    "code": 200,
    "message": "Success",
    "data": [
      {
        "id": "task_abc123",
        "account_id": "acc_123456",
        "type": "edit_profile",
        "status": "scheduled",
        "scheduled_time": "2024-12-31T12:00:00Z",
        "duration": null,
        "keywords": null,
        "edit_profile_info": {
          "nickName": "New Display Name",
          "bio": "Updated bio text"
        },
        "created_at": "2024-12-25T10:00:00Z"
      },
      {
        "id": "task_def456",
        "account_id": "acc_789012",
        "type": "warmup_scroll",
        "status": "complete",
        "scheduled_time": "2024-12-26T15:00:00Z",
        "duration": 300,
        "keywords": null,
        "edit_profile_info": null,
        "created_at": "2024-12-25T11:00:00Z"
      }
    ]
  }
  ```
</ResponseExample>
