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

# Create a blog post

> Create a new blog post for the store. Requires the WRITE_BLOGS scope.

Creates a blog post; a unique slug is generated from the title and publishedAt is set when the post is created as published. The owning store and author are set server-side — never send a shop id.


## OpenAPI

````yaml POST /blogs
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:
    post:
      tags:
        - Blogs
      summary: Create a blog post
      description: >-
        Creates a new blog post for the store. A unique slug is generated from
        the title automatically, and publishedAt is set when the post is created
        as published. The owning store and author are set server-side from the
        app installation — never send a shop id. Requires the `WRITE_BLOGS`
        scope.
      operationId: createBlog
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BlogCreate'
            example:
              title: Summer Sale Tips
              description: How to make the most of our summer promotions.
              content: <p>Full HTML content...</p>
              image: https://cdn.salesive.com/blog/summer.jpg
              tags:
                - sales
                - summer
              published: true
      responses:
        '201':
          description: The created blog post.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/EnvelopeBase'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/Blog'
              example:
                status: 201
                success: true
                message: Blog created successfully
                data:
                  _id: 66c2a1b2c3d4e5f6a7b8c9d0
                  title: Summer Sale Tips
                  slug: 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: true
                  publishedAt: '2026-06-28T12:00:00.000Z'
                  views: 0
                  createdAt: '2026-06-28T12:00:00.000Z'
                  updatedAt: '2026-06-28T12:00:00.000Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  schemas:
    BlogCreate:
      type: object
      description: Fields accepted when creating a blog post.
      required:
        - title
        - content
      properties:
        title:
          type: string
          maxLength: 200
          description: Post title (max 200 characters). Used to generate the slug.
        content:
          type: string
          description: Post body (HTML or rich text).
        description:
          type: string
          maxLength: 500
          default: ''
          description: >-
            Short summary/excerpt (max 500 characters). Defaults to empty
            string.
        image:
          type: string
          default: ''
          description: Cover image URL. Defaults to empty string.
        tags:
          type: array
          items:
            type: string
          default: []
          description: Array of tag strings. Defaults to empty array.
        published:
          type: boolean
          default: false
          description: Whether the post is published. Defaults to false (draft).
    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
  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.

````