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

# Create task relation

> Link two tasks. Authorization is scoped to the source task's workspace.



## OpenAPI

````yaml /openapi.json post /task-relation
openapi: 3.1.0
info:
  title: Kaneo API
  version: 1.0.0
  description: Kaneo Project Management API - Manage projects, tasks, labels, and more
servers:
  - url: https://cloud.kaneo.app/api
    description: Kaneo API Server
security:
  - bearerAuth: []
paths:
  /task-relation:
    post:
      tags:
        - Task Relations
      summary: Create task relation
      description: Link two tasks. Authorization is scoped to the source task's workspace.
      operationId: createTaskRelation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                sourceTaskId:
                  type: string
                targetTaskId:
                  type: string
                relationType:
                  type: string
                  enum:
                    - subtask
                    - blocks
                    - related
              required:
                - sourceTaskId
                - targetTaskId
                - relationType
      responses:
        '200':
          description: The created relation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskRelation'
        '400':
          description: Invalid body
          content:
            text/plain:
              schema:
                type: string
        '401':
          description: Missing or invalid credentials
        '403':
          description: No workspace access, or missing task:update permission
          content:
            text/plain:
              schema:
                type: string
        '404':
          description: Source or target task not found
          content:
            text/plain:
              schema:
                type: string
        '409':
          description: This relation already exists
          content:
            text/plain:
              schema:
                type: string
components:
  schemas:
    TaskRelation:
      type: object
      properties:
        id:
          type: string
        sourceTaskId:
          type: string
        targetTaskId:
          type: string
        relationType:
          type: string
          description: 'How the two tasks relate: `subtask`, `blocks`, or `related`.'
        createdAt:
          type: string
          format: date-time
      required:
        - id
        - sourceTaskId
        - targetTaskId
        - relationType
        - createdAt
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key or session token (Bearer)

````