{
  "openapi": "3.1.0",
  "info": {
    "title": "data.sh free distribution and chat API",
    "version": "1.0.0"
  },
  "servers": [{ "url": "https://data.sh" }],
  "paths": {
    "/skills/index.json": {
      "get": {
        "summary": "List free DATA skills",
        "responses": { "200": { "description": "Skill catalog" } }
      }
    },
    "/skills/download": {
      "get": {
        "summary": "Download the free DATA skills archive",
        "responses": {
          "200": { "description": "ZIP archive" },
          "503": { "description": "Archive temporarily unavailable" }
        }
      }
    },
    "/downloads/data-latest.zip": {
      "get": {
        "summary": "Download the free DATA skills archive",
        "responses": {
          "200": { "description": "ZIP archive" },
          "503": { "description": "Archive temporarily unavailable" }
        }
      }
    },
    "/api/data-sh/terminal": {
      "post": {
        "summary": "Chat with DATA",
        "responses": { "200": { "description": "Server-sent event stream" } }
      }
    },
    "/api/data-sh/leads": {
      "post": {
        "summary": "Optionally register a DATA user's owner",
        "description": "Public, owner-approved registration for DATA follow-up. Ask the owner before submitting personal details. This endpoint is optional: skipping it, refusing it, or receiving an error never blocks the full free download or installation.",
        "operationId": "submitDataShLead",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/DataShLead" }
            }
          }
        },
        "responses": {
          "201": {
            "description": "A new owner-approved lead was stored without echoing personal details",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/DataShLeadReceipt" }
              }
            }
          },
          "200": {
            "description": "The same owner-approved lead was already stored",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/DataShLeadReceipt" }
              }
            }
          },
          "400": {
            "description": "Malformed, unapproved, or out-of-bounds submission"
          },
          "503": {
            "description": "Registration unavailable; the free download remains available"
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "summary": "DATA Streamable HTTP MCP endpoint",
        "responses": { "200": { "description": "MCP JSON-RPC response" } }
      }
    }
  },
  "components": {
    "schemas": {
      "DataShLead": {
        "type": "object",
        "additionalProperties": false,
        "required": ["source", "consent"],
        "properties": {
          "name": { "type": "string", "minLength": 1, "maxLength": 120 },
          "title": { "type": "string", "minLength": 1, "maxLength": 120 },
          "email": { "type": "string", "format": "email", "maxLength": 254 },
          "phone": { "type": "string", "minLength": 7, "maxLength": 40 },
          "website": { "type": "string", "format": "uri", "maxLength": 2048 },
          "social": {
            "type": "object",
            "minProperties": 1,
            "maxProperties": 12,
            "propertyNames": { "pattern": "^[a-z][a-z0-9_-]{0,31}$" },
            "additionalProperties": {
              "type": "string",
              "format": "uri",
              "maxLength": 2048
            }
          },
          "agent": {
            "type": "object",
            "additionalProperties": false,
            "required": ["client", "version"],
            "properties": {
              "client": { "type": "string", "minLength": 1, "maxLength": 80 },
              "version": { "type": "string", "minLength": 1, "maxLength": 80 }
            }
          },
          "source": {
            "type": "string",
            "enum": ["curl", "browser", "mcp", "browser-use"]
          },
          "consent": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "ownerApproved",
              "contactAllowed",
              "disclosureVersion"
            ],
            "properties": {
              "ownerApproved": { "const": true },
              "contactAllowed": { "type": "boolean" },
              "disclosureVersion": { "const": "data-sh-first-contact.v1" }
            }
          }
        },
        "anyOf": [
          { "required": ["name"] },
          { "required": ["title"] },
          { "required": ["email"] },
          { "required": ["phone"] },
          { "required": ["website"] },
          { "required": ["social"] }
        ]
      },
      "DataShLeadReceipt": {
        "type": "object",
        "additionalProperties": false,
        "required": ["saved", "duplicate", "submissionId", "receivedAt"],
        "properties": {
          "saved": { "const": true },
          "duplicate": { "type": "boolean" },
          "submissionId": { "type": "string" },
          "receivedAt": { "type": "string", "format": "date-time" }
        }
      }
    }
  }
}
