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

# Update a blog post

> Update an existing blog post in the store. Requires the WRITE_BLOGS scope.

Updates a blog post; send only the fields to change (at least one required). Changing the title regenerates the slug and toggling published updates publishedAt accordingly. The store is bound to your app token server-side — never send a shop id.


## OpenAPI

````yaml PUT /blogs/{id}
openapi: 3.1.0
info:
  title: Salesive Apps API — Discounts & Blogs
  version: 1.0.0
  description: >-
    Read and manage the store's discount coupons and blog posts from an
    installed third-party app. Every endpoint authenticates with an
    installed-app access token (prefix `app_`) and requires a specific OAuth
    scope. The target store is bound to the token server-side from the
    installation — never send a shop id.
servers:
  - url: https://api.salesive.com/api/v1
    description: Production
security:
  - AppToken: []
paths:
  /blogs/{id}:
    put:
      tags:
        - Blogs
      summary: Update a blog post
      description: >-
        Updates an existing blog post in the store. Send only the fields to
        change (at least one required). Changing the title regenerates the slug;
        toggling `published` updates publishedAt accordingly. Returns 404 if the
        post is not found. The store is bound to the app token server-side from
        the installation — never send a shop id. Requires the `WRITE_BLOGS`
        scope.
      operationId: updateBlog
      parameters:
        - $ref: '#/components/parameters/BlogId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BlogUpdate'
            example:
              title: Updated Summer Sale Tips
              published: false
      responses:
        '200':
          description: The updated blog post.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/EnvelopeBase'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/Blog'
              example:
                status: 200
                success: true
                message: Blog updated successfully
                data:
                  _id: 66c2a1b2c3d4e5f6a7b8c9d0
                  title: Updated Summer Sale Tips
                  slug: updated-summer-sale-tips
                  image: https://cdn.salesive.com/blog/summer.jpg
                  description: How to make the most of our summer promotions.
                  content: <p>Full HTML content...</p>
                  tags:
                    - sales
                    - summer
                  shop: 66a0d1c2b3a4958677564738
                  author:
                    _id: 66a0e1b2c3d4e5f6a7b8c9d0
                    name: Jane Merchant
                    email: jane@example.com
                    avatar: https://cdn.salesive.com/avatars/jane.png
                  published: false
                  publishedAt: null
                  views: 342
                  createdAt: '2026-06-14T19:00:00.000Z'
                  updatedAt: '2026-06-28T12:30:00.000Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/BlogNotFound'
components:
  parameters:
    BlogId:
      name: id
      in: path
      required: true
      description: The blog post's unique id.
      schema:
        type: string
  schemas:
    BlogUpdate:
      type: object
      description: >-
        Fields accepted when updating a blog post. At least one field must be
        supplied.
      minProperties: 1
      properties:
        title:
          type: string
          maxLength: 200
          description: New post title (max 200 characters). Regenerates the slug.
        content:
          type: string
          description: Post body (HTML or rich text).
        description:
          type: string
          maxLength: 500
          description: Short summary/excerpt (max 500 characters).
        image:
          type: string
          description: Cover image URL.
        tags:
          type: array
          items:
            type: string
          description: Array of tag strings.
        published:
          type: boolean
          description: >-
            Publish (true) or unpublish (false). Updates publishedAt
            accordingly.
    EnvelopeBase:
      type: object
      description: >-
        Standard Salesive response envelope. The operation-specific payload is
        carried in `data`.
      required:
        - status
        - success
        - message
      properties:
        status:
          type: integer
          description: HTTP status code, echoed in the body.
        success:
          type: boolean
          description: Whether the request succeeded.
        message:
          type: string
          description: Human-readable result message.
    Blog:
      type: object
      description: A store-scoped blog post with its author populated.
      properties:
        _id:
          type: string
        title:
          type: string
        slug:
          type: string
          description: URL-friendly slug auto-generated from the title.
        image:
          type:
            - string
            - 'null'
          description: Cover image URL.
        description:
          type:
            - string
            - 'null'
          description: Short summary/excerpt.
        content:
          type: string
          description: Post body (HTML or rich text).
        tags:
          type: array
          items:
            type: string
          description: Tag strings.
        shop:
          type: string
          description: The store id (bound server-side).
        author:
          $ref: '#/components/schemas/Author'
        published:
          type: boolean
          description: Whether the post is published.
        publishedAt:
          type:
            - string
            - 'null'
          format: date-time
          description: When the post was published, or null for drafts.
        views:
          type: integer
          description: Total recorded view count.
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Author:
      type: object
      description: Populated profile of the blog post's author (a platform user).
      properties:
        _id:
          type: string
        name:
          type: string
        email:
          type: string
        avatar:
          type:
            - string
            - 'null'
    Envelope:
      allOf:
        - $ref: '#/components/schemas/EnvelopeBase'
        - type: object
          properties:
            data:
              description: Operation-specific payload (object, array, or null).
  responses:
    Unauthorized:
      description: Missing or invalid app access token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Envelope'
          example:
            status: 401
            success: false
            message: Authentication required
            data: null
    Forbidden:
      description: The app token is missing the OAuth scope required for this operation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Envelope'
          example:
            status: 403
            success: false
            message: Insufficient scope
            data: null
    BlogNotFound:
      description: >-
        The blog post does not exist, is soft-deleted, or is not in the
        installation's store.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Envelope'
          example:
            status: 404
            success: false
            message: Blog not found
            data: null
  securitySchemes:
    AppToken:
      type: http
      scheme: bearer
      description: >-
        Installed-app access token (prefix app_), issued by the OAuth install
        flow. The store is bound to the token server-side — never send a shop
        id.

````