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

# Link text items to a component

> Links one or more existing text items to an existing library component by developer ID, so they share the component's text going forward.

Each linked text item takes on the component's current text, variables, variants, and other fields. Text items already linked to a different component are skipped.



## OpenAPI

````yaml openapi.json patch /components/link
openapi: 3.0.0
info:
  version: 1.0.0
  title: Ditto API
  description: Programmatically read and write data in your Ditto workspace.
servers:
  - url: https://api.dittowords.com/v2
security: []
paths:
  /components/link:
    patch:
      tags:
        - Components
      summary: Link text items to a component
      description: >-
        Links one or more existing text items to an existing library component
        by developer ID, so they share the component's text going forward.


        Each linked text item takes on the component's current text, variables,
        variants, and other fields. Text items already linked to a different
        component are skipped.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                componentId:
                  type: string
                  description: Developer ID of the library component to link text items to.
                textItemIds:
                  type: array
                  items:
                    type: string
                  minItems: 1
                  description: >-
                    Developer IDs of the text items to link to this component.
                    Text items already linked to a different component are
                    skipped.
              required:
                - componentId
                - textItemIds
              example:
                componentId: component-id-1
                textItemIds:
                  - text-item-id-1
                  - text-item-id-2
      responses:
        '200':
          description: >-
            Returns success status of the link operation, the number of text
            items actually linked, and the developer IDs of any that were
            skipped because they're already linked to a different component
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Indicates whether the link operation was successful
                  linkedCount:
                    type: number
                    description: The number of text items actually linked to the component.
                  skippedDeveloperIds:
                    type: array
                    items:
                      type: string
                    description: >-
                      Developer IDs from the request that were skipped because
                      they're already linked to a different component.
                required:
                  - success
                  - linkedCount
                  - skippedDeveloperIds
                example:
                  success: true
                  linkedCount: 2
                  skippedDeveloperIds: []
        '400':
          description: >-
            Returned when the component developer ID or a text item developer ID
            does not match any existing component or text item
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message describing the validation failure
                required:
                  - message
              example:
                message: Component with developer ID component-id-1 not found
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````