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

# Update a post

> Updates an existing post with new content, media, or engagement metrics



## OpenAPI

````yaml https://api.yalg.ai/openapi.v1-3.1.json patch /v1/posts/{id}
openapi: 3.1.0
info:
  title: YALG Developer API
  description: >-
    Public v1 API for integrating with YALG content workflows. Authenticate
    server-side requests with the `x-api-key` header. Every request is scoped to
    the API key owner.
  version: '1.0'
  contact:
    name: YALG Support
    url: https://yalg.ai
    email: support@yalg.ai
  termsOfService: https://yalg.ai/terms
  license:
    name: Proprietary
    url: https://yalg.ai
servers:
  - url: https://api.yalg.ai
    description: Production
security: []
tags:
  - name: public-v1
    description: Stable public developer API
  - name: anecdotes
    description: Public anecdote endpoints
  - name: posts
    description: Public post endpoints
  - name: post-generation
    description: Public post generation endpoints
  - name: script-jobs
    description: Public script job endpoints
  - name: shorts
    description: Public short-form video endpoints
  - name: carousel
    description: Public carousel endpoints
  - name: carousel-generation
    description: Public carousel generation endpoints
  - name: broll
    description: Public B-roll generation endpoints
  - name: components
    description: Public component library endpoints
  - name: Blog
    description: Public blog endpoints
  - name: youtube-suggestions
    description: Public YouTube suggestion endpoints
  - name: statistics
    description: Public statistics endpoints
