Get Tasks
Retrieve scheduled tasks from the database. Tasks have cron-based execution schedules.
You can filter tasks using the following optional parameters:
- If
idis provided, returns a single task matching that ID - If
account_idis provided, returns only tasks for that account - If
artist_account_idis 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/tasksGET Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | No | Optional. Returns a single task matching the provided ID. |
| account_id | string | No | Optional. Filter tasks to only include those for the specified account. |
| artist_account_id | string | No | Optional. 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
| Property | Type | Description |
|---|---|---|
| status | string | Status of the request ("success" or "error") |
| tasks | array | Array of task objects (single item if id provided) |
| error | string | Error message (only present if status is "error") |
Task Object
| Property | Type | Description |
|---|---|---|
| id | string | Unique identifier for the task (UUID) |
| title | string | Descriptive title or name of the task |
| prompt | string | Detailed instruction or prompt associated with the task execution |
| schedule | string | Cron expression defining when the task should execute (e.g., "0 10 * * *") |
| account_id | string | Unique identifier for the associated account (UUID) |
| artist_account_id | string | Unique identifier for the associated artist account (UUID) |
| enabled | boolean | Whether the task is enabled. Defaults to true if not specified. Can be null. |
| trigger_schedule_id | string | Identifier 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 AM0 9 * * *- Daily at 9:00 AM0 10 * * 2- Every Tuesday at 10:00 AM0 16 * * 5- Every Friday at 4:00 PM0 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 titleprompt(text, not null) - Task execution prompt/instructionsschedule(text, not null) - Cron expression for task schedulingaccount_id(uuid, not null) - Foreign key to accounts tableartist_account_id(uuid, not null) - Foreign key to artist accounts tableenabled(boolean, null, default true) - Task enable/disable flagtrigger_schedule_id(text, null) - Identifier for the trigger schedule associated with this task