{
  "openapi": "3.1.0",
  "info": {
    "title": "Gatehills Domains & SSL Certificates API",
    "summary": "One API to register, manage, and scale 700+ domains and SSL certificates.",
    "description": "White-label REST API for domain registration, transfer, renewal, DNS management, and SSL certificate lifecycle. Built for hosting providers, SaaS platforms, site builders, agencies, and ISPs. ICANN & TDRA accredited.",
    "version": "1.0.0",
    "termsOfService": "https://www.gatehills.com/legal/terms",
    "contact": {
      "name": "Gatehills API team",
      "url": "https://www.gatehills.com/contact-api",
      "email": "api@gatehills.com"
    },
    "license": { "name": "Proprietary", "url": "https://www.gatehills.com/legal/terms" }
  },
  "servers": [
    { "url": "https://api.gatehills.com/v1", "description": "Production" }
   
  ],
  "externalDocs": {
    "description": "Full documentation",
    "url": "https://www.gatehills.com/api-connection"
  },
  "security": [{ "oauth2": ["domains:read"] }],
  "paths": {
    "/domains/availability": {
      "get": {
        "operationId": "checkDomainAvailability",
        "summary": "Check whether a domain name is available to register",
        "tags": ["Domains"],
        "security": [{ "oauth2": ["domains:read"] }],
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": true,
            "description": "Fully qualified domain name, e.g. example.ae",
            "schema": { "type": "string", "example": "example.ae" }
          }
        ],
        "responses": {
          "200": {
            "description": "Availability result",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AvailabilityResult" }
              }
            }
          }
        }
      }
    },
    "/tlds/pricing": {
      "get": {
        "operationId": "getTldPricing",
        "summary": "Get transparent pricing for a TLD",
        "description": "The price you see is the price you pay — no tiered surcharges.",
        "tags": ["Domains"],
        "security": [{ "oauth2": ["domains:read"] }],
        "parameters": [
          {
            "name": "tld",
            "in": "query",
            "required": true,
            "schema": { "type": "string", "example": "ae" }
          }
        ],
        "responses": {
          "200": {
            "description": "Pricing for the requested TLD",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/TldPricing" }
              }
            }
          }
        }
      }
    },
    "/domains": {
      "post": {
        "operationId": "registerDomain",
        "summary": "Register a domain name",
        "tags": ["Domains"],
        "security": [{ "oauth2": ["domains:write"] }],
        "x-payment-info": {
          "intent": "charge",
          "method": ["tempo", "stripe", "card"],
          "amount": "dynamic",
          "currency": "USD",
          "description": "Charged the registration fee for the requested TLD and term. Call GET /tlds/pricing for the exact amount before purchase.",
          "pricing": "https://api.gatehills.com/registrar/api/tld/pricing/1"
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/DomainRegistration" }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Domain registered",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Domain" }
              }
            }
          },
          "402": { "description": "Payment required — see x-payment-info" }
        }
      }
    },
    "/ssl/certificates": {
      "post": {
        "operationId": "issueSslCertificate",
        "summary": "Issue an SSL certificate",
        "tags": ["SSL"],
        "security": [{ "oauth2": ["ssl:write"] }],
        "x-payment-info": {
          "intent": "charge",
          "method": ["tempo", "stripe", "card"],
          "amount": "dynamic",
          "currency": "USD",
          "description": "Charged the issuance fee for the selected certificate product."
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CertificateRequest" }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Certificate order created",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Certificate" }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Service health check",
        "tags": ["System"],
        "security": [],
        "responses": {
          "200": {
            "description": "Service is healthy",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "status": { "type": "string", "example": "ok" } }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "description": "OAuth 2.0. Discover endpoints at https://www.gatehills.com/.well-known/oauth-authorization-server",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://auth.gatehills.com/oauth2/token",
            "scopes": {
              "domains:read": "Read domain and availability data",
              "domains:write": "Register, transfer, and manage domains",
              "ssl:read": "Read SSL certificate data",
              "ssl:write": "Issue and manage SSL certificates",
              "dns:read": "Read DNS records",
              "dns:write": "Manage DNS records"
            }
          }
        }
      }
    },
    "schemas": {
      "AvailabilityResult": {
        "type": "object",
        "properties": {
          "domain": { "type": "string", "example": "example.ae" },
          "available": { "type": "boolean", "example": true },
          "premium": { "type": "boolean", "example": false }
        }
      },
      "TldPricing": {
        "type": "object",
        "properties": {
          "tld": { "type": "string", "example": "ae" },
          "currency": { "type": "string", "example": "USD" },
          "register": { "type": "number", "example": 24.0 },
          "renew": { "type": "number", "example": 24.0 },
          "transfer": { "type": "number", "example": 24.0 }
        }
      },
      "DomainRegistration": {
        "type": "object",
        "required": ["domain", "years"],
        "properties": {
          "domain": { "type": "string", "example": "example.ae" },
          "years": { "type": "integer", "minimum": 1, "maximum": 10, "example": 1 },
          "autoRenew": { "type": "boolean", "default": true }
        }
      },
      "Domain": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "example": "dom_9f8a" },
          "domain": { "type": "string", "example": "example.ae" },
          "status": { "type": "string", "example": "active" },
          "expiresAt": { "type": "string", "format": "date-time" }
        }
      },
      "CertificateRequest": {
        "type": "object",
        "required": ["commonName", "product"],
        "properties": {
          "commonName": { "type": "string", "example": "example.ae" },
          "product": { "type": "string", "example": "dv-single" },
          "csr": { "type": "string" }
        }
      },
      "Certificate": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "example": "cert_1a2b" },
          "commonName": { "type": "string", "example": "example.ae" },
          "status": { "type": "string", "example": "issued" }
        }
      }
    }
  }
}