RecoupGet a Free AuditFree Audit

API REFERENCE

Create Task

On this page
POST/api/tasks

Create a new scheduled task that runs a prompt against an artist on a recurring cron schedule. The response matches the GET endpoint (a TasksResponse with the created task in the tasks array).

Authentication

See the authentication guide for API key and account access requirements.

Request

cURL
curl --request POST \
  --url 'https://api.recoupable.dev/api/tasks' \
  --header 'x-api-key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "title": "Weekly Genre Pulse Check",
  "prompt": "Execute this weekly genre analysis workflow and email a summary to the team.",
  "schedule": "0 9 * * 4",
  "artist_account_id": "1873859c-dd37-4e9a-9bac-80d35a1b2c3d"
}'

Request body required

Task to create

application/json

titlestringrequired

Descriptive title of the task

promptstringrequired

Instruction/prompt executed by the task

schedulestringrequired

Cron expression defining when the task runs (e.g., '0 9 * * 4' for Thursdays at 9 AM)

timezonestring

Optional IANA time zone (e.g. America/New_York) the cron schedule is interpreted in, DST-aware. Defaults to UTC. Applied to the Trigger.dev schedule (the source of truth); not stored separately.

Default: "UTC"

account_idstring

UUID of the account to create the task for. Only applicable when the authenticated account has access to multiple accounts via organization membership. If not provided, the task is created for the API key's own account.

format: uuid

artist_account_idstringrequired

UUID of the associated artist account

format: uuid

Responses

200Task created successfully

application/json

statusstring · enumrequired

Status of the request

Values: "success", "error"

tasksarray<Task>required

Array of task objects

Item properties for tasks
idstring

Unique identifier for the task

format: uuid

titlestring

Descriptive title or name of the task

promptstring

Detailed instruction or prompt for task execution

schedulestring

Cron expression defining when the task should execute (e.g., '0 10 * * *')

timezonestringnullable

IANA time zone the task's cron is interpreted in, read from the Trigger.dev schedule (the source of truth). Null when the task has no schedule or the timezone can't be read.

account_idstring

Unique identifier for the associated account

format: uuid

artist_account_idstring

Unique identifier for the associated artist account

format: uuid

enabledbooleannullable

Whether the task is enabled. Defaults to true.

trigger_schedule_idstringnullable

Identifier for the trigger schedule associated with this task

recent_runsarray<TaskRunResponse>

Last 5 runs for this task, sourced from the Trigger.dev API.

Item properties for recent_runs
idstringrequired

The unique run identifier, prefixed with run_

statusstring · enumrequired

Current run status

Values: "PENDING_VERSION", "DELAYED", "QUEUED", "EXECUTING", "REATTEMPTING", "FROZEN", "COMPLETED", "CANCELED", "FAILED", "CRASHED", "INTERRUPTED", "SYSTEM_FAILURE"

taskIdentifierstringrequired

The task type identifier (e.g. 'setup-sandbox', 'run-sandbox-command')

idempotencyKeystringnullable

Idempotency key used to deduplicate trigger requests

versionstring

The worker version that executed the run

isTestboolean

Whether this is a test run

createdAtstringrequired

When the run was created (ISO 8601)

format: date-time

updatedAtstringrequired

When the run was last updated (ISO 8601)

format: date-time

startedAtstringnullable

When execution started (null if not yet started)

format: date-time

finishedAtstringnullable

When the run finished (null if still running)

format: date-time

delayedUntilstringnullable

If delayed, when the run becomes eligible to execute

format: date-time

ttlanynullable

Time-to-live. If the run is not started within this duration, it expires.

expiredAtstringnullable

When the run expired (null if not expired)

format: date-time

tagsarray<string>

Tags associated with this run (max 10)

Item properties for tags

string

metadataobjectnullable

JSON metadata attached to the run

costInCentsnumber

Compute cost of the run in cents

baseCostInCentsnumber

Base invocation cost in cents

durationMsnumber

Compute duration in milliseconds

envobject

Environment the run executed in

Properties for env
idstring
namestring
userstringnullable
depthinteger

Nesting depth for child runs

batchIdstringnullable

Batch ID if triggered as part of a batch

triggerFunctionstring · enum

The function used to trigger this run

Values: "trigger", "triggerAndWait", "batchTrigger", "batchTriggerAndWait"

payloadanynullable

Input payload for the task. Only present when retrieving by runId.

outputone ofnullable

Task output data. Only present when retrieving by runId, and only populated when status is COMPLETED. Shape varies by taskIdentifier. The create-content task returns the schema below; other tasks return their own.

Properties for output
oneOf · CreateContentRunOutput 1

Output payload for a create-content task run. Returned in output when status is COMPLETED. Agents should poll /api/tasks/runs?runId=… and read these fields once the run is done.

videoSourceUrlstringrequired

URL to the rendered final 9:16 video (image + motion + audio + caption already composed).

format: uri

imageUrlstringrequired

URL to the base image used for video generation.

format: uri

captionTextstringrequired

The caption text burned into the video.

templatestringrequired

Template id used for this run (e.g. album-record-store, artist-caption-bedroom).

lipsyncboolean

Whether lipsync was applied (audio-driven mouth animation).

audioobject

Metadata about the song clip used in the final composition.

Properties for audio
songTitlestring
songFilenamestring
startSecondsnumber

Offset into the source song where the clip starts.

durationSecondsnumber

Length of the audio clip in seconds.

clipLyricsstringnullable

Lyrics for the chosen clip, when available.

clipMoodstringnullable

Inferred mood for the chosen clip, when available.

oneOf · object 2

