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

# Update Blog Post via Write API

> Partially update an existing blog post via the Write API with support for flexible field modification and status changes.

Update an existing blog post using partial updates, allowing you to modify specific fields while preserving all other content. This endpoint is perfect for content updates, SEO optimization, or adding new media to existing posts.

**PUT Support**: PUT requests to the same URL are accepted and behave exactly like PATCH (partial update).

**Partial Update Flexibility**: All fields in the request body are optional - include only the fields you want to modify. Any omitted fields will retain their current values, making it safe to update specific content without affecting the entire post structure.

**Localization**: Use the `locale` query parameter to target a specific locale variant (e.g. `?locale=es`). When omitted, updates the post in its current locale. If the locale variant does not yet exist, a new locale variant is created and linked to the original post — this is the primary way to create translations of existing blog posts.

**Scheduling Limitations**: Blog post scheduling is not available through the Write API. Any scheduled parameters in your request will be silently ignored (not treated as errors), allowing you to safely update posts that are currently scheduled without affecting their publication timing.

**Media Integration**: Include `upload_images_to_media_library=true` in your request to automatically download and upload any image URLs within the post body to your ButterCMS media library. This ensures reliable hosting and CDN performance for your content images.

**Asynchronous Processing**: This endpoint returns `202 Accepted` immediately to ensure fast response times for your application. The actual update processing, including media uploads, content validation, and webhook notifications, happens in the background processing queue.


## OpenAPI

````yaml /api/openapi/write_api.yaml patch /posts/{slug}/
openapi: 3.1.0
info:
  title: ButterCMS Write API
  version: 2.0.0
  description: >
    Write endpoints for the ButterCMS API — create, update, and delete Pages,
    Collections, and Blog Posts.


    **Authentication**: pass your write-enabled token via the `Authorization:
    Token <token>` header. A `?auth_token=` query parameter also works (the same
    mechanism as the Read API), but avoid it for write requests: a write token
    is higher-privilege and a URL is more likely to be logged or leaked than a
    header.
  contact:
    email: support@buttercms.com
  license:
    name: ButterCMS Terms of Service
    url: https://buttercms.com/terms/
servers:
  - url: https://api.buttercms.com/v2
    description: ButterCMS API v2
security:
  - writeTokenAuth: []
tags:
  - name: Pages
    description: >
      Create new pages using ButterCMS Write API. Programmatically create
      content to enable powerful use cases and scale your content faster.


      Note: For Pages, PUT behaves like PATCH (partial update). Use either
      method to perform partial updates.
  - name: Collections
    description: >
      Create, update, and delete Collection items using ButterCMS Write API.
      Collections are user-defined content structures with completely
      customizable field schemas.
  - name: Blog posts
    description: >
      Create, update, and delete blog posts using ButterCMS Write API. Blog
      posts support rich content including HTML body, categories, tags, featured
      images, and SEO metadata.
