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

# Discard unpublished component changes

> Discards the unpublished changes on library components by their Developer IDs. The components' published values, versions, and instances are unchanged. Components with no unpublished changes are left as they are and returned in `skippedIds`.

The operation is all-or-nothing: if any Developer ID does not match a component, nothing is discarded.

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



## OpenAPI

````yaml openapi.json delete /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:
    delete:
      tags:
        - Components
      summary: Discard unpublished component changes
      description: >-
        Discards the unpublished changes on library components by their
        Developer IDs. The components' published values, versions, and instances
        are unchanged. Components with no unpublished changes are left as they
        are and returned in `skippedIds`.


        The operation is all-or-nothing: if any Developer ID does not match a
        component, nothing is discarded.


        Only available in workspaces that have opted into library component
        versioning.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                componentIds:
                  type: array
                  items:
                    type: string
                  description: >-
                    Array of Developer IDs for the library components whose
                    unpublished changes should be discarded.
              required:
                - componentIds
              example:
                componentIds:
                  - component-id-1
                  - component-id-2
      responses:
        '200':
          description: >-
            Returns success status of the discard operation, the Developer IDs
            of the components whose unpublished changes were discarded, and the
            Developer IDs of any that had no unpublished changes
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Indicates whether the unpublished changes were discarded
                  discardedIds:
                    type: array
                    items:
                      type: string
                    description: >-
                      Developer IDs of the components whose unpublished changes
                      were discarded
                  skippedIds:
                    type: array
                    items:
                      type: string
                    description: >-
                      Developer IDs of requested components that had no
                      unpublished changes
                required:
                  - success
                  - discardedIds
                  - skippedIds
                example:
                  success: true
                  discardedIds:
                    - component-id-1
                  skippedIds:
                    - component-id-2
        '400':
          description: >-
            Returned when a Developer ID does not match any existing component
            in the workspace
          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.