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

# Create a new anecdote

> Creates a new personal anecdote with content, categorization, and metadata. When autoFill is enabled, AI will generate missing details.



## OpenAPI

````yaml https://api.yalg.ai/openapi.v1-3.1.json post /v1/anecdotes
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/anecdotes:
    post:
      tags:
        - anecdotes
      summary: Create a new anecdote
      description: >-
        Creates a new personal anecdote with content, categorization, and
        metadata. When autoFill is enabled, AI will generate missing details.
      operationId: AnecdoteController_create[1]
      parameters:
        - name: autoFill
          required: true
          in: query
          schema:
            type: boolean
            example: example
          description: autoFill parameter.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAnecdoteDto'
            examples:
              default:
                summary: Example request
                value:
                  title: The onboarding lesson
                  content: >-
                    A customer got stuck on step one, which showed us the
                    product was explaining itself too late.
                  mood: reflective
                  storyType: lesson
                  tags:
                    - onboarding
                    - product
      responses:
        '201':
          description: Anecdote created successfully
          content:
            application/json:
              schema:
                example:
                  id: 123e4567-e89b-12d3-a456-426614174000
                  title: How I Learned to Lead a Team
                  content: Last year, I was tasked with leading...
                  authorId: 987fcdeb-51a2-43d7-8f9e-123456789abc
                  storyType: professional_stories
                  tags:
                    - leadership
                    - teamwork
                  mood: reflective
                  context: startup
                  lessonLearned: Effective leadership requires trust...
                  linkedinAngle: Share this as a leadership lesson...
                  priority: 1
                  isActive: true
                  createdAt: '2024-01-15T10:30:00Z'
                  updatedAt: '2024-01-15T10:30:00Z'
              examples:
                success:
                  summary: Example response
                  value:
                    id: 123e4567-e89b-12d3-a456-426614174000
                    title: How I Learned to Lead a Team
                    content: Last year, I was tasked with leading...
                    authorId: 987fcdeb-51a2-43d7-8f9e-123456789abc
                    storyType: professional_stories
                    tags:
                      - leadership
                      - teamwork
                    mood: reflective
                    context: startup
                    lessonLearned: Effective leadership requires trust...
                    linkedinAngle: Share this as a leadership lesson...
                    priority: 1
                    isActive: true
                    createdAt: '2024-01-15T10:30:00Z'
                    updatedAt: '2024-01-15T10:30:00Z'
          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
        '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
        '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:
    CreateAnecdoteDto:
      type: object
      properties:
        title:
          type: string
          maxLength: 200
          description: Title of the anecdote (optional when autoFill is enabled)
          example: How I Learned to Lead a Team
        content:
          type: string
          description: The full content/story of the anecdote
          example: >-
            Last year, I was tasked with leading a cross-functional team for the
            first time. Initially, I struggled with delegation and tried to
            micromanage every detail...
        type:
          default: voice
          enum:
            - text
            - voice
          type: string
          description: Type of anecdote
          example: voice
        transcript:
          type: string
          description: Transcript of the voice anecdote (for voice type anecdotes)
          example: >-
            So I was reflecting on my journey from junior developer to tech
            lead...
        audioPath:
          type: string
          maxLength: 500
          description: Path to the audio file on disk (for voice type anecdotes)
          example: /uploads/audio/anecdote-001.mp3
        storyType:
          enum:
            - professional_stories
            - personal_stories
            - lesson_learned
          type: string
          description: Type of story/anecdote (optional when autoFill is enabled)
          example: professional_stories
        authorId:
          type: string
          format: uuid
          description: >-
            UUID of the user who created this anecdote (will be set from
            authentication token if not provided)
          example: 123e4567-e89b-12d3-a456-426614174000
        tags:
          description: >-
            Tags for categorizing and searching the anecdote (optional when
            autoFill is enabled)
          example:
            - leadership
            - teamwork
            - management
            - growth
          type: array
          items:
            type: string
        contentScopes:
          type: array
          items:
            type: string
            enum:
              - all
              - linkedin_post
              - facebook_post
              - youtube_script
              - blog_article
              - short
              - carousel
          description: >-
            Content formats where this anecdote can be used. Use all to make it
            available everywhere.
          example:
            - youtube_script
            - blog_article
        mood:
          type: string
          maxLength: 50
          description: Mood or tone of the anecdote
          example: reflective
          enum:
            - inspiring
            - humorous
            - reflective
            - educational
        context:
          type: string
          maxLength: 100
          description: Context where this anecdote took place
          example: startup
          enum:
            - work
            - startup
            - client meeting
            - conference
            - personal
        lessonLearned:
          type: string
          description: The key lesson or takeaway from this anecdote
          example: >-
            Effective leadership requires trust, clear communication, and
            empowering team members to make decisions.
        linkedinAngle:
          type: string
          description: How this anecdote could be positioned for LinkedIn posting
          example: >-
            Share this as a leadership lesson with focus on team empowerment and
            growth mindset.
        priority:
          type: number
          default: 1
          minimum: 1
          maximum: 5
          description: >-
            Priority level for using this anecdote (1 = highest priority, 5 =
            lowest)
          example: 1
        isFavorite:
          type: boolean
          default: false
          description: Whether this anecdote is marked as favorite
          example: false
        timeSensitive:
          type: boolean
          default: false
          description: >-
            Whether this anecdote is time-sensitive (contains time-bound
            information like recent events, dates, achievements that should only
            be used once)
          example: false
      required:
        - content
    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

````