paths:
  /posts/{slug}/:
    patch:
      tags:
        - Blog posts
      summary: Update Blog Post via Write API
      description: >
        Update an existing blog post using partial updates, allowing you to
        modify specific fields while preserving all other content. This endpoint
        is perfect for content updates, SEO optimization, or adding new media to
        existing posts.


        **PUT Support**: PUT requests to the same URL are accepted and behave
        exactly like PATCH (partial update).


        **Partial Update Flexibility**: All fields in the request body are
        optional - include only the fields you want to modify. Any omitted
        fields will retain their current values, making it safe to update
        specific content without affecting the entire post structure.


        **Localization**: Use the `locale` query parameter to target a specific
        locale variant (e.g. `?locale=es`). When omitted, updates the post in
        its current locale. If the locale variant does not yet exist, a new
        locale variant is created and linked to the original post — this is the
        primary way to create translations of existing blog posts.


        **Scheduling Limitations**: Blog post scheduling is not available
        through the Write API. Any scheduled parameters in your request will be
        silently ignored (not treated as errors), allowing you to safely update
        posts that are currently scheduled without affecting their publication
        timing.


        **Media Integration**: Include `upload_images_to_media_library=true` in
        your request to automatically download and upload any image URLs within
        the post body to your ButterCMS media library. This ensures reliable
        hosting and CDN performance for your content images.


        **Asynchronous Processing**: This endpoint returns `202 Accepted`
        immediately to ensure fast response times for your application. The
        actual update processing, including media uploads, content validation,
        and webhook notifications, happens in the background processing queue.
      operationId: updateBlogPost
      parameters:
        - name: slug
          in: path
          required: true
          description: |
            The slug of the blog post to update.
          schema:
            type: string
            maxLength: 100
          example: this-is-a-blog-post
        - name: locale
          in: query
          description: >
            Target a specific locale variant (e.g. `en`, `es`). When omitted,
            updates the post in its current locale. If the locale variant does
            not exist, a new one is created and linked to the original post.
          required: false
          schema:
            type: string
            maxLength: 10
          example: en
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateBlogPostRequest'
            examples:
              partial_update:
                summary: Partial update (only specified fields changed)
                value:
                  slug: the-new-post-slug
                  body: <h1>Updated</h1><p>This blog post was updated via API</p>
              content_update:
                summary: Update content and SEO fields
                value:
                  title: Updated Blog Post Title
                  body: >-
                    <h1>Fresh Content</h1><p>Completely new content for this
                    post.</p>
                  summary: Updated summary of the post.
                  seo_title: Updated SEO Title
                  meta_description: Updated meta description for better SEO.
              category_tag_update:
                summary: Update categories and tags
                value:
                  categories:
                    - Updated Category
                    - New Category
                  tags:
                    - updated
                    - refresh
                    - api
              status_update:
                summary: Change post status
                value:
                  status: published
              media_library_update:
                summary: Update with media library upload
                value:
                  body: >-
                    <h1>Updated with Images</h1><p><img
                    src='https://example.com/new-image.jpg' alt='New image'></p>
                  upload_images_to_media_library: true
              scheduled_ignored:
                summary: Scheduled fields ignored (with warnings)
                value:
                  title: Updated Title
                  scheduled: '2024-12-25T10:00:00Z'
                  status: scheduled
      responses:
        '201':
          description: >
            **Created - New Locale Variant**


            Returned instead of `202` when `?locale=` names a configured locale
            that doesn't yet exist for this post. A new locale variant is
            created, copying content from the source variant (tags and
            categories are copied too, unless explicitly provided in the request
            body).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlogPostUpdateSuccessResponse'
              example:
                status: pending
                'info: locale variant': >-
                  Created new 'es' locale variant; copied content from 'en'
                  variant. Tags and categories are copied from the source
                  variant unless explicitly provided in the request body.
        '202':
          description: >
            **Accepted - Post Update Initiated**


            The update request has been accepted and will be processed
            asynchronously. The response may include warning messages if certain
            fields were ignored (such as scheduling-related fields).


            **Warning Messages**: If you provided `scheduled` timestamp or
            `status: "scheduled"`, these will be ignored and warning messages
            will be included in the response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlogPostUpdateSuccessResponse'
              examples:
                simple_update:
                  summary: Simple update without warnings
                  value:
                    status: pending
                update_with_scheduled_warning:
                  summary: Update with scheduled field ignored
                  value:
                    status: pending
                    'warning: scheduled field': >-
                      Scheduled timestamps cannot be created or altered via
                      write API. This field will be ignored.
                update_with_status_warning:
                  summary: Update with scheduled status ignored
                  value:
                    status: pending
                    'warning: status field': >-
                      A blog post's status cannot be set as `scheduled` via
                      write API at this time. This field will be ignored.
                update_with_both_warnings:
                  summary: Update with both scheduling warnings
                  value:
                    status: pending
                    'warning: scheduled field': >-
                      Scheduled timestamps cannot be created or altered via
                      write API. This field will be ignored.
                    'warning: status field': >-
                      A blog post's status cannot be set as `scheduled` via
                      write API at this time. This field will be ignored.
        '400':
          description: >
            **Bad Request - Validation Error**


            The API will return HTTP status code 400 if your data does not pass
            validation. This may happen if:


            - Invalid field values provided

            - The remote URL for a media field returns a 404

            - Invalid author email or slug provided

            - Malformed request data


            Error explanations will be returned in a single JSON array.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
              examples:
                invalid_featured_image:
                  summary: Invalid featured image URL
                  value:
                    featured_image:
                      - >-
                        The resource 'https://example.com/missing.jpg' could not
                        be reached.
                invalid_author_email:
                  summary: Author with email not found
                  value:
                    author:
                      - >-
                        nonexistent@email.com author does not exist. Please
                        invite them to your account
                        https://buttercms.com/team/people/
                invalid_status:
                  summary: Invalid status value
                  value:
                    status:
                      - '"invalid_status" is not a valid choice.'
        '401':
          $ref: '#/components/responses/UnauthorizedWriteResponse'
        '403':
          description: >
            **Forbidden - Insufficient Permissions**


            Your API token does not have write permissions or you don't have
            permission to update this blog post.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                detail: Your API token does not allow writes.
        '404':
          description: >
            **Not Found - Blog Post Does Not Exist**


            The blog post with the specified slug was not found or you don't
            have access to it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                detail: Not found.
      security:
        - writeTokenAuth: []
