> ## 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.

> ## Agent Instructions
> These are Ditto's developer docs. Ditto is a single source of truth for product copy across design, review, localization, and code.
> The first step on any codebase is a scan: https://developer.dittowords.com/get-started/scan-your-repo.md. That page also covers reviewing the style guide Ditto drafts from the scan. After it, the follow-on guides are Connect Figma files and Set up localization (under /guides/) and Connect the Ditto MCP (the Setup page of the MCP reference).
> Two different MCP servers: the Ditto MCP server at https://api.dittowords.com/v2/mcp gives an agent a workspace's text and style guide rules; the documentation MCP server at https://developer.dittowords.com/mcp searches these docs.
> Prefer logging in with a Ditto account (npx -y @dittowords/cli@latest login; OAuth in MCP clients) over API keys. API keys are for CI and headless clients only.
> Commands are complete as written and use npx -y @dittowords/cli@latest; nothing needs a global install.

# Save unpublished component changes

> Saves changes to library components without publishing them. The changes are not available to instances until they're published.

The operation is all-or-nothing: if any update is invalid, nothing is saved.

Only available in workspaces that have opted into library component versioning.



## OpenAPI

````yaml openapi.json patch /components/staged
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/staged:
    patch:
      tags:
        - Components
      summary: Save unpublished component changes
      description: >-
        Saves changes to library components without publishing them. The changes
        are not available to instances until they're published.


        The operation is all-or-nothing: if any update is invalid, nothing is
        saved.


        Only available in workspaces that have opted into library component
        versioning.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                variantId:
                  type: string
                  description: >-
                    Developer ID of the target variant. If a component does not
                    already have the target variant, it will be added. Omit if
                    targeting base text.
                forceVariantCreation:
                  type: boolean
                  description: >-
                    If true, and the provided variantId is not found, create the
                    variant. A variant name will be generated based on the
                    passed in ID.
                richText:
                  type: string
                  enum:
                    - html
                  description: >-
                    When set to 'html', all `text` values in this request
                    (including plural text) are parsed as HTML and saved as rich
                    text. Supported formatting: `<strong>`/`<b>`, `<em>`/`<i>`,
                    `<u>`, `<s>`, and `<br>` for line breaks. `<sup>` and
                    `<sub>` are only supported for workspaces with superscript
                    and subscript enabled. Unsupported markup (for example
                    links, lists, or headings) is dropped and its text content
                    kept.


                    Note: Fully-bolded strings will have that bold styling
                    stripped, as Figma does not support bolding an entire text
                    layer this way.


                    When omitted, text is saved as plaintext and any markup is
                    stored literally.
                updates:
                  type: array
                  items:
                    type: object
                    properties:
                      developerId:
                        type: string
                        description: The component's developer ID
                      text:
                        type: string
                        description: >-
                          The text the component will be updated to. Text will
                          remain unchanged if unset. **Note:** Cannot be
                          combined with plurals in the same update object. To
                          update both the display text and other plural forms at
                          once, include the first plural form in the plurals
                          upsert array instead.
                      plurals:
                        type: object
                        properties:
                          upsert:
                            type: array
                            items:
                              type: object
                              properties:
                                form:
                                  type: string
                                  enum:
                                    - one
                                    - two
                                    - few
                                    - many
                                    - zero
                                    - other
                                  description: The plural form
                                text:
                                  type: string
                                  description: The text for this plural form
                              required:
                                - form
                                - text
                            description: >-
                              Array of plural forms to create or update. If a
                              plural with the given form already exists, its
                              text will be updated. Otherwise, a new plural will
                              be created. Each form may only appear once in the
                              array.
                          remove:
                            type: array
                            items:
                              type: string
                              enum:
                                - one
                                - two
                                - few
                                - many
                                - zero
                                - other
                            description: >-
                              Array of plural forms to remove from the text
                              item. Each form may only appear once. A form
                              cannot appear in both upsert and remove.
                        description: >-
                          Optional plural form updates. Existing plural forms
                          not mentioned in either upsert or remove are
                          preserved. The order of plurals matters: the first
                          plural form is the 'master' value whose text is used
                          as the text item's display text. New plurals are
                          appended after existing ones. If you need to change
                          which plural is first, remove and re-add them in the
                          desired order.
                      variables:
                        type: array
                        items:
                          type: string
                        description: >-
                          Developer IDs of variables (the `id` field from GET
                          /v2/variables) used in this update's text or plurals.
                          Text fields support `{{variable_name}}` placeholders
                          that will be resolved using the variables listed here.
                          Placeholders whose names are not in this list are kept
                          as literal text.
                      tags:
                        type: array
                        items:
                          type: string
                        description: >-
                          The set of tags that will be set on this component.
                          Other tags will be removed. If unset tags will remain
                          unchanged.
                      notes:
                        type: string
                        nullable: true
                        description: >-
                          Notes for the component. Use null or empty string to
                          clear notes. If not provided, notes will remain
                          unchanged.
                      characterLimit:
                        type: number
                        nullable: true
                        minimum: 1
                        description: >-
                          Character limit for the component. Use null to remove
                          the limit. If not provided, character limit will
                          remain unchanged.
                    required:
                      - developerId
                    additionalProperties: false
                  minItems: 1
                  description: >-
                    Array of changes to save on components without publishing
                    them. Not every component field can be saved as an
                    unpublished change.
              required:
                - updates
              additionalProperties: false
              example:
                updates:
                  - developerId: component-id-1
                    text: Place order
                    notes: Shortened for mobile
            examples:
              save_base_text:
                summary: Save base text
                value:
                  updates:
                    - developerId: component-id-1
                      text: Place order
              save_variant_text:
                summary: Save variant text
                value:
                  variantId: french
                  updates:
                    - developerId: component-id-1
                      text: Passer la commande
              save_notes_and_tags:
                summary: Save notes and tags
                value:
                  updates:
                    - developerId: component-id-1
                      notes: Shortened for mobile
                      tags:
                        - checkout
      responses:
        '200':
          description: Returns success status of the save operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Indicates whether the changes were saved
                required:
                  - success
                example:
                  success: true
        '400':
          description: >-
            Returned when the request body fails validation. Common causes
            include: a Developer ID that does not match any existing component,
            a Developer ID repeated in `updates`, an update that includes a
            field that can't be saved as an unpublished change, such as
            `status`, an update with nothing to save, a variant ID that does not
            exist (when forceVariantCreation is not set), or providing both
            `text` and `plurals` in the same update object.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message describing why the request failed
                  details:
                    type: object
                    description: Optional additional error details
                required:
                  - message
              example:
                message: Component with developer ID component-id-1 not found
        '404':
          description: >-
            Returned when the workspace hasn't opted into library component
            versioning
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message describing why the request failed
                  details:
                    type: object
                    description: Optional additional error details
                required:
                  - message
              example:
                message: This workspace hasn't opted into library component versioning
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````

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