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

> ## Agent Instructions
> Weaverse component configuration uses `settings`. `inspector` is deprecated; never generate it.
> Weaverse Hydrogen themes use React Router v7: import from `react-router`, never `react-router-dom` or `@remix-run/*`.
> Define component schemas with `createSchema()` from `@weaverse/hydrogen` (React Router themes) or `@weaverse/next` (Next.js themes).
> These docs cover @weaverse/hydrogen, @weaverse/react and @weaverse/core 5.x, and @weaverse/next 1.x. Do not use APIs from other major versions.
> For live project data (pages, theme settings, translations), use the Weaverse MCP server: https://docs.weaverse.io/developer-tools/weaverse-mcp

# Update theme settings

> Shallow-merges `theme` over the project's own theme settings. Send only the top-level keys you want to change; `theme` must contain at least one key.

**Nested objects are replaced wholesale.** Fetch the current settings first when you need to preserve sibling values inside a nested object.

- Writes the project's own config only; a parent project's theme is never changed through a child project.
- `updatedKeys` lists the top-level keys whose stored value actually changed. It is empty for a no-op patch, in which case no cache invalidation happens.
- When values change, a theme version snapshot (restorable from Studio) is attempted before the write. Snapshots are deduplicated and best-effort, so do not assume every update has one.
- After a change, caches are invalidated like a Studio save so the edit goes live through api.weaverse.io. Propagation time is not guaranteed; read the settings again to verify.
- Clients or proxies that strip `PATCH` bodies may send `POST` to the same URL.

Concurrency: pass the `revision` from your GET as `expectedRevision`. If the settings changed since, the request returns `409 STALE_PROJECT` and writes nothing; re-read and reapply. Delegated (MCP OAuth) tokens must send it (`428 PRECONDITION_REQUIRED` otherwise); it is optional for API keys.

Required scope: `content:write`



## OpenAPI

````yaml https://studio.weaverse.io/api/v1/content/openapi.json patch /projects/{projectId}/theme-settings
openapi: 3.1.0
info:
  title: Weaverse Content API
  version: 1.0.0
  description: >-
    Authenticated REST API for querying Weaverse-managed content (projects,
    pages, theme settings, languages) and for reading and writing per-locale
    translations.
servers:
  - url: https://studio.weaverse.io/api/v1/content
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Projects
    description: List, read, rename, create, copy and delete projects.
  - name: Pages
    description: List, read, create, update and delete the pages of a project.
  - name: Drafts and publishing
    description: >-
      Edit page drafts, then publish, schedule, restore and manage page
      versions.
  - name: Global sections
    description: Read, edit and publish sections shared across pages.
  - name: Page settings
    description: Read and edit page-level settings such as SEO metadata.
  - name: Assignments
    description: Map Shopify resources and routes to Weaverse pages and templates.
  - name: Theme settings
    description: Read and update a project's theme settings.
  - name: Languages and localization
    description: List project languages and manage locales, static text and glossary.
  - name: Translations
    description: >-
      Read and write per-locale translations, built for external translation
      agents.
  - name: Project structure
    description: Manage project variants and the project hierarchy.
  - name: Backups and portability
    description: Back up, restore, export and import project content.
  - name: Previews and hostnames
    description: Create preview links and manage the hostnames a project accepts.
  - name: Specification
    description: This OpenAPI document.