components:
  schemas:
    UpdateBlogPostRequest:
      type: object
      description: >
        Request schema for updating an existing blog post. All fields are
        optional for partial updates.


        **Note**: If `scheduled` timestamp or `status: "scheduled"` are
        provided, they will be ignored and warning messages will be included in
        the response.
      properties:
        title:
          type: string
          description: The title of the blog post
          maxLength: 200
          example: Updated Blog Post Title
        slug:
          type: string
          description: >
            The slug of the blog post.


            **Auto-Slugification**: The API automatically converts your input to
            a valid slug format using unicode slugification.
          maxLength: 100
          example: updated-blog-post-slug
        status:
          type: string
          description: >
            The status of the post.


            **Note**: `"scheduled"` status will be ignored and a warning message
            will be included in the response.
          enum:
            - draft
            - published
            - scheduled
          example: published
        author: 4c9b951a-e92b-4398-8486-4e43e1c95d15
        categories:
          type: array
          description: >
            Array of category names. Replaces the post's categories. Each name
            is matched to an existing category by name, case-insensitively, or
            by slug, and a category is created only if none matches. An empty
            array is ignored.
          items:
            type: string
          example:
            - Updated Category
            - New Category
        tags:
          type: array
          description: >
            Array of tag names. Replaces the post's tags. Each name is matched
            to an existing tag by name, case-insensitively, or by slug, and a
            tag is created only if none matches. An empty array is ignored.
          items:
            type: string
          example:
            - updated
            - refresh
            - api
        featured_image:
          type: string
          format: uri
          description: >
            Can be a remote URL to an image.


            The image will always be uploaded to the media library (the value of
            `upload_images_to_media_library` is ignored for featured images).
          example: https://example.com/updated-featured-image.jpg
        featured_image_alt:
          type: string
          description: Alt text for the featured image
          maxLength: 250
          example: Updated featured image alt text.
        body:
          type: string
          description: >
            Should be a string of escaped HTML.


            In case it contains any remote URLs to images, the
            `upload_images_to_media_library` flag controls the behavior.
          example: <h1>Updated Content</h1><p>This blog post was updated via API</p>
        summary:
          type: string
          description: Plain-text summary of the blog post
          maxLength: 2000
          example: Updated summary of the blog post.
        seo_title:
          type: string
          description: SEO title for HTML title tag
          maxLength: 100
          example: Updated SEO Title
        meta_description:
          type: string
          description: Meta description for SEO and social sharing
          example: Updated meta description for better SEO.
        upload_images_to_media_library:
          type: boolean
          description: >
            Defaults to `false`.


            If set to `true`, any image URLs in the `body` property will be
            uploaded to the Butter Media Library and the original URL will be
            replaced with the media library URL.


            **Note**: Featured images are always uploaded regardless of this
            setting.
          default: false
          example: true
        scheduled:
          type: string
          format: date-time
          description: >
            **Note**: This field will be ignored - scheduled timestamps cannot
            be created or altered via write API.


            If provided, this field will be removed from the request and a
            warning message will be included in the response.
          example: '2024-12-25T10:00:00Z'
    BlogPostUpdateSuccessResponse:
      type: object
      description: >
        Success response for blog post updates (202 Accepted). May include
        warning messages for ignored fields.
      properties:
        status:
          type: string
          enum:
            - pending
          description: >-
            Indicates that the blog post update is being processed
            asynchronously
          example: pending
        'warning: scheduled field':
          type: string
          description: Warning message when scheduled field is ignored
          example: >-
            Scheduled timestamps cannot be created or altered via write API.
            This field will be ignored.
        'warning: status field':
          type: string
          description: Warning message when scheduled status is ignored
          example: >-
            A blog post's status cannot be set as `scheduled` via write API at
            this time. This field will be ignored.
      additionalProperties:
        type: string
        description: Additional warning messages for other ignored fields
    ValidationErrorResponse:
      description: >-
        Response for validation errors (400 Bad Request). The shape varies by
        endpoint and check: a field-keyed object whose values are arrays of
        messages or single message strings, a bare array of messages, or a
        general `error` message.
      anyOf:
        - type: object
          description: >-
            Field-specific validation errors (used by Pages, Blog Posts, and
            Collections). Values are usually arrays of messages; some checks
            return a single string.
          additionalProperties:
            oneOf:
              - type: array
                items:
                  type: string
              - type: string
          example:
            title:
              - This field is required.
            slug: You must specify a page slug.
        - type: array
          description: >-
            Bare array of messages (used by some Collection item validation
            errors)
          items:
            type: string
          example:
            - '''field1_key'' is required'
        - type: object
          description: General error message (used for organization limits, etc.)
          properties:
            error:
              type: string
              description: Error message
          example:
            error: >-
              Cannot create a new Collection Item. Collection Item Limit
              Reached.
    ErrorResponse:
      type: object
      properties:
        detail:
          type: string
          description: Error message describing what went wrong
          example: Authentication credentials were not provided.
  responses:
    UnauthorizedWriteResponse:
      description: >
        **Unauthorized - Missing or Invalid API Token**


        No token was sent, or the token isn't valid. A valid Read API token on a
        write request returns `403` with `Your API token does not allow writes.`
        instead.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missing_token:
              summary: Missing API token
              value:
                detail: Authentication credentials were not provided.
            invalid_token:
              summary: Invalid API token
              value:
                detail: Invalid token.
  securitySchemes:
    writeTokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >
        Write-enabled API token required for creating content.


        The API token you use for reading from the ButterCMS API will not allow
        you to create content in the API. For this you will need to use a
        different write-enabled token. Write API access is a paid add-on for
        Advanced and Professional plans, enabled from the Billing page of your
        account. It isn't offered on Basic plans.


        Set the `Authorization` header to `Token your_write_api_token`. The
        `?auth_token=` query parameter also works for write requests, but a
        header is safer because URLs are more likely to be logged.


        Example: `Authorization: Token abc123def456`


        Your write-enabled token should never be used anywhere it would be
        exposed, e.g. in client-side JavaScript.

````

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