Skip to main content

Endpoint

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

Overview

Retry one or more failed tasks by resetting their status to scheduled and setting their scheduled time to now. This allows you to re-attempt tasks that previously failed (warmup activities, profile edits, etc.).
Important Restrictions:
  • You can only retry tasks with status failed
  • Tasks with other statuses (scheduled, pending, complete) cannot be retried using this endpoint
  • The retry will reset the scheduled time to the current time and change the status to scheduled

Request Body

taskIds
string[]
required
Array of task IDs to retryAll tasks must belong to your organization and must have status failed

Response

data
object
Retry result information

Error Cases

  • 400 Bad Request: Attempting to retry tasks that are not in failed status
  • 404 Not Found: Some tasks don’t exist or don’t belong to your organization
  • 400 Bad Request: No task IDs provided
curl -X POST https://api.ugc.inc/tasks/retry \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "taskIds": ["task_abc123", "task_def456"]
  }'
{
  "ok": true,
  "code": 200,
  "message": "Successfully retried 2 task(s)",
  "data": {
    "retried": 2,
    "ids": [
      "task_abc123",
      "task_def456"
    ]
  }
}

What Happens When You Retry

When you retry a failed task, the system:
  1. Updates the status from failed to scheduled
  2. Sets the scheduled time to the current time (now)
  3. Resets the retry count to 0
  4. Clears the old task ID to allow re-execution
  5. Queues the task for immediate processing
The task will be picked up by the task execution system and attempted again shortly.

Best Practices

Check task status before retrying:Always verify that tasks have failed before attempting to retry them. Use the Get Tasks endpoint to check task statuses first.
1

Fetch tasks

Use the Get Tasks endpoint to retrieve tasks and check their status
2

Filter failed tasks

Filter out tasks with status failed from your task list
3

Retry tasks

Call the retry endpoint with the filtered task IDs
4

Monitor status

Use the Get Tasks endpoint to track the retry attempt

Example: Automatic Retry Workflow

// Get all tasks
const tasksResponse = await client.tasks.getTasks();

if (tasksResponse.ok) {
  // Filter tasks that failed
  const failedTasks = tasksResponse.data.filter(
    task => task.status === 'failed'
  );
  
  if (failedTasks.length > 0) {
    console.log(`Found ${failedTasks.length} failed tasks`);
    
    const retryResponse = await client.tasks.retryTasks({
      taskIds: failedTasks.map(t => t.id)
    });
    
    if (retryResponse.ok) {
      console.log(`Retried ${retryResponse.data.retried} tasks`);
      
      // Wait a bit and check status
      await new Promise(resolve => setTimeout(resolve, 5000));
      
      const updatedResponse = await client.tasks.getTasks({
        taskIds: retryResponse.data.ids
      });
      
      if (updatedResponse.ok) {
        updatedResponse.data.forEach(task => {
          console.log(`Task ${task.id} status: ${task.status}`);
        });
      }
    }
  }
}

Common Task Failure Reasons

Tasks typically fail for reasons such as:
  • Temporary network issues - Retry usually succeeds
  • Account authentication expired - May need account re-authorization
  • Platform rate limits - Retry after waiting period
  • Invalid parameters - Check task configuration
  • Account not ready - Ensure account is properly initialized
If a task continues to fail after multiple retries, check the task details to identify the underlying issue. Some failures may require manual intervention or account re-configuration.