{
  "openapi": "3.1.1",
  "info": {
    "title": "Teracrowd Public API",
    "version": "1.0.0",
    "description": "Read-only public discovery API for Teracrowd and Tera. Versioned API paths are supported for at least 90 days after a deprecation notice."
  },
  "servers": [
    {
      "url": "https://teracrowd.com",
      "description": "Production"
    }
  ],
  "paths": {
    "/api/v1": {
      "get": {
        "operationId": "getApiRoot",
        "summary": "Get public API discovery details",
        "responses": {
          "200": {
            "description": "API discovery document",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ApiRoot" }
              }
            }
          },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/api/v1/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Get public API service status",
        "responses": {
          "200": {
            "description": "API is operational",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Health" }
              }
            }
          },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/api/v1/product": {
      "get": {
        "operationId": "getProduct",
        "summary": "Get public Tera product information",
        "responses": {
          "200": {
            "description": "Public product information",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ProductResponse" }
              }
            }
          },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ApiRoot": {
        "type": "object",
        "required": ["ok", "api_version", "documentation_url", "openapi_url", "endpoints"],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "api_version": { "type": "string", "const": "v1" },
          "documentation_url": { "type": "string", "format": "uri" },
          "openapi_url": { "type": "string", "format": "uri" },
          "endpoints": { "type": "array", "items": { "type": "string" } }
        }
      },
      "Health": {
        "type": "object",
        "required": ["ok", "status", "api_version"],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "status": { "type": "string", "const": "operational" },
          "api_version": { "type": "string", "const": "v1" }
        }
      },
      "ProductResponse": {
        "type": "object",
        "required": ["ok", "product"],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "product": {
            "type": "object",
            "required": ["name", "description", "website", "early_access_url", "support_url"],
            "properties": {
              "name": { "type": "string" },
              "description": { "type": "string" },
              "website": { "type": "string", "format": "uri" },
              "early_access_url": { "type": "string", "format": "uri" },
              "support_url": { "type": "string", "format": "uri" }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": ["ok", "error"],
        "properties": {
          "ok": { "type": "boolean", "const": false },
          "error": {
            "type": "object",
            "required": ["code", "message", "hint"],
            "properties": {
              "code": { "type": "string" },
              "message": { "type": "string" },
              "hint": { "type": "string" }
            }
          }
        }
      }
    },
    "responses": {
      "RateLimited": {
        "description": "Rate limit exceeded. Retry after the number of seconds in the Retry-After header.",
        "headers": {
          "RateLimit": { "schema": { "type": "string" } },
          "RateLimit-Policy": { "schema": { "type": "string" } },
          "Retry-After": { "schema": { "type": "integer" } }
        },
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/Error" }
          }
        }
      }
    }
  }
}
