{
  "openapi": "3.1.0",
  "info": {
    "title": "eytan.io interest matching API",
    "version": "1.0.0",
    "description": "Compare a person's interests with Eytan Elbaz's and get overlaps plus conversation starters. Stateless; nothing is stored."
  },
  "servers": [
    {
      "url": "https://eytan.io"
    }
  ],
  "paths": {
    "/api/match.php": {
      "get": {
        "operationId": "matchInterestsGet",
        "summary": "Find overlaps between your interests and Eytan's",
        "parameters": [
          {
            "name": "interests",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated interests, e.g. 'jazz piano, real estate, startups' (max 50 items, 2000 chars)"
          }
        ],
        "responses": {
          "200": {
            "description": "Match results",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MatchResult"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "matchInterestsPost",
        "summary": "Find overlaps (JSON body)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "interests"
                ],
                "properties": {
                  "interests": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 50
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Match results",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MatchResult"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Match": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "current",
              "background",
              "earlier"
            ]
          },
          "theme": {
            "type": "string"
          },
          "score": {
            "type": "number"
          },
          "matched_terms": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "why": {
            "type": "string"
          },
          "premise": {
            "type": "string"
          },
          "needs": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "conversation_starters": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "learn_more": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "MatchResult": {
        "type": "object",
        "properties": {
          "query": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "match_count": {
            "type": "integer"
          },
          "matches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Match"
            }
          },
          "unmatched_terms": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "suggested_topics": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "contact": {
            "type": "string"
          },
          "note": {
            "type": "string"
          }
        }
      }
    }
  }
}