paths:
  /v1/posts/{id}:
    patch:
      tags:
        - posts
      summary: Update a post
      description: Updates an existing post with new content, media, or engagement metrics
      operationId: PostController_update[1]
      parameters:
        - name: id
          required: true
          in: path
          description: UUID of the post to update
          schema:
            example: 123e4567-e89b-12d3-a456-426614174000
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePostDto'
            examples:
              default:
                summary: Example request
                value:
                  content: Updated post draft with a sharper hook and clearer takeaway.
                  status: draft
      responses:
        '200':
          description: Post updated successfully
          headers:
            X-RateLimit-Limit:
              description: Maximum number of API requests allowed in the current window.
              schema:
                type: integer
                example: 120
            X-RateLimit-Remaining:
              description: Number of API requests remaining in the current window.
              schema:
                type: integer
                example: 119
            X-RateLimit-Reset:
              description: >-
                Unix timestamp, in seconds, when the current rate limit window
                resets.
              schema:
                type: integer
                example: 1766246400
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YalgPost'
              examples:
                success:
                  summary: Example response
                  value:
                    id: 018f9f40-7d7b-7712-9b0f-2e5d9fd5df3f
                    anecdoteId: 018f9f41-22a1-74bb-9450-7dd0d21ab8ab
                    content: >-
                      I used to think consistency came from discipline. It
                      actually came from removing friction.
                    platform: linkedin
                    status: draft
                    likes: 12
                    comments: 3
                    shares: 1
                    createdAt: '2026-06-20T17:24:39.000Z'
                    updatedAt: '2026-06-20T17:24:39.000Z'
        '400':
          description: Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YalgErrorResponse'
              examples:
                validation_failed:
                  summary: Bad Request
                  value:
                    statusCode: 400
                    message: Validation failed
                    error: Bad Request
                    code: validation_failed
          headers:
            X-RateLimit-Limit:
              description: Maximum number of API requests allowed in the current window.
              schema:
                type: integer
                example: 120
            X-RateLimit-Remaining:
              description: Number of API requests remaining in the current window.
              schema:
                type: integer
                example: 119
            X-RateLimit-Reset:
              description: >-
                Unix timestamp, in seconds, when the current rate limit window
                resets.
              schema:
                type: integer
                example: 1766246400
        '401':
          description: >-
            Authentication failed. Provide a valid `x-api-key` header for public
            API requests.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YalgErrorResponse'
              examples:
                unauthorized:
                  summary: Unauthorized
                  value:
                    statusCode: 401
                    message: Invalid or missing API key
                    error: Unauthorized
                    code: unauthorized
          headers:
            X-RateLimit-Limit:
              description: Maximum number of API requests allowed in the current window.
              schema:
                type: integer
                example: 120
            X-RateLimit-Remaining:
              description: Number of API requests remaining in the current window.
              schema:
                type: integer
                example: 119
            X-RateLimit-Reset:
              description: >-
                Unix timestamp, in seconds, when the current rate limit window
                resets.
              schema:
                type: integer
                example: 1766246400
        '403':
          description: >-
            Forbidden. The authenticated owner does not have access to this
            feature or resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YalgErrorResponse'
              examples:
                forbidden:
                  summary: Forbidden
                  value:
                    statusCode: 403
                    message: Access denied
                    error: Forbidden
                    code: forbidden
          headers:
            X-RateLimit-Limit:
              description: Maximum number of API requests allowed in the current window.
              schema:
                type: integer
                example: 120
            X-RateLimit-Remaining:
              description: Number of API requests remaining in the current window.
              schema:
                type: integer
                example: 119
            X-RateLimit-Reset:
              description: >-
                Unix timestamp, in seconds, when the current rate limit window
                resets.
              schema:
                type: integer
                example: 1766246400
        '404':
          description: Post not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YalgErrorResponse'
              examples:
                not_found:
                  summary: Not Found
                  value:
                    statusCode: 404
                    message: Resource not found
                    error: Not Found
                    code: not_found
          headers:
            X-RateLimit-Limit:
              description: Maximum number of API requests allowed in the current window.
              schema:
                type: integer
                example: 120
            X-RateLimit-Remaining:
              description: Number of API requests remaining in the current window.
              schema:
                type: integer
                example: 119
            X-RateLimit-Reset:
              description: >-
                Unix timestamp, in seconds, when the current rate limit window
                resets.
              schema:
                type: integer
                example: 1766246400
        '409':
          description: >-
            Conflict. The request cannot be completed because the resource is
            already in another state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YalgErrorResponse'
              examples:
                conflict:
                  summary: Conflict
                  value:
                    statusCode: 409
                    message: Resource conflict
                    error: Conflict
                    code: conflict
          headers:
            X-RateLimit-Limit:
              description: Maximum number of API requests allowed in the current window.
              schema:
                type: integer
                example: 120
            X-RateLimit-Remaining:
              description: Number of API requests remaining in the current window.
              schema:
                type: integer
                example: 119
            X-RateLimit-Reset:
              description: >-
                Unix timestamp, in seconds, when the current rate limit window
                resets.
              schema:
                type: integer
                example: 1766246400
        '429':
          description: >-
            Rate limit exceeded. Wait for the window to reset before retrying
            the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YalgErrorResponse'
              examples:
                rate_limit_exceeded:
                  summary: Too Many Requests
                  value:
                    statusCode: 429
                    message: Rate limit exceeded
                    error: Too Many Requests
                    code: rate_limit_exceeded
                    retryAfter: 60
          headers:
            X-RateLimit-Limit:
              description: Maximum number of API requests allowed in the current window.
              schema:
                type: integer
                example: 120
            X-RateLimit-Remaining:
              description: Number of API requests remaining in the current window.
              schema:
                type: integer
                example: 119
            X-RateLimit-Reset:
              description: >-
                Unix timestamp, in seconds, when the current rate limit window
                resets.
              schema:
                type: integer
                example: 1766246400
            Retry-After:
              description: Seconds to wait before retrying the request.
              schema:
                type: integer
                example: 60
        '500':
          description: Internal server error. An unexpected YALG backend error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YalgErrorResponse'
              examples:
                internal_server_error:
                  summary: Internal Server Error
                  value:
                    statusCode: 500
                    message: Internal server error
                    error: Internal Server Error
                    code: internal_server_error
          headers:
            X-RateLimit-Limit:
              description: Maximum number of API requests allowed in the current window.
              schema:
                type: integer
                example: 120
            X-RateLimit-Remaining:
              description: Number of API requests remaining in the current window.
              schema:
                type: integer
                example: 119
            X-RateLimit-Reset:
              description: >-
                Unix timestamp, in seconds, when the current rate limit window
                resets.
              schema:
                type: integer
                example: 1766246400
      security:
        - ApiKeyAuth: []
