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

# Lighthouse



## OpenAPI

````yaml POST /lighthouse
openapi: 3.1.0
info:
  title: Geekflare
  description: Official OpenAPI specification for all Geekflare endpoints.
  version: 1.0.0
  license:
    name: MIT
servers:
  - url: https://api.geekflare.com
security:
  - x-api-key: []
paths:
  /lighthouse:
    post:
      tags:
        - api-tool
      summary: Run Lighthouse audit on a website
      operationId: lighthouse
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LighthouseDto'
      responses:
        '200':
          description: Successfully ran Lighthouse audit
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LighthouseResponseDto'
        '400':
          description: Invalid URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseErrorResponseDto'
              example:
                timestamp: 1700000000000
                apiStatus: failure
                apiCode: 400
                message: INVALID_URL
                details: The URL must be a valid HTTP or HTTPS URL.
        '422':
          description: Unable to connect to the target website.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseErrorResponseDto'
              example:
                timestamp: 1700000000000
                apiStatus: failure
                apiCode: 422
                message: UNABLE_TO_CONNECT
                details: >-
                  The destination server could not be resolved, refused the
                  connection, timed out, or is redirecting indefinitely.
        '500':
          description: Lighthouse audit failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseErrorResponseDto'
              example:
                timestamp: 1700000000000
                apiStatus: failure
                apiCode: 500
                message: LIGHTHOUSE_UNEXPECTED
                details: Unexpected Lighthouse audit failure.
components:
  schemas:
    LighthouseDto:
      type: object
      properties:
        url:
          type: string
          description: Target URL
          example: https://example.com
        device:
          type: string
          description: Device type to emulate. Defaults to desktop.
          example: desktop
          enum:
            - desktop
            - mobile
          default: desktop
        followRedirect:
          type: boolean
          description: Whether to follow redirects when checking site status
          example: false
          default: false
        proxyCountry:
          type: string
          description: Proxy country code to route the request
          example: us
        parameters:
          description: Extra Lighthouse CLI parameters
          example:
            - '--only-categories=seo'
          type: array
          items:
            type: string
      required:
        - url
    LighthouseResponseDto:
      type: object
      properties:
        timestamp:
          type: number
          description: Timestamp of the request in milliseconds
          example: 1783943217189
        apiStatus:
          type: string
          description: API status message
          example: success
          enum:
            - success
            - failure
        apiCode:
          type: number
          description: API status code
          example: 200
        meta:
          description: Metadata about the request
          allOf:
            - $ref: '#/components/schemas/LighthouseMetaDto'
        data:
          type: string
          description: URL to the Lighthouse report
          example: https://example.com/report.html
      required:
        - timestamp
        - apiStatus
        - apiCode
        - meta
        - data
    BaseErrorResponseDto:
      type: object
      properties:
        timestamp:
          type: number
          description: Timestamp of the request in milliseconds
          example: 1778737930991
        apiStatus:
          type: string
          description: API status message
          example: success
          enum:
            - success
            - failure
        apiCode:
          type: number
          description: API status code
          example: 200
        message:
          type: string
          description: Error message
          example: Invalid URL provided
        details:
          type: string
          description: Detailed error information
          example: The URL must be a valid HTTP or HTTPS URL
      required:
        - timestamp
        - apiStatus
        - apiCode
        - message
    LighthouseMetaDto:
      type: object
      properties:
        url:
          type: string
          description: Target URL
          example: https://example.com
        device:
          type: string
          description: Device type used
          enum:
            - desktop
            - mobile
        followRedirect:
          type: boolean
          description: Whether redirects were followed
        redirectedURL:
          type: string
          description: Final URL after redirection (if any)
          example: https://example.com/
        proxyCountry:
          type: string
          description: Proxy country used, if any
        test:
          description: Test details object
          allOf:
            - $ref: '#/components/schemas/TestMetaDto'
      required:
        - url
        - device
        - followRedirect
        - redirectedURL
        - test
    TestMetaDto:
      type: object
      properties:
        id:
          type: string
          description: Unique test identifier
          example: mxqx9v9y0742lap6altwdteqd28t23nq
      required:
        - id
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key
      description: API Key required for all endpoints

````