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

# Publish to base

> Publishes a project's text items to the base it's connected to.

Pass `textItemIds` to publish specific text items, or omit it to publish every text item that is Modified or New. Text items in Conflict (changed in both the project and the base since they last synced) are only acted on when named in `conflictResolutions`: `project` publishes the project's version to the base, and `base` reverts the project's text item to the base's version.

Text items that can't be published are skipped rather than failing the request; the response lists each one with the reason.

<Badge color="blue" shape="pill">BETA</Badge> This endpoint is part of a feature that is still in development and will not be available until the feature has been released.



## OpenAPI

````yaml openapi.json post /projects/{projectId}/publish
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:
  /projects/{projectId}/publish:
    post:
      tags:
        - Projects
      summary: Publish to base
      description: >-
        Publishes a project's text items to the base it's connected to.


        Pass `textItemIds` to publish specific text items, or omit it to publish
        every text item that is Modified or New. Text items in Conflict (changed
        in both the project and the base since they last synced) are only acted
        on when named in `conflictResolutions`: `project` publishes the
        project's version to the base, and `base` reverts the project's text
        item to the base's version.


        Text items that can't be published are skipped rather than failing the
        request; the response lists each one with the reason.


        <Badge color="blue" shape="pill">BETA</Badge> This endpoint is part of a
        feature that is still in development and will not be available until the
        feature has been released.
      parameters:
        - schema:
            type: string
            description: The Developer ID of the project to publish to its base
          required: true
          description: The Developer ID of the project to publish to its base
          name: projectId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                textItemIds:
                  type: array
                  items:
                    type: string
                  minItems: 1
                  description: >-
                    Developer IDs of the project text items to publish. If
                    omitted, every text item that is Modified or New is
                    published. Text items named in conflictResolutions don't
                    need to be listed here.
                conflictResolutions:
                  type: array
                  items:
                    type: object
                    properties:
                      textItemId:
                        type: string
                        description: >-
                          Developer ID of a project text item in Conflict with
                          its base text item
                      keep:
                        type: string
                        enum:
                          - project
                          - base
                        description: >-
                          The version to keep for this text item in Conflict.
                          `project` publishes the project's version to the base;
                          `base` reverts the project's text item to the base's
                          version. A resolution for a text item that isn't in
                          Conflict is skipped, not acted on.
                    required:
                      - textItemId
                      - keep
                  description: >-
                    Text items in Conflict (changed in both the project and the
                    base since they last synced) aren't published unless named
                    here with the version that wins. Text items named here don't
                    need to be repeated in textItemIds.
              example:
                textItemIds:
                  - welcome-header
                  - welcome-subheader
                conflictResolutions:
                  - textItemId: sign-in-button
                    keep: project
            examples:
              publish_all:
                summary: Publish every Modified or New text item
                value: {}
              publish_some:
                summary: Publish specific text items
                value:
                  textItemIds:
                    - welcome-header
                    - welcome-subheader
              resolve_conflicts:
                summary: Resolve text items in Conflict
                value:
                  conflictResolutions:
                    - textItemId: sign-in-button
                      keep: project
                    - textItemId: sign-up-button
                      keep: base
      responses:
        '200':
          description: >-
            Returns the text items that were published, reverted to the base's
            version, or skipped
          content:
            application/json:
              schema:
                type: object
                properties:
                  published:
                    type: array
                    items:
                      type: string
                    description: Developer IDs of the text items published to the base
                  revertedToBase:
                    type: array
                    items:
                      type: string
                    description: >-
                      Developer IDs of the text items in Conflict that were
                      reverted to the base's version
                  skipped:
                    type: array
                    items:
                      type: object
                      properties:
                        textItemId:
                          type: string
                          description: The Developer ID of the skipped text item
                        reason:
                          type: string
                          enum:
                            - unmodified
                            - outdated
                            - conflict
                            - not_in_conflict
                            - base_text_item_not_found
                          description: >-
                            One of: `unmodified` (unchanged since it last synced
                            with the base, so there's nothing to publish),
                            `outdated` (only the base has changed, so there's
                            nothing in the project to publish. Update it to the
                            base's version with `POST
                            /v2/projects/:projectId/updateFromBase`), `conflict`
                            (in Conflict: both the project and the base have
                            changed, and no conflict resolution was given. Name
                            it in conflictResolutions with the version that
                            wins), `not_in_conflict` (a conflict resolution was
                            given, but it isn't in Conflict),
                            `base_text_item_not_found` (the base text item it
                            was linked to no longer exists).
                      required:
                        - textItemId
                        - reason
                    description: >-
                      Text items that were not published. Lists every named text
                      item that was skipped; when publishing everything, lists
                      the text items in Conflict.
                required:
                  - published
                  - revertedToBase
                  - skipped
                example:
                  published:
                    - welcome-header
                    - sign-in-button
                  revertedToBase: []
                  skipped:
                    - textItemId: welcome-subheader
                      reason: outdated
        '400':
          description: >-
            Returned when the project doesn't exist, the project isn't connected
            to a base, a requested text item isn't in the project, or the same
            text item has more than one conflict resolution.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
              example:
                message: Project isn't connected to a base
        '409':
          description: >-
            Returned when the project is paired with a GitHub branch. A paired
            project publishes to its base when that branch is merged.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
              example:
                message: >-
                  This project is paired with the branch "feature/onboarding"
                  and publishes to the base when that branch is merged
      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.