{
  "openapi": "3.1.0",
  "info": {
    "title": "CertPing Domain search API",
    "version": "1.0",
    "description": "Whether domain names are available, and what they cost at CertPing. Read-only: it never registers or reserves a name. Create a key in the CertPing app under Domains, Developer API keys. Guide: https://www.certping.com/developers/domain-search/"
  },
  "servers": [
    {
      "url": "https://dns-api.certping.com/api/v1/domains/token-api"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "paths": {
    "/domains/availability": {
      "get": {
        "operationId": "checkAvailability",
        "summary": "Check whether names can be registered, with their prices.",
        "description": "Spends one of the organization's 60 availability checks a minute, unless the name is malformed or its ending is not sold (400). Answers may be up to a minute old.",
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "description": "A full name such as example.com. Checks that one name. Takes precedence over name.",
            "schema": {
              "type": "string",
              "maxLength": 253
            }
          },
          {
            "name": "name",
            "in": "query",
            "description": "A name without an ending, such as example. Checks it under the popular endings we sell.",
            "schema": {
              "type": "string",
              "maxLength": 253
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One result per name checked.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AvailabilityResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "423": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Throttled"
          },
          "502": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          },
          "504": {
            "$ref": "#/components/responses/Error"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/domains/prices": {
      "get": {
        "operationId": "listPrices",
        "summary": "Our one-year prices for the popular endings.",
        "description": "Never spends availability checks. Prices change rarely; keep the list for a few minutes.",
        "responses": {
          "200": {
            "description": "One line per ending, in our order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PricesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "423": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Throttled"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "A CertPing API key, cpk_live_ and 64 characters, holding the domains:search permission."
      }
    },
    "headers": {
      "RateLimitLimit": {
        "description": "Availability checks the organization may make a minute.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimitRemaining": {
        "description": "Checks left in the current minute.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimitReset": {
        "description": "The window length in seconds on an allowed request; on a refused one, the seconds until the window ends.",
        "schema": {
          "type": "integer"
        }
      },
      "RetryAfter": {
        "description": "Seconds to wait before trying again.",
        "schema": {
          "type": "integer"
        }
      }
    },
    "responses": {
      "Error": {
        "description": "The request was refused or failed; message says why.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Throttled": {
        "description": "A rate limit or the organization's quota is spent.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Price": {
        "description": "An amount with two decimals in the response's currency; null where we do not sell that term, such as one year of .ai, or where it cannot be quoted right now. Never free.",
        "type": ["number", "null"],
        "examples": [13.0]
      },
      "Term": {
        "type": "object",
        "required": ["years", "total"],
        "properties": {
          "years": {
            "type": "integer",
            "minimum": 1
          },
          "total": {
            "$ref": "#/components/schemas/Price"
          }
        }
      },
      "Result": {
        "type": "object",
        "required": [
          "domain",
          "tld",
          "availability",
          "purchasable",
          "premium",
          "registrationPrice",
          "renewalPrice",
          "transferPrice",
          "registrationTerms"
        ],
        "properties": {
          "domain": {
            "type": "string",
            "examples": ["example.com"]
          },
          "tld": {
            "type": "string",
            "examples": ["com"]
          },
          "availability": {
            "type": "string",
            "enum": ["AVAILABLE", "TAKEN", "UNKNOWN"],
            "description": "UNKNOWN means the registry could not be asked just then; it is never a guess either way."
          },
          "purchasable": {
            "type": "boolean",
            "description": "False for a name that cannot be bought online, such as some premium names."
          },
          "premium": {
            "type": "boolean"
          },
          "registrationPrice": {
            "$ref": "#/components/schemas/Price"
          },
          "renewalPrice": {
            "$ref": "#/components/schemas/Price"
          },
          "transferPrice": {
            "$ref": "#/components/schemas/Price"
          },
          "registrationTerms": {
            "type": "array",
            "description": "Each term a registration may be bought for, shortest first, with its total.",
            "items": {
              "$ref": "#/components/schemas/Term"
            }
          }
        }
      },
      "AvailabilityResponse": {
        "type": "object",
        "required": ["query", "currency", "results"],
        "properties": {
          "query": {
            "type": "string",
            "examples": ["example.com"]
          },
          "currency": {
            "type": "string",
            "examples": ["USD"]
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Result"
            }
          },
          "retryAfterSeconds": {
            "type": "integer",
            "description": "Present when some results are UNKNOWN because a registry was busy; ask again after it."
          }
        }
      },
      "PriceLine": {
        "type": "object",
        "required": [
          "tld",
          "registrationPrice",
          "renewalPrice",
          "transferPrice",
          "registrationTerm",
          "renewalTerm"
        ],
        "properties": {
          "tld": {
            "type": "string"
          },
          "registrationPrice": {
            "$ref": "#/components/schemas/Price"
          },
          "renewalPrice": {
            "$ref": "#/components/schemas/Price"
          },
          "transferPrice": {
            "$ref": "#/components/schemas/Price"
          },
          "registrationTerm": {
            "description": "The shortest registration we sell, two years for .ai; null where none is sold.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/Term"
              },
              {
                "type": "null"
              }
            ]
          },
          "renewalTerm": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Term"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "PricesResponse": {
        "type": "object",
        "required": ["currency", "prices"],
        "properties": {
          "currency": {
            "type": "string",
            "examples": ["USD"]
          },
          "prices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PriceLine"
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": ["status", "message"],
        "properties": {
          "status": {
            "type": "integer"
          },
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "requestId": {
            "type": "string"
          },
          "correlationId": {
            "type": "string"
          }
        }
      }
    }
  }
}
