{
  "openapi": "3.1.0",
  "info": {
    "title": "DomLibre — Domain Availability API",
    "description": "Checks real-time domain availability and returns a direct purchase link via Namecheap affiliate when the domain is free.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://domlibre.com"
    }
  ],
  "paths": {
    "/api/check": {
      "get": {
        "operationId": "checkDomainAvailability",
        "summary": "Check domain name availability",
        "description": "Verifies in real time whether a domain name is available for registration.",
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": true,
            "description": "Name or domain to check.",
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9-]+(\\.[a-zA-Z]{2,})?$"
            },
            "examples": {
              "domain": {
                "value": "startupname.com"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Availability results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": ["name", "message", "results"],
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["tld", "domain", "available", "buy_url"],
                        "properties": {
                          "tld": {
                            "type": "string"
                          },
                          "domain": {
                            "type": "string"
                          },
                          "available": {
                            "type": "boolean"
                          },
                          "buy_url": {
                            "type": ["string", "null"],
                            "description": "Affiliate link to register the domain if available. Null if not available."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid domain parameter"
          },
          "500": {
            "description": "Server error"
          }
        }
      }
    }
  }
}