Generic task output (for tasks not yet schema'd)

object

errorobjectnullable

Error details if the run failed. Only present when retrieving by runId.

Properties for error
messagestring

Human-readable error message

namestring

Error name or type

stackTracestring

Stack trace

attemptsarray<object>

Attempt history. Only present when retrieving by runId.

Item properties for attempts
idstring

Attempt ID, prefixed with attempt_

statusstring · enum

Values: "PENDING", "EXECUTING", "PAUSED", "COMPLETED", "FAILED", "CANCELED"

createdAtstring

format: date-time

updatedAtstring

format: date-time

startedAtstringnullable

format: date-time

completedAtstringnullable

format: date-time

errorobjectnullable
Properties for error
messagestring
namestring
stackTracestring
scheduleobjectnullable

Schedule information if triggered by a schedule. Only present when retrieving by runId.

relatedRunsobjectnullable

Related run references (root, parent, children). Only present when retrieving by runId.

upcomingarray<string>

Next scheduled run times.

Item properties for upcoming

string

owner_emailstringnullable

Primary email address for the task owner account when one exists.

artist_namestringnullable

Display name of the artist account the task runs for (artist_account_id), so a task list can label rows without a roster lookup. Null when the artist account no longer exists.

modelstringnullable

AI model identifier used when the task runs. When present as a string, must be non-empty; otherwise null if unset.

minLength: 1

errorstring

Error message (only present if status is error)

400Bad request - missing required fields or invalid body

application/json

errorintegerrequired

format: int32

messagestringrequired
401Unauthorized - missing or invalid credentials

application/json

errorintegerrequired

format: int32

messagestringrequired
402Payment required - the account's plan does not allow this task. limit is task_count when the account already has task_limit enabled tasks, or min_cadence when the cron schedule fires more often than min_cadence_minutes allows. Nothing is written; upgrade at billingUrl.

application/json

statusstring · enumrequired

Always error for this response shape

Values: "error"

errorstring · enumrequired

Machine-readable code. Literally plan_limit.

Values: "plan_limit"

limitstring · enumrequired

Which entitlement blocked the request: task_count (the plan's enabled-task cap is reached) or min_cadence (the cron fires more often than the plan allows).

Values: "task_count", "min_cadence"

messagestringrequired

Human-readable explanation naming the plan and the limit, suitable to show to a user.

planstring · enumrequired

The account's current plan, resolved from its subscription.

Values: "free", "starter", "pro"

task_limitintegerrequirednullable

Maximum enabled tasks on the current plan. Null means uncapped.

minimum: 1

min_cadence_minutesintegerrequired

Shortest allowed gap between two consecutive runs of a task on the current plan, in minutes (Free 10080, Starter 1440, Pro 60).

minimum: 1

current_task_countintegerrequired

Enabled tasks the account has right now, excluding the one being created or updated.

minimum: 0

billingUrlstringrequired

Static link to /plan in the Recoup app, where a human can upgrade. Constant; retrying creates nothing.

format: uri

Free account creating a second task

taskCount
{
  "status": "error",
  "error": "plan_limit",
  "limit": "task_count",
  "message": "Free includes 1 task. Starter includes 3, Pro is unlimited.",
  "plan": "free",
  "task_limit": 1,
  "min_cadence_minutes": 10080,
  "current_task_count": 1,
  "billingUrl": "https://app.recoupable.dev/plan"
}

Free account scheduling a daily task

minCadence
{
  "status": "error",
  "error": "plan_limit",
  "limit": "min_cadence",
  "message": "Free runs tasks weekly at most. Starter runs daily, Pro runs hourly.",
  "plan": "free",
  "task_limit": 1,
  "min_cadence_minutes": 10080,
  "current_task_count": 0,
  "billingUrl": "https://app.recoupable.dev/plan"
}

403Forbidden - account_id is outside caller authorization scope

application/json

errorintegerrequired

format: int32

messagestringrequired
500Internal server error

application/json

errorintegerrequired

format: int32

messagestringrequired

Full specification

Download the OpenAPI file for complete schemas, constraints, and examples.

Download releases.json
View operation source
json
{
  "description": "Create a new scheduled task that runs a prompt against an artist on a recurring cron schedule. The response matches the [GET endpoint](/api-reference/tasks/get) (a `TasksResponse` with the created task in the `tasks` array).",
  "requestBody": {
    "description": "Task to create",
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/CreateTaskRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Task created successfully",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/TasksResponse"
          }
        }
      }
    },
    "400": {
      "description": "Bad request - missing required fields or invalid body",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Unauthorized - missing or invalid credentials",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "402": {
      "description": "Payment required - the account's plan does not allow this task. `limit` is `task_count` when the account already has `task_limit` enabled tasks, or `min_cadence` when the cron schedule fires more often than `min_cadence_minutes` allows. Nothing is written; upgrade at `billingUrl`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/PlanLimitError"
          },
          "examples": {
            "taskCount": {
              "summary": "Free account creating a second task",
              "value": {
                "status": "error",
                "error": "plan_limit",
                "limit": "task_count",
                "message": "Free includes 1 task. Starter includes 3, Pro is unlimited.",
                "plan": "free",
                "task_limit": 1,
                "min_cadence_minutes": 10080,
                "current_task_count": 1,
                "billingUrl": "https://app.recoupable.dev/plan"
              }
            },
            "minCadence": {
              "summary": "Free account scheduling a daily task",
              "value": {
                "status": "error",
                "error": "plan_limit",
                "limit": "min_cadence",
                "message": "Free runs tasks weekly at most. Starter runs daily, Pro runs hourly.",
                "plan": "free",
                "task_limit": 1,
                "min_cadence_minutes": 10080,
                "current_task_count": 0,
                "billingUrl": "https://app.recoupable.dev/plan"
              }
            }
          }
        }
      }
    },
    "403": {
      "description": "Forbidden - account_id is outside caller authorization scope",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "500": {
      "description": "Internal server error",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}