openapi: 3.0.3
info:
  title: Snapsly API
  description: API for capturing screenshots, generating PDFs, and creating dynamic OpenGraph images.
  version: 1.0.0
servers:
  - url: https://api.snapsly.dev/v1
    description: Production server
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
security:
  - bearerAuth: []
paths:
  /screenshot:
    post:
      summary: Capture a Screenshot
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - url
              properties:
                url:
                  type: string
                  format: uri
                format:
                  type: string
                  enum: [png, jpeg, webp]
                  default: png
                fullPage:
                  type: boolean
                  default: false
                width:
                  type: integer
                  default: 1280
                height:
                  type: integer
                  default: 800
                waitFor:
                  type: integer
                  default: 0
                blockAds:
                  type: boolean
                  default: false
                darkMode:
                  type: boolean
                  default: false
                mode:
                  type: string
                  enum: [default, ai]
                  default: default
                headers:
                  type: object
                  description: "Business Tier: Custom HTTP headers"
                cookies:
                  type: array
                  description: "Business Tier: Custom cookies"
                  items:
                    type: object
      responses:
        '200':
          description: Successful capture
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                  metadata:
                    type: object
  /pdf:
    post:
      summary: Generate a PDF
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - url
              properties:
                url:
                  type: string
                  format: uri
                pageSize:
                  type: string
                  default: A4
                landscape:
                  type: boolean
                  default: false
                printBackground:
                  type: boolean
                  default: true
                waitFor:
                  type: integer
                  default: 0
                headers:
                  type: object
                  description: "Business Tier: Custom HTTP headers"
                cookies:
                  type: array
                  description: "Business Tier: Custom cookies"
                  items:
                    type: object
      responses:
        '200':
          description: Successful PDF generation
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
  /og:
    post:
      summary: Generate an OpenGraph Image
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - template
                - data
              properties:
                template:
                  type: string
                  example: blog-post
                data:
                  type: object
                  description: Variables to inject into the template
      responses:
        '200':
          description: Successful OG image generation
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
  /batch:
    post:
      summary: Batch Captures (Pro & Business)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - requests
              properties:
                requests:
                  type: array
                  items:
                    type: object
      responses:
        '200':
          description: Successful batch processing
          content:
            application/json:
              schema:
                type: object
                properties:
                  results:
                    type: array
                    items:
                      type: object
