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

# Edit or reschedule a post

> Edit a post that has not started publishing. Requires the WRITE_SOCIAL scope.

A change to the prompt, slides, references, catalog item or formats on an AI post discards its images and re-queues generation, which spends the store's AI credits, so that edit also needs `USE_MERCHANT_AI`. A pure reschedule does not.


## OpenAPI

````yaml apps-api/specs/social.json PUT /social-posts/{id}
openapi: 3.1.0
info:
  title: 'Salesive Apps API: Post Planner'
  version: 1.0.0
  description: >-
    Plan, schedule and publish Instagram, TikTok and LinkedIn posts from an
    installed third-party app, and read the store's connected accounts. Reads
    need `READ_SOCIAL`; writes need `WRITE_SOCIAL`; generating images with the
    store's AI credits additionally needs `USE_MERCHANT_AI`. Without that grant
    an app must supply its own media: generate the image itself and pass the
    URL, or add it through the file API, then create a manual post. The target
    store is bound to the token server-side from the installation, so never send
    a shop id.
servers:
  - url: https://api.salesive.com/api/v1
    description: Production
security:
  - AppToken: []
tags:
  - name: Post planner
    description: Planned posts, the asset library, presets and publishing.
  - name: Connected accounts
    description: Read-only view of the store's connected social accounts.
paths:
  /social-posts/{id}:
    put:
      tags:
        - Post planner
      summary: Edit or reschedule a post
      description: >-
        Edits a post that has not started publishing. A change to the prompt,
        slides, references, catalog item or formats on an AI post throws away
        its images and re-queues generation, which spends the store's AI
        credits, so it also needs `USE_MERCHANT_AI`. A pure reschedule does not.
        Requires `WRITE_SOCIAL`.
      operationId: updateSocialPost
      parameters:
        - $ref: '#/components/parameters/PostId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: >-
                Any subset of the create fields. `kind` cannot be changed after
                the post exists.
              additionalProperties: true
              properties:
                title:
                  type: string
                prompt:
                  type: string
                caption:
                  type: string
                platforms:
                  type: array
                  items:
                    type: string
                formats:
                  type: array
                  items:
                    type: string
                media:
                  type: array
                  items:
                    $ref: '#/components/schemas/MediaItem'
                scheduledAt:
                  type: string
                  format: date-time
                mode:
                  type: string
                  enum:
                    - auto
                    - approval
                generateAheadHours:
                  type: integer
                  minimum: 0
                  maximum: 168
      responses:
        '200':
          description: The updated post.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/EnvelopeBase'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/SocialPost'
        '403':
          description: >-
            The app is missing `WRITE_SOCIAL`, or the edit would regenerate
            images without `USE_MERCHANT_AI`.
components:
  parameters:
    PostId:
      name: id
      in: path
      required: true
      description: The planned post's id (Mongo ObjectId).
      schema:
        type: string
  schemas:
    MediaItem:
      type: object
      required:
        - url
        - type
      properties:
        url:
          type: string
          format: uri
        type:
          type: string
          enum:
            - image
            - video
        duration:
          type: number
          description: Video length in seconds, when known.
    EnvelopeBase:
      type: object
      description: >-
        Standard Salesive response envelope. The operation-specific payload is
        carried in `data`.
      required:
        - status
        - success
        - message
      properties:
        status:
          type: integer
        success:
          type: boolean
        message:
          type: string
    SocialPost:
      type: object
      description: >-
        A planned post. `kind: "ai"` generates its images from `prompt`; `kind:
        "manual"` publishes the files in `media`.
      properties:
        _id:
          type: string
        kind:
          type: string
          enum:
            - ai
            - manual
        title:
          type:
            - string
            - 'null'
        prompt:
          type: string
          description: The generation prompt. Required for an AI post.
        caption:
          type: string
        captions:
          type: object
          additionalProperties:
            type:
              - string
              - 'null'
        platforms:
          type: array
          items:
            type: string
            enum:
              - instagram
              - tiktok
              - linkedin
        formats:
          type: array
          description: Placements, such as ig_feed, ig_story, tiktok_photo, li_feed.
          items:
            type: string
        media:
          type: array
          items:
            $ref: '#/components/schemas/MediaItem'
        scheduledAt:
          type: string
          format: date-time
        status:
          type: string
          enum:
            - proposed
            - scheduled
            - generating
            - awaiting_approval
            - ready
            - publishing
            - posted
            - failed
            - skipped
        mode:
          type: string
          enum:
            - auto
            - approval
        generated:
          type: object
          properties:
            images:
              type: array
              items:
                type: string
            imagesByFormat:
              type: object
              additionalProperties:
                type: array
                items:
                  type: string
            generatedAt:
              type:
                - string
                - 'null'
              format: date-time
        publishResults:
          type: array
          items:
            type: object
            properties:
              platform:
                type: string
              format:
                type: string
              success:
                type: boolean
              postId:
                type:
                  - string
                  - 'null'
              error:
                type:
                  - string
                  - 'null'
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
  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, so never send a shop
        id.

````

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