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

# Update post

> Update an existing post by ID or slug. All fields are optional — only provided fields are updated. Requires a private API key.



## OpenAPI

````yaml https://api.marblecms.com/openapi.json patch /v1/posts/{identifier}
openapi: 3.1.0
info:
  title: Marble API
  version: 1.0.0
  description: A headless CMS API for managing and delivering content programmatically.
servers:
  - url: https://api.marblecms.com
    description: Production
security:
  - apiKey: []
paths:
  /v1/posts/{identifier}:
    patch:
      tags:
        - Posts
      summary: Update post
      description: >-
        Update an existing post by ID or slug. All fields are optional — only
        provided fields are updated. Requires a private API key.
      parameters:
        - schema:
            type: string
            example: my-post-slug
            description: Post ID or slug
          required: true
          description: Post ID or slug
          name: identifier
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePostBody'
      responses:
        '200':
          description: Post updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdatePostResponse'
        '400':
          description: Invalid request body or referenced resources not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Public API key used for write operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Forbidden'
        '404':
          description: Post not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFound'
        '409':
          description: Post with this slug already exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Conflict'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServerError'
components:
  schemas:
    UpdatePostBody:
      type: object
      properties:
        title:
          type: string
          minLength: 1
          example: Updated Post Title
        content:
          type: string
          minLength: 1
          example: <p>Updated content</p>
        description:
          type: string
          minLength: 1
          example: Updated description
        slug:
          type: string
          minLength: 1
          example: updated-post-slug
        categoryId:
          type: string
          minLength: 1
          example: cryitfjp2345kl05weoybfk9
        status:
          type: string
          enum:
            - published
            - draft
          example: published
        tags:
          type: array
          items:
            type: string
          example:
            - cryitfjp4567no07ygqadhm1
          description: Array of tag IDs. Replaces all existing tags when provided.
        authors:
          type: array
          items:
            type: string
          example:
            - cryitfjp3456lm06xfpzcgl0
          description: Array of author IDs. Replaces all existing authors when provided.
        featured:
          type: boolean
          example: true
        coverImage:
          type: string
          nullable: true
          format: uri
          example: https://media.marblecms.com/new-cover.jpg
        publishedAt:
          type: string
          format: date-time
          example: '2024-02-01T10:00:00Z'
        fields:
          type: object
          additionalProperties:
            anyOf:
              - type: string
              - type: number
              - type: boolean
              - type: array
                items:
                  type: string
              - nullable: true
          description: >-
            Custom field values keyed by field key. Select values must use
            option values; multiselect values must be arrays of option values.
            Use null to clear optional fields.
          example:
            release_date: '2024-01-15'
            priority_score: 5
            audience:
              - developers
              - founders
            featured_customer: true
            subtitle: null
    UpdatePostResponse:
      type: object
      properties:
        post:
          type: object
          properties:
            id:
              type: string
              example: cryitfjp5678mn09qrstuvwx
            slug:
              type: string
              example: updated-post-slug
            title:
              type: string
              example: Updated Post Title
            status:
              type: string
              example: published
            featured:
              type: boolean
              example: true
            publishedAt:
              type: string
              example: '2024-02-01T10:00:00.000Z'
            updatedAt:
              type: string
              example: '2024-02-01T12:00:00.000Z'
          required:
            - id
            - slug
            - title
            - status
            - featured
            - publishedAt
            - updatedAt
      required:
        - post
    Error:
      type: object
      properties:
        error:
          type: string
          example: Invalid query parameters
        details:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
                example: limit
              message:
                type: string
                example: Expected number, received string
            required:
              - field
              - message
        message:
          type: string
          example: Validation failed
      required:
        - error
    Forbidden:
      type: object
      properties:
        error:
          type: string
          example: Forbidden
        message:
          type: string
          example: >-
            Write operations require a private API key (msk_...). Public keys
            are read-only.
      required:
        - error
        - message
    NotFound:
      type: object
      properties:
        error:
          type: string
          example: Post not found
        message:
          type: string
          example: The requested resource does not exist
      required:
        - error
        - message
    Conflict:
      type: object
      properties:
        error:
          type: string
          example: Slug already in use
        message:
          type: string
          example: A resource with this slug already exists in this workspace
      required:
        - error
    ServerError:
      type: object
      properties:
        error:
          type: string
          example: Internal server error
        message:
          type: string
          example: Failed to fetch resource
      required:
        - error
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: Authorization
      description: Your Marble API key

````