Skip to content

Get Tasks

Retrieve scheduled tasks from the database. Tasks have cron-based execution schedules.

You can filter tasks using the following optional parameters:

  • If id is provided, returns a single task matching that ID
  • If account_id is provided, returns only tasks for that account
  • If artist_account_id is provided, returns only tasks for that artist account

If no parameters are provided, returns an array of all tasks.

Endpoint

GET https://api.recoupable.com/api/tasks

GET Parameters

NameTypeRequiredDescription
idstringNoOptional. Returns a single task matching the provided ID.
account_idstringNoOptional. Filter tasks to only include those for the specified account.
artist_account_idstringNoOptional. Filter tasks to only include those for the specified artist account.

Request Examples

cURL
# Get all tasks
curl -X GET "https://api.recoupable.com/api/tasks" \
  -H "Content-Type: application/json"
 
# Get a single task by ID
curl -X GET "https://api.recoupable.com/api/tasks?id=aade2bce-55c7-468e-a606-c4e76fb2ea2k" \
  -H "Content-Type: application/json"
 
# Filter tasks by account_id
curl -X GET "https://api.recoupable.com/api/tasks?account_id=848cd58d-700f-4b38-ab4c-d9f52a1b2c3d" \
  -H "Content-Type: application/json"
 
# Filter tasks by artist_account_id
curl -X GET "https://api.recoupable.com/api/tasks?artist_account_id=1873859c-dd37-4e9a-9bac-80d35a1b2c3d" \
  -H "Content-Type: application/json"

Response Format

The API returns JSON responses with task data. When an id parameter is provided, the response contains a single task in the array. When omitted, all tasks are returned.

{
  "status": "success",
  "tasks": [
    {
      "id": "aade2bce-55c7-468e-a606-c4e76fb2ea2k",
      "title": "Daily Hip-Hop History Caption and Email",
      "prompt": "Search the web for the most culturally significant hip-hop event that happened on this date in history, then create a compelling social media caption and email to send to the artist's fanbase.",
      "schedule": "0 10 * * *",
      "account_id": "df1652b7-9a8e-4f3c-8b2d-1e4f5a6b7c8d",
      "artist_account_id": "1873859c-dd37-4e9a-9bac-80d35a1b2c3d",
      "enabled": true,
      "trigger_schedule_id": null
    },
    {
      "id": "6388ca52-b1b7-41e7-a48d-404b4d05016f",
      "title": "Daily Trends Report: Sunday (1994) - 9AM",
      "prompt": "Daily task for artist_account_id: 6606edd... Generate a comprehensive trends report covering music industry news, social media trends, and relevant cultural events.",
      "schedule": "0 9 * * *",
      "account_id": "d15d5708-700f-4b38-ab4c-d9f52a1b2c3d",
      "artist_account_id": "1873859c-dd37-4e9a-9bac-80d35a1b2c3d",
      "enabled": true,
      "trigger_schedule_id": null
    },
    {
      "id": "e32aa16b-7069-4c29-8935-fadf7bca8471",
      "title": "Weekly New Fan Finder",
      "prompt": "Check if file 'weekly_new_fan_finder.txt' exists. If not, run the new fan discovery workflow to identify and analyze new fans across all social platforms.",
      "schedule": "0 10 * * 2",
      "account_id": "848cd58d-700f-4b38-ab4c-d9f52a1b2c3d",
      "artist_account_id": "1873859c-dd37-4e9a-9bac-80d35a1b2c3d",
      "enabled": true,
      "trigger_schedule_id": null
    }
  ]
}
{
  "status": "success",
  "tasks": [
    {
      "id": "aade2bce-55c7-468e-a606-c4e76fb2ea2k",
      "title": "Daily Hip-Hop History Caption and Email",
      "prompt": "Search the web for the most culturally significant hip-hop event that happened on this date in history, then create a compelling social media caption and email to send to the artist's fanbase.",
      "schedule": "0 10 * * *",
      "account_id": "df1652b7-9a8e-4f3c-8b2d-1e4f5a6b7c8d",
      "artist_account_id": "1873859c-dd37-4e9a-9bac-80d35a1b2c3d",
      "enabled": true
    }
  ]
}

Response Properties

Response Object

PropertyTypeDescription
statusstringStatus of the request ("success" or "error")
tasksarrayArray of task objects (single item if id provided)
errorstringError message (only present if status is "error")

Task Object

PropertyTypeDescription
idstringUnique identifier for the task (UUID)
titlestringDescriptive title or name of the task
promptstringDetailed instruction or prompt associated with the task execution
schedulestringCron expression defining when the task should execute (e.g., "0 10 * * *")
account_idstringUnique identifier for the associated account (UUID)
artist_account_idstringUnique identifier for the associated artist account (UUID)
enabledbooleanWhether the task is enabled. Defaults to true if not specified. Can be null.
trigger_schedule_idstringIdentifier for the trigger schedule associated with this task. Can be null.

Schedule Format (Cron)

The schedule field uses standard cron expression format:

┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of month (1 - 31)
│ │ │ ┌───────────── month (1 - 12)
│ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday)
│ │ │ │ │
* * * * *

Common Examples

  • 0 10 * * * - Daily at 10:00 AM
  • 0 9 * * * - Daily at 9:00 AM
  • 0 10 * * 2 - Every Tuesday at 10:00 AM
  • 0 16 * * 5 - Every Friday at 4:00 PM
  • 0 9 * * 1 - Every Monday at 9:00 AM

Database Schema

This endpoint queries the scheduled_actions table:

Scheduled Actions Table

  • Primary Key: id (uuid, not null, default gen_random_uuid())
  • Fields:
    • title (text, not null) - Task title
    • prompt (text, not null) - Task execution prompt/instructions
    • schedule (text, not null) - Cron expression for task scheduling
    • account_id (uuid, not null) - Foreign key to accounts table
    • artist_account_id (uuid, not null) - Foreign key to artist accounts table
    • enabled (boolean, null, default true) - Task enable/disable flag
    • trigger_schedule_id (text, null) - Identifier for the trigger schedule associated with this task