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

# Link two tasks

> Links both sides. Linking a pair again replaces its type. The task's space must have related tasks switched on, and a task can have at most 50 links.



## OpenAPI

````yaml /api-reference/endpoint/workspaces/openapi.json put /workspaces/task-relation
openapi: 3.1.0
info:
  title: Workspaces API
  version: 1.1.0
  description: >-
    Spaces, tasks, task actions, comments, folders and the task-sync routes.
    Task-sync routes also accept an integration token (`oauth2`); every other
    route needs a user session or API key.
servers:
  - url: https://api.quiva.ai
    description: Production API server
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: Tasks
  - name: Files
  - name: Folders
  - name: Task Schedules
  - name: Distribution
paths:
  /workspaces/task-relation:
    put:
      tags:
        - Task Relations
      summary: Link two tasks
      description: >-
        Links both sides. Linking a pair again replaces its type. The task's
        space must have related tasks switched on, and a task can have at most
        50 links.
      operationId: linkTasks
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - task_id
                - related_task_id
                - type
              properties:
                task_id:
                  type: string
                related_task_id:
                  type: string
                type:
                  $ref: '#/components/schemas/TaskRelationType'
      responses:
        '200':
          description: The task's links after the change
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskRelationList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          description: Related tasks are off in the space.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - bearerAuth: []
        - apiKeyAuth: []
components:
  schemas:
    TaskRelationType:
      type: string
      enum:
        - relates_to
        - blocks
        - is_blocked_by
        - duplicates
        - is_duplicated_by
        - clones
        - is_cloned_by
      description: The link as read from `task_id`'s side.
    TaskRelationList:
      type: object
      properties:
        results:
          type: array
          items:
            $ref: '#/components/schemas/TaskRelation'
        results_total:
          type: integer
    Error:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
          description: Stable machine code. Branch on this, not on `error`.
      required:
        - error
    TaskRelation:
      type: object
      properties:
        related_task_id:
          type: string
        type:
          type: string
          enum:
            - relates_to
            - blocks
            - duplicates
            - clones
        direction:
          type: string
          enum:
            - outward
            - inward
        label:
          type: string
          example: is blocked by
        created_by:
          type: string
        created_at:
          type: string
        task:
          type: object
          description: The related task as it stands now.
          properties:
            id:
              type: string
            title:
              type: string
            status:
              type: string
            status_name:
              type: string
            status_color:
              type: string
            status_complete:
              type: boolean
            space_id:
              type: string
            url:
              type: string
            archived:
              type: boolean
            parent:
              type: string
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

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