openapi: 3.0.0
info:
  title: URL Content Fetcher API
  description: API for fetching and parsing web content, optimized for LLM processing
  version: 1.0.0
servers:
  - url: https://cgptapi.buxo.ca
security:
  - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
  schemas:
    ScraperRequest:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          format: uri
          description: Target URL to scrape content from
        includeLinks:
          type: boolean
          default: false
          description: Whether to include hyperlinks in response
        includeImages:
          type: boolean
          default: false
          description: Whether to include images in response
        timeout:
          type: integer
          default: 600000
          description: Request timeout in milliseconds
    ContentElement:
      type: object
      properties:
        type:
          type: string
          enum: [text]
          description: Type of content element
        content:
          type: string
          description: Actual content text
    ScraperResponse:
      type: object
      properties:
        success:
          type: boolean
        data:
          type: object
          properties:
            success:
              type: boolean
            data:
              type: object
              properties:
                title:
                  type: string
                  description: Page title
                description:
                  type: string
                  description: Page description
                content:
                  type: array
                  items:
                    $ref: '#/components/schemas/ContentElement'
paths:
  /api/scraper/content:
    post:
      operationId: scrapeContent
      summary: Fetch and parse content from specified URL
      description: Retrieves content from a URL in a format suitable for LLM processing
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScraperRequest'
      responses:
        '200':
          description: Successful content retrieval
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScraperResponse'