components:
  schemas:
    UpdatePostDto:
      type: object
      properties:
        content:
          type: string
          maxLength: 5000
          description: The content of the LinkedIn post (optional for HOOK_CREATED status)
          example: >-
            Just had an amazing experience at the tech conference! Here are my
            key takeaways...
        agentCreated:
          type: boolean
          description: Whether the post was created by an agent
          example: true
        imageUrl:
          type: string
          maxLength: 255
          description: URL of an image to include in the post
          example: https://example.com/image.jpg
        videoUrl:
          type: string
          maxLength: 255
          description: URL of a video to include in the post
          example: https://example.com/video.mp4
        anecdoteIds:
          description: UUIDs of the anecdotes this post is based on
          example:
            - 987fcdeb-51a2-43d7-8f9e-123456789abc
            - 123e4567-e89b-12d3-a456-426614174000
          type: array
          items:
            type: string
            format: uuid
        tags:
          description: Tags associated with the post for categorization
          example:
            - technology
            - conference
            - networking
            - learning
          type: array
          items:
            type: string
        linkedInUrl:
          type: string
          maxLength: 500
          description: Original LinkedIn post URL
          example: https://www.linkedin.com/feed/update/urn:li:activity:1234567890
        originalTimestamp:
          format: date-time
          type: string
          description: Original timestamp of the post (for imported posts)
          example: '2023-12-01T10:30:00Z'
        scheduledAt:
          format: date-time
          type: string
          description: Scheduled publication timestamp for the post
          example: '2023-12-01T15:30:00Z'
        publishedAt:
          format: date-time
          type: string
          description: Actual publication timestamp when the post was published
          example: '2023-12-01T15:32:15Z'
        likesCount:
          type: number
          minimum: 0
          description: Number of likes on the post
          example: 42
        commentsCount:
          type: number
          minimum: 0
          description: Number of comments on the post
          example: 8
        sharesCount:
          type: number
          minimum: 0
          description: Number of shares/reposts of the post
          example: 15
        impressionsCount:
          type: number
          minimum: 0
          description: Number of impressions/views of the post
          example: 1250
        status:
          enum:
            - drafted
            - scheduled
            - published
            - failed
          type: string
          description: Status of the post
          example: published
        targetPlatforms:
          type: array
          items:
            type: string
            enum:
              - linkedin
              - instagram
              - facebook
          description: Target platforms for publishing
          example:
            - linkedin
            - instagram
            - facebook
        instagramFormat:
          enum:
            - carousel
            - single
          type: string
          description: Instagram post format (carousel or single image)
          example: carousel
        isActive:
          type: boolean
          description: Whether the post is active (visible) or soft-deleted
          example: true
          default: true
        authorId:
          type: string
          description: >-
            Do not send this field in public API requests. YALG ignores
            arbitrary owner identifiers and derives the owner from the
            authenticated API key.
          deprecated: true
    YalgPost:
      type: object
      description: Social post managed by YALG.
      properties:
        id:
          type: string
          format: uuid
          description: Post identifier.
          example: 018f9f40-7d7b-7712-9b0f-2e5d9fd5df3f
        anecdoteId:
          type: string
          format: uuid
          description: Source anecdote identifier.
          example: 018f9f40-7d7b-7712-9b0f-2e5d9fd5df3f
        content:
          type: string
          example: A publishable LinkedIn post generated from an anecdote.
        platform:
          type: string
          example: linkedin
        status:
          type: string
          example: draft
        scheduledAt:
          type: string
          format: date-time
          example: '2026-06-20T17:24:39.000Z'
        publishedAt:
          type: string
          format: date-time
          example: '2026-06-20T17:24:39.000Z'
        likes:
          type: integer
          example: 12
        comments:
          type: integer
          example: 3
        shares:
          type: integer
          example: 1
        createdAt:
          type: string
          format: date-time
          example: '2026-06-20T17:24:39.000Z'
        updatedAt:
          type: string
          format: date-time
          example: '2026-06-20T17:24:39.000Z'
      additionalProperties: true
    YalgErrorResponse:
      type: object
      required:
        - statusCode
        - message
      description: >-
        Standard error payload returned by YALG API endpoints. Validation errors
        may return `message` as an array of field-level messages.
      properties:
        statusCode:
          type: integer
          example: 400
        message:
          oneOf:
            - type: string
              example: Bad request
            - type: array
              items:
                type: string
              example:
                - field must be a string
        error:
          type: string
          example: Bad Request
        code:
          type: string
          example: validation_failed
          description: Stable machine-readable error code when the backend can provide one.
        requestId:
          type: string
          example: req_01HX7Y6D3XQ4J8W9Z0A1B2C3D4
          description: >-
            Request correlation identifier. Include this when contacting YALG
            support.
        retryAfter:
          type: integer
          example: 60
          description: >-
            Seconds to wait before retrying. Present on some rate-limit
            responses.
        details:
          type: object
          additionalProperties: true
          description: Optional structured details for validation or domain errors.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        YALG Developer API key. Send it in the `x-api-key` header from a
        server-side environment only.
      x-default: yalg_live_your_api_key

````