> ## Documentation Index
> Fetch the complete documentation index at: https://myco-29fc6df6-sweetmantech-myc-3925-docs-document-the-apiar.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Task

> Create a new scheduled task. All fields are required. The response shape matches the GET endpoint (an array containing the created task).



## OpenAPI

````yaml POST /api/tasks
openapi: 3.1.0
info:
  title: Recoup API
  description: >-
    API documentation for the Recoup platform - an AI agent platform for the
    music industry
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://recoup-api.vercel.app
security:
  - apiKeyAuth: []
paths:
  /api/tasks:
    post:
      description: >-
        Create a new scheduled task. All fields are required. The response shape
        matches the GET endpoint (an array containing the created task).
      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
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CreateTaskRequest:
      type: object
      required:
        - title
        - prompt
        - schedule
        - account_id
        - artist_account_id
      properties:
        title:
          type: string
          description: Descriptive title of the task
          example: Weekly Genre Pulse Check
        prompt:
          type: string
          description: Instruction/prompt executed by the task
          example: >-
            Execute this weekly genre analysis workflow and email a summary to
            the team.
        schedule:
          type: string
          description: >-
            Cron expression defining when the task runs (e.g., '0 9 * * 4' for
            Thursdays at 9 AM)
          example: 0 9 * * 4
        account_id:
          type: string
          format: uuid
          description: UUID of the associated account
          example: 848cd58d-700f-4b38-ab4c-d9f52a1b2c3d
        artist_account_id:
          type: string
          format: uuid
          description: UUID of the associated artist account
          example: 1873859c-dd37-4e9a-9bac-80d35a1b2c3d
    TasksResponse:
      type: object
      required:
        - status
        - tasks
      properties:
        status:
          type: string
          enum:
            - success
            - error
          description: Status of the request
        tasks:
          type: array
          items:
            $ref: '#/components/schemas/Task'
          description: Array of task objects
        error:
          type: string
          description: Error message (only present if status is error)
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
    Task:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the task
        title:
          type: string
          description: Descriptive title or name of the task
        prompt:
          type: string
          description: Detailed instruction or prompt for task execution
        schedule:
          type: string
          description: >-
            Cron expression defining when the task should execute (e.g., '0 10 *
            * *')
        account_id:
          type: string
          format: uuid
          description: Unique identifier for the associated account
        artist_account_id:
          type: string
          format: uuid
          description: Unique identifier for the associated artist account
        enabled:
          type: boolean
          nullable: true
          description: Whether the task is enabled. Defaults to true.
        trigger_schedule_id:
          type: string
          nullable: true
          description: Identifier for the trigger schedule associated with this task
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Your Recoup API key. [Learn more](/quickstart#api-keys).

````