> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentarea.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Task Definition

> Save a task: the agent, what to ask it, and the parameters.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/workspaces/{workspace}/task-definitions/
openapi: 3.1.0
info:
  description: >-
    Modular and extensible framework for building AI agents. This API requires
    JWT Bearer token authentication for most endpoints. Include your JWT token
    in the Authorization header. Public endpoints include /, /health, /docs,
    /redoc, and /openapi.json.
  title: AgentArea API
  version: 0.1.0
servers: []
security:
  - bearer: []
paths:
  /v1/workspaces/{workspace}/task-definitions/:
    post:
      tags:
        - v1
        - protected
        - task-definitions
      summary: Create Task Definition
      description: 'Save a task: the agent, what to ask it, and the parameters.'
      operationId: create_task_definition_v1_task_definitions__post
      parameters:
        - description: Slug of the workspace the request acts in
          in: path
          name: workspace
          required: true
          schema:
            description: Slug of the workspace the request acts in
            maxLength: 120
            pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$
            title: Workspace
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskDefinitionCreate'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskDefinitionResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - HTTPBearer: []
components:
  schemas:
    TaskDefinitionCreate:
      additionalProperties: false
      description: 'A saved task: the agent, what to ask it, and the parameters to ask with.'
      properties:
        agent_id:
          description: UUID of the agent that runs the task.
          format: uuid
          title: Agent Id
          type: string
        description:
          description: What the agent is asked to do each time the task runs.
          maxLength: 20000
          minLength: 1
          title: Description
          type: string
        name:
          description: What the saved task is called.
          maxLength: 255
          minLength: 1
          title: Name
          type: string
        parameters:
          additionalProperties: true
          description: Task parameters every run of it starts with, as on a run.
          title: Parameters
          type: object
      required:
        - name
        - description
        - agent_id
      title: TaskDefinitionCreate
      type: object
    TaskDefinitionResponse:
      properties:
        agent_id:
          format: uuid
          title: Agent Id
          type: string
        created_at:
          format: date-time
          title: Created At
          type: string
        created_by:
          title: Created By
          type: string
        description:
          title: Description
          type: string
        id:
          format: uuid
          title: Id
          type: string
        name:
          title: Name
          type: string
        parameters:
          additionalProperties: true
          title: Parameters
          type: object
        updated_at:
          format: date-time
          title: Updated At
          type: string
      required:
        - id
        - name
        - description
        - agent_id
        - parameters
        - created_by
        - created_at
        - updated_at
      title: TaskDefinitionResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    bearer:
      bearerFormat: JWT
      description: JWT Bearer token for authentication
      scheme: bearer
      type: http
    HTTPBearer:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.