paths:
  /projects/{projectId}/theme-settings:
    patch:
      tags:
        - Theme settings
      summary: Update theme settings
      description: >-
        Shallow-merges `theme` over the project's own theme settings. Send only
        the top-level keys you want to change; `theme` must contain at least one
        key.


        **Nested objects are replaced wholesale.** Fetch the current settings
        first when you need to preserve sibling values inside a nested object.


        - Writes the project's own config only; a parent project's theme is
        never changed through a child project.

        - `updatedKeys` lists the top-level keys whose stored value actually
        changed. It is empty for a no-op patch, in which case no cache
        invalidation happens.

        - When values change, a theme version snapshot (restorable from Studio)
        is attempted before the write. Snapshots are deduplicated and
        best-effort, so do not assume every update has one.

        - After a change, caches are invalidated like a Studio save so the edit
        goes live through api.weaverse.io. Propagation time is not guaranteed;
        read the settings again to verify.

        - Clients or proxies that strip `PATCH` bodies may send `POST` to the
        same URL.


        Concurrency: pass the `revision` from your GET as `expectedRevision`. If
        the settings changed since, the request returns `409 STALE_PROJECT` and
        writes nothing; re-read and reapply. Delegated (MCP OAuth) tokens must
        send it (`428 PRECONDITION_REQUIRED` otherwise); it is optional for API
        keys.


        Required scope: `content:write`
      operationId: updateThemeSettings
      parameters:
        - name: projectId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - theme
              properties:
                theme:
                  type: object
                  minProperties: 1
                  description: >-
                    Top-level theme settings keys to merge. Must be a non-empty
                    object.
                expectedRevision:
                  type:
                    - string
                    - 'null'
                  format: date-time
                  description: >-
                    Optimistic-concurrency token: the `revision` value from the
                    GET read this patch was based on (`null` when GET returned
                    null for a project whose revision was never set; compared
                    null-safely). Required for delegated (MCP OAuth) tokens —
                    omitted → 428 PRECONDITION_REQUIRED; optional for API keys.
                    When the settings changed since (e.g. a concurrent studio
                    save), the request is rejected with 409 STALE_PROJECT before
                    anything is written. Re-read and reapply instead of retrying
                    the same patch.
            example:
              theme:
                colorPrimary: '#1e40af'
                pageWidth: 1440
              expectedRevision: '2026-10-12T09:41:27.000Z'
      responses:
        '200':
          description: Merge result with the full stored theme
          content:
            application/json:
              schema:
                type: object
                properties:
                  object:
                    type: string
                    enum:
                      - theme_settings_update
                  projectId:
                    type: string
                  updatedKeys:
                    type: array
                    items:
                      type: string
                    description: >-
                      Top-level keys whose stored value actually changed. Empty
                      when the merge was a no-op (no cache invalidation happens
                      in that case).
                  theme:
                    type: object
                    description: >-
                      The full merged theme now stored on the project's own
                      config.
              example:
                object: theme_settings_update
                projectId: clz1k8m2n0000abcd1234efgh
                updatedKeys:
                  - colorPrimary
                  - pageWidth
                theme:
                  colorBackground: '#ffffff'
                  colorText: '#1a1a1a'
                  colorPrimary: '#1e40af'
                  headingFont: Inter
                  bodyFont: Inter
                  pageWidth: 1440
        '400':
          description: >-
            Invalid body (missing/empty `theme`, non-object body, or invalid
            JSON)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            Forbidden, or INSUFFICIENT_SCOPE: a delegated token without
            `content:write`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Project not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '405':
          description: Method not allowed (use PATCH or POST)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            STALE_PROJECT: the settings changed since the caller's read
            (expectedRevision mismatch — re-read and reapply)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                object: error
                code: STALE_PROJECT
                message: >-
                  Theme settings changed since your last read (expectedRevision
                  mismatch). Re-read the settings and reapply your patch.
                status: 409
        '428':
          description: >-
            PRECONDITION_REQUIRED: a delegated (MCP OAuth) token omitted
            `expectedRevision`. API keys never receive this.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      required:
        - object
        - code
        - message
        - status
      properties:
        object:
          type: string
          enum:
            - error
        code:
          type: string
          enum:
            - UNAUTHORIZED
            - FORBIDDEN
            - INSUFFICIENT_SCOPE
            - PROJECT_NOT_FOUND
            - PAGE_NOT_FOUND
            - STALE_PAGE
            - STALE_PROJECT
            - STALE_TRANSLATION
            - TRANSLATION_UNIT_NOT_FOUND
            - SERVICE_UNAVAILABLE
            - CONFLICT
            - PRECONDITION_REQUIRED
            - INVALID_PARAMS
            - INTERNAL_ERROR
        message:
          type: string
        status:
          type: integer
        details:
          description: >-
            Optional machine-readable context, for example the clashing handles
            of a 409 CONFLICT.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: WEAVERSE_API_KEY
      description: >-
        Bearer authentication: a shop API key (WEAVERSE_API_KEY), a scoped API
        key, a delegated MCP OAuth token, or (translation-unit routes only) a
        project-bound translation agent token. Scopes: content:read — Read
        projects, pages, theme settings, versions, drafts and translation units.
        content:write — Save drafts and make non-destructive edits (page items,
        metadata, SEO, assignments, languages, glossary). Never publishes or
        deletes. content:publish — Publish drafts, schedule/reschedule/cancel
        publications, restore versions, publish global sections. content:delete
        — Delete pages, global sections, languages, static keys, override
        reverts; required with project:manage for project deletion.
        project:manage — Create/copy/delete projects, settings, variants,
        hierarchy, backups, restore-as-new, previews, hostname policy.
        translations:read — Read translation units only (no general content
        access). translations:write — Apply translation units only; never
        mutates page content. A legacy unscoped API key keeps
        read/write/translation baseline access and every pre-scope endpoint, but
        never gains publish/delete/project-manage implicitly.

````

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