openapi: 3.0.3
servers:
  - url: https://prod.api.market/api/v1/eiconstela/x-screenshot
info:
  title: Twitter/X Screenshot API
  description: Twitter / X Screenshot API Capture X post or tweet as a
    high-quality screenshot image with customization support via API
  version: 1.0.0
  contact:
    email: razifrizqullah@gmail.com
paths:
  /screenshot:
    post:
      summary: Generate a screenshot of a Twitter (X) post
      description: Takes a Twitter (X) post URL and optional parameters to generate a
        customized screenshot.
      operationId: generateScreenshot
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ScreenshotRequest"
            example:
              url: https://x.com/X/status/1875641065375711512
              light_mode: dim
              transparent: false
              padding: 50
              format: bytes
              show_views: true
              show_reply: true
              show_like: true
              show_retweet: true
              show_bookmark: true
              show_datetime: true
              zoom_level: 1.75
      responses:
        "200":
          description: Successful response with screenshot data
          content:
            image/png:
              schema:
                type: string
                format: binary
                description: Raw screenshot bytes (PNG) when format is 'bytes'
            application/json:
              schema:
                $ref: "#/components/schemas/Base64Response"
              example:
                status: success
                message: Screenshot OK
                data:
                  base64: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAD7QAACLLCAYAAAAMY2VVAAEAAElEQVR4nOzdd5xcdbk/
        "400":
          description: Bad Request (invalid input)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "422":
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "429":
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
        "500":
          description: Server Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
      security:
        - RapidAPIKey: []
    parameters:
      - &a1
        description: API.market API Key
        in: header
        name: x-api-market-key
        value: Please Login/Signup to get an API Key
        required: true
        schema:
          type: string
  /healthcheck:
    get:
      summary: Public healthcheck endpoint
      description: Check the server uptime and status.
      operationId: healthCheck
      responses:
        "200":
          description: Server is up and running
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: up
                  uptime:
                    type: number
                    description: Server uptime in seconds
                    example: 86400
        "500":
          description: Server Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
    parameters:
      - *a1
components:
  schemas:
    ScreenshotRequest:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          format: uri
          description: The full URL of the Twitter (X) post to screenshot
          example: https://x.com/X/status/1875641065375711512
        light_mode:
          type: string
          enum:
            - light
            - dim
            - dark
          default: dim
          description: Theme of the screenshot
        transparent:
          type: boolean
          default: false
          description: Whether the background should be transparent
        padding:
          type: integer
          default: 50
          description: Padding around the screenshot in pixels
        format:
          type: string
          enum:
            - bytes
            - base64
          default: bytes
          description: Output format of the screenshot
        show_views:
          type: boolean
          default: true
          description: Whether to display the view count
        show_reply:
          type: boolean
          default: true
          description: Whether to display the reply count
        show_like:
          type: boolean
          default: true
          description: Whether to display the like count
        show_retweet:
          type: boolean
          default: true
          description: Whether to display the retweet count
        show_bookmark:
          type: boolean
          default: true
          description: Whether to display the bookmark count
        show_datetime:
          type: boolean
          default: true
          description: Whether to display the date and time of the tweet
        zoom_level:
          type: number
          default: 1.75
          minimum: 1.25
          maximum: 2.5
          description: Zoom level for the screenshot
    Base64Response:
      type: object
      properties:
        status:
          type: string
          example: success
        message:
          type: string
          example: Screenshot OK
        data:
          type: object
          properties:
            base64:
              type: string
              description: Base64-encoded screenshot image
              example: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAD7QAACLLCAYAAAAMY2VVAAEAAElEQVR4nOzdd5xcdbk/
    ErrorResponse:
      type: object
      properties:
        status:
          type: string
          example: error
        message:
          type: string
          example: Invalid input
  securitySchemes: {}
security: {}
tags:
  - name: media
    description: Operations related to media
  - name: business
    description: Operations related to business
  - name: advertising
    description: Operations related to advertising
  - name: image
    description: Operations related to image
  - name: social
    description: Operations related to social
