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

# Generate Content Draft

> Generate a draft marketing/blog article and save it as draft content.

Writes the AI-generated article (markdown) to a new content record and
returns its id, title, body, slug, and status. Costs credits. Use the
returned id to finalize the draft or to open it for editing.



## OpenAPI

````yaml /openapi.json post /v1/content/draft
openapi: 3.1.0
info:
  title: Lightsage Public API
  description: Public API for Lightsage CLI and external integrations.
  version: 1.0.0
servers:
  - url: https://api.lightsage.com
    description: Production
security: []
paths:
  /v1/content/draft:
    post:
      tags:
        - Content
      summary: Generate Content Draft
      description: |-
        Generate a draft marketing/blog article and save it as draft content.

        Writes the AI-generated article (markdown) to a new content record and
        returns its id, title, body, slug, and status. Costs credits. Use the
        returned id to finalize the draft or to open it for editing.
      operationId: content_generate_draft
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateContentDraftRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicContent'
        '402':
          description: The organization does not have enough credits to generate content.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                required:
                  - detail
              examples:
                insufficient_credits:
                  summary: Not enough credits
                  value:
                    detail: 'Insufficient credits: need 10, balance 3.'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - LightsageApiKeyAuth: []
components:
  schemas:
    GenerateContentDraftRequest:
      properties:
        title:
          type: string
          title: Title
          description: Article title/headline.
        topic_name:
          type: string
          title: Topic Name
          description: Topic or theme; defaults to the title when omitted.
        description:
          type: string
          title: Description
          description: Optional brief describing angle, audience, or goals.
        prompt_texts:
          items:
            type: string
          type: array
          title: Prompt Texts
          description: Optional related prompts/questions to ground the article.
      type: object
      required:
        - title
      title: GenerateContentDraftRequest
      description: Generate a draft marketing/blog article and save it.
    PublicContent:
      properties:
        id:
          type: string
          title: Id
        title:
          type: string
          title: Title
        text:
          type: string
          title: Text
        slug:
          type: string
          title: Slug
        status:
          type: string
          title: Status
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
      type: object
      required:
        - id
        - title
        - text
        - slug
        - status
      title: PublicContent
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    LightsageApiKeyAuth:
      type: apiKey
      in: header
      name: X-Lightsage-Api-Key

````