{
  "openapi": "3.0.3",
  "info": {
    "title": "CanItFlip API",
    "version": "1.0.0",
    "description": "Public domain sales data and domain resale appraisals. Sales data is read-only and cacheable. Appraisals are limited to 5 per day per visitor.",
    "contact": {
      "url": "https://canitflip.com/about"
    }
  },
  "servers": [
    {
      "url": "https://canitflip.com"
    }
  ],
  "paths": {
    "/api/sales": {
      "get": {
        "operationId": "getSales",
        "summary": "Query the public domain sales archive",
        "description": "No parameters: archive overview. `domain`: every sale of one domain. `tld`: statistics for one extension. `search=1` (or any filter): filtered list of sales.",
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "example": "voice.com"
          },
          {
            "name": "tld",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "example": "ai"
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            }
          },
          {
            "name": "contains",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "min_price",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "max_price",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "min_length",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "max_length",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "year",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "price",
                "date"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Overview, domain history, extension statistics or search results, depending on parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sales": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "domain": {
                            "type": "string"
                          },
                          "price_usd": {
                            "type": "number"
                          },
                          "sale_date": {
                            "type": "string",
                            "format": "date"
                          },
                          "tld": {
                            "type": "string"
                          },
                          "venue": {
                            "type": "string",
                            "nullable": true
                          },
                          "source": {
                            "type": "string",
                            "nullable": true
                          },
                          "source_url": {
                            "type": "string",
                            "nullable": true
                          },
                          "page_url": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter."
          }
        }
      }
    },
    "/api/appraise": {
      "post": {
        "operationId": "appraiseDomain",
        "summary": "Appraise a domain for resale",
        "description": "Returns an estimated resale range and verdict. Limited to 5 appraisals per day per visitor; repeated domains may be served from a recent result.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "domain"
                ],
                "properties": {
                  "domain": {
                    "type": "string",
                    "example": "example.com"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Appraisal result.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "resale_value": {
                      "type": "object",
                      "properties": {
                        "floor": {
                          "type": "number"
                        },
                        "mid": {
                          "type": "number"
                        },
                        "ceiling": {
                          "type": "number"
                        }
                      }
                    },
                    "can_it_flip": {
                      "type": "string",
                      "enum": [
                        "yes",
                        "hold_6m",
                        "hold_2y",
                        "no"
                      ]
                    },
                    "data_confidence": {
                      "type": "string"
                    },
                    "key_strengths": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "key_risks": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "hard_disqualifiers": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "reasoning": {
                      "type": "string"
                    },
                    "remaining": {
                      "type": "integer",
                      "description": "Appraisals left today"
                    },
                    "cached": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid domain."
          },
          "429": {
            "description": "Daily limit reached or too many requests."
          },
          "502": {
            "description": "Could not produce a reliable appraisal; try again."
          },
          "503": {
            "description": "Temporarily unavailable."
          }
        }
      }
    },
    "/api/mcp": {
      "post": {
        "operationId": "mcp",
        "summary": "Model Context Protocol endpoint (JSON-RPC 2.0)",
        "description": "Stateless MCP server over Streamable HTTP with JSON responses. Methods: initialize, tools/list, tools/call, ping. Tools: lookup_domain_sale, get_tld_sales_stats, search_domain_sales, get_sales_archive_overview.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response."
          },
          "202": {
            "description": "Notification accepted."
          }
        }
      }
    }
  }
}