API Documentation

Below is the OpenAPI 3.0 specification for the Hosting Checker API. You can use this to understand the available endpoints, parameters, and responses. For an interactive experience, you can copy the content below and paste it into an editor like Swagger Editor.

{
  "openapi": "3.0.0",
  "info": {
    "title": "Hosting Checker API",
    "version": "v1.0.0",
    "description": "API for checking hosting information of domains and IP addresses."
  },
  "servers": [
    {
      "url": "/",
      "description": "Current server"
    }
  ],
  "paths": {
    "/api/check": {
      "get": {
        "summary": "Get hosting information for a query (hostname or IP)",
        "operationId": "getHostingInfo",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": true,
            "description": "The hostname or IP address to check.",
            "schema": {
              "type": "string"
            },
            "example": "google.com"
          },
          {
            "name": "apiKey",
            "in": "query",
            "required": false,
            "description": "Optional API key for authenticated access. Alternatively, use Authorization Bearer token.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKeyAuthHeader": []
          },
          {
            "ApiKeyAuthQuery": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with hosting information.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HostingCheckResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Missing or invalid query parameter.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests - Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "The rate limit ceiling for that given request window."
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "The number of requests left for the window."
              },
              "X-RateLimit-Reset": {
                "schema": {
                  "type": "string",
                  "format": "date-time"
                },
                "description": "The UTC date and time at which the current rate limit window resets."
              }
            }
          },
          "500": {
            "description": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuthHeader": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key",
        "description": "API key provided in the Authorization header as a Bearer token."
      },
      "ApiKeyAuthQuery": {
        "type": "apiKey",
        "in": "query",
        "name": "apiKey",
        "description": "API key provided as a query parameter."
      }
    },
    "schemas": {
      "MxRecord": {
        "type": "object",
        "properties": {
          "priority": {
            "type": "integer"
          },
          "exchange": {
            "type": "string"
          }
        }
      },
      "DnsRecords": {
        "type": "object",
        "properties": {
          "A": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "AAAA": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "MX": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MxRecord"
            }
          },
          "TXT": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "CNAME": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "NS": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "nullable": true
      },
      "SslCertificateSubjectIssuer": {
        "type": "object",
        "additionalProperties": {
          "type": "string"
        },
        "example": {
          "CN": "example.com",
          "O": "Example Inc."
        }
      },
      "SSLCertificateInfo": {
        "type": "object",
        "properties": {
          "subject": {
            "$ref": "#/components/schemas/SslCertificateSubjectIssuer"
          },
          "issuer": {
            "$ref": "#/components/schemas/SslCertificateSubjectIssuer"
          },
          "validFrom": {
            "type": "string",
            "format": "date-time"
          },
          "validTo": {
            "type": "string",
            "format": "date-time"
          },
          "protocol": {
            "type": "string",
            "nullable": true
          },
          "subjectaltname": {
            "type": "string",
            "nullable": true
          },
          "fingerprint": {
            "type": "string"
          },
          "serialNumber": {
            "type": "string"
          },
          "error": {
            "type": "string",
            "nullable": true
          }
        },
        "nullable": true
      },
      "IPinfoASN": {
        "type": "object",
        "properties": {
          "asn": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "route": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        }
      },
      "IPinfoData": {
        "type": "object",
        "properties": {
          "ip": {
            "type": "string"
          },
          "hostname": {
            "type": "string",
            "nullable": true
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "region": {
            "type": "string",
            "nullable": true
          },
          "country": {
            "type": "string",
            "nullable": true
          },
          "loc": {
            "type": "string",
            "description": "Latitude,Longitude",
            "nullable": true
          },
          "org": {
            "type": "string",
            "nullable": true
          },
          "asn": {
            "$ref": "#/components/schemas/IPinfoASN",
            "nullable": true
          },
          "error": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "nullable": true
          }
        },
        "nullable": true
      },
      "ProviderInfo": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          }
        },
        "nullable": true
      },
      "HostingCheckResult": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string"
          },
          "isIp": {
            "type": "boolean"
          },
          "isHostname": {
            "type": "boolean"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "dnsRecords": {
            "$ref": "#/components/schemas/DnsRecords"
          },
          "sslInfo": {
            "$ref": "#/components/schemas/SSLCertificateInfo"
          },
          "ipInfo": {
            "$ref": "#/components/schemas/IPinfoData"
          },
          "provider": {
            "$ref": "#/components/schemas/ProviderInfo"
          },
          "error": {
            "type": "string",
            "nullable": true
          },
          "cacheHit": {
            "type": "boolean",
            "nullable": true
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "details": {
            "type": "string",
            "nullable": true
          }
        }
      }
    }
  }
}