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

# Create a pull story

> Generate a pull story from a structured code brief. Returns immediately
with `status: generating` on a cache miss. Poll `GET /stories/{id}`
until `status: ready`.

Generation can take several minutes depending on brief size.




## OpenAPI

````yaml /openapi.yaml post /stories
openapi: 3.1.0
info:
  title: pull/story API
  version: '1.0'
  description: |
    Turn a structured code brief into a narrated video walkthrough.

    All endpoints are served from `https://pullstory.com/api/v1`.
  contact:
    name: pull/story Support
    url: https://pullstory.com
    email: moshikarim@proton.me
servers:
  - url: https://pullstory.com/api/v1
    description: Production
security:
  - BearerAuth: []
tags:
  - name: Stories
    description: Create and retrieve brief-generated pull stories.
paths:
  /stories:
    post:
      tags:
        - Stories
      summary: Create a pull story
      description: |
        Generate a pull story from a structured code brief. Returns immediately
        with `status: generating` on a cache miss. Poll `GET /stories/{id}`
        until `status: ready`.

        Generation can take several minutes depending on brief size.
      operationId: createStory
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateStoryRequest'
      responses:
        '200':
          description: Cached story is ready
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Story'
        '202':
          description: Generation accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Story'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/InsufficientMinutes'
        '429':
          $ref: '#/components/responses/RateLimit'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  schemas:
    CreateStoryRequest:
      type: object
      required:
        - title
        - summary
        - files
      properties:
        title:
          type: string
          minLength: 3
          maxLength: 140
          example: How auth works in this codebase
        summary:
          type: string
          minLength: 10
          maxLength: 2000
          example: >-
            JWT-based auth. Client hits /login, server validates credentials,
            issues JWT, and stores the session in Redis.
        repo:
          $ref: '#/components/schemas/BriefRepo'
        files:
          type: array
          minItems: 1
          maxItems: 20
          items:
            $ref: '#/components/schemas/BriefFile'
        flow:
          type: array
          minItems: 3
          maxItems: 7
          items:
            type: string
            minLength: 3
            maxLength: 500
        highlights:
          type: array
          maxItems: 8
          items:
            type: string
            minLength: 3
            maxLength: 200
    Story:
      type: object
      properties:
        id:
          type: string
          example: brief_0123abcd4567ef89
        status:
          type: string
          enum:
            - generating
            - ready
            - failed
        url:
          type: string
          example: https://pullstory.com/s/brief_0123abcd4567ef89
        cached:
          type: boolean
          example: false
        message:
          type: string
          example: Another request is already generating this story
        estimated_seconds:
          type: integer
          nullable: true
          example: 90
        duration_seconds:
          type: integer
          nullable: true
          example: 142
        scenes:
          type: integer
          nullable: true
          example: 8
        title:
          type: string
          example: How auth works in this codebase
        error:
          type: string
          nullable: true
          example: Story generation failed. Retry with a smaller brief.
    BriefRepo:
      type: object
      required:
        - owner
        - name
      properties:
        owner:
          type: string
          minLength: 1
          maxLength: 100
          example: acme
        name:
          type: string
          minLength: 1
          maxLength: 100
          example: billing
        branch:
          type: string
          maxLength: 200
          example: feat/payment-retries
    BriefFile:
      type: object
      required:
        - path
      properties:
        path:
          type: string
          minLength: 1
          maxLength: 500
          example: src/auth/login.ts
        role:
          type: string
          maxLength: 500
          example: Login entry point
        language:
          type: string
          maxLength: 40
          example: typescript
        excerpt:
          type: string
          maxLength: 20000
          example: export async function POST(req) { ... }
        startLine:
          type: integer
          minimum: 1
          example: 12
        endLine:
          type: integer
          minimum: 1
          example: 47
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            request_id:
              type: string
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InsufficientMinutes:
      description: Monthly video quota exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimit:
      description: Too many requests
      headers:
        Retry-After:
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ServiceUnavailable:
      description: Service temporarily unavailable
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````