> ## 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.

# Port Scanner



## OpenAPI

````yaml POST /openport
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:
  /openport:
    post:
      tags:
        - api-tool
      summary: Scan a website for open ports
      operationId: openPorts
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OpenPortDto'
      responses:
        '200':
          description: Open ports retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenPortResponseDto'
        '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.
        '408':
          description: Port scan timed out.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseErrorResponseDto'
              example:
                timestamp: 1700000000000
                apiStatus: failure
                apiCode: 408
                message: NMAP_TIMEOUT
                details: The port scan timed out before it could complete.
        '500':
          description: Port scan failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseErrorResponseDto'
              example:
                timestamp: 1700000000000
                apiStatus: failure
                apiCode: 500
                message: PORT_SCAN_FAILED
                details: >-
                  Our port scanning service encountered an unexpected error
                  while attempting to scan the target.
components:
  schemas:
    OpenPortDto:
      type: object
      properties:
        url:
          type: string
          description: The URL to be checked
          example: https://example.com
        topPorts:
          type: number
          description: Scan only the top N ports (optional)
          example: 100
          enum:
            - 50
            - 100
            - 500
            - 1000
            - 5000
        portRanges:
          type: string
          description: Custom port ranges to scan, e.g., "80,443,1000-1010"
          example: 80,443,1000-1010
      required:
        - url
    OpenPortResponseDto:
      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/OpenPortMetaDto'
        data:
          description: List of open ports found
          type: array
          items:
            type: number
      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
    OpenPortMetaDto:
      type: object
      properties:
        url:
          type: string
          description: The scanned URL
          example: https://example.com
        topPorts:
          type: number
          description: Top ports scanned (if any)
          example: 100
          enum:
            - 50
            - 100
            - 500
            - 1000
            - 5000
        portRanges:
          type: string
          description: Custom port ranges scanned (if any)
          example: 80,443,1000-1010
        test:
          description: Test details object
          allOf:
            - $ref: '#/components/schemas/TestMetaDto'
      required:
        - url
        - 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

````