{
  "openapi": "3.1.0",
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "info": {
    "title": "ALPA Public API",
    "summary": "Machine-readable public metadata and developer-resource discovery for ALPA.",
    "description": "The ALPA Public API exposes unauthenticated metadata about alpa.llc and links agents to its machine-readable resources. It does not expose client portal content, project data, or product APIs. Requests to unknown /api paths return a structured JSON 404 using the ApiError schema.",
    "version": "1.0.0",
    "contact": {
      "name": "ALPA",
      "url": "https://alpa.llc/developers/",
      "email": "hi@alpacalabs.co"
    },
    "license": {
      "name": "All rights reserved",
      "identifier": "LicenseRef-Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://alpa.llc"
    }
  ],
  "externalDocs": {
    "description": "ALPA Developer Resources",
    "url": "https://alpa.llc/developers/"
  },
  "security": [],
  "tags": [
    {
      "name": "Discovery",
      "description": "Public, unauthenticated ALPA site and developer-resource metadata."
    }
  ],
  "paths": {
    "/api": {
      "get": {
        "tags": ["Discovery"],
        "summary": "List ALPA API resources",
        "description": "Returns the API version, documentation links, and public endpoint index.",
        "operationId": "getApiIndex",
        "responses": {
          "200": {
            "description": "ALPA API index",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiIndex"
                }
              }
            }
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      },
      "head": {
        "tags": ["Discovery"],
        "summary": "Inspect ALPA API index headers",
        "operationId": "headApiIndex",
        "responses": {
          "200": {
            "description": "The same headers as GET /api, with no response body."
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/api/site": {
      "get": {
        "tags": ["Discovery"],
        "summary": "Get ALPA site metadata",
        "description": "Returns ALPA identity, site description, and canonical machine-readable resource URLs.",
        "operationId": "getSiteMetadata",
        "responses": {
          "200": {
            "description": "ALPA site metadata",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteMetadata"
                }
              }
            }
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      },
      "head": {
        "tags": ["Discovery"],
        "summary": "Inspect ALPA site metadata headers",
        "operationId": "headSiteMetadata",
        "responses": {
          "200": {
            "description": "The same headers as GET /api/site, with no response body."
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Endpoint": {
        "type": "object",
        "additionalProperties": false,
        "required": ["method", "path", "description"],
        "properties": {
          "method": {
            "type": "string",
            "enum": ["GET"]
          },
          "path": {
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        }
      },
      "ApiIndex": {
        "type": "object",
        "additionalProperties": false,
        "required": ["name", "version", "documentation_url", "openapi_url", "endpoints"],
        "properties": {
          "name": {
            "type": "string",
            "const": "ALPA Public API"
          },
          "version": {
            "type": "string",
            "const": "1.0.0"
          },
          "documentation_url": {
            "type": "string",
            "format": "uri",
            "const": "https://alpa.llc/developers/"
          },
          "openapi_url": {
            "type": "string",
            "format": "uri",
            "const": "https://alpa.llc/openapi.json"
          },
          "endpoints": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Endpoint"
            }
          }
        }
      },
      "DeveloperResources": {
        "type": "object",
        "additionalProperties": false,
        "required": ["documentation", "openapi", "llms", "llms_full", "sitemap"],
        "properties": {
          "documentation": {
            "type": "string",
            "format": "uri"
          },
          "openapi": {
            "type": "string",
            "format": "uri"
          },
          "llms": {
            "type": "string",
            "format": "uri"
          },
          "llms_full": {
            "type": "string",
            "format": "uri"
          },
          "sitemap": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "SiteMetadata": {
        "type": "object",
        "additionalProperties": false,
        "required": ["name", "legal_name", "url", "description", "developer_resources"],
        "properties": {
          "name": {
            "type": "string",
            "const": "ALPA"
          },
          "legal_name": {
            "type": "string",
            "const": "Alpaca Labs LLC"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "const": "https://alpa.llc"
          },
          "description": {
            "type": "string"
          },
          "developer_resources": {
            "$ref": "#/components/schemas/DeveloperResources"
          }
        }
      },
      "ApiError": {
        "type": "object",
        "additionalProperties": false,
        "required": ["error"],
        "examples": [
          {
            "error": {
              "code": "not_found",
              "message": "No ALPA API endpoint exists at /api/example.",
              "resolution": "Use GET /api or inspect https://alpa.llc/openapi.json for supported endpoints.",
              "documentation_url": "https://alpa.llc/developers/"
            }
          }
        ],
        "properties": {
          "error": {
            "type": "object",
            "additionalProperties": false,
            "required": ["code", "message", "resolution"],
            "properties": {
              "code": {
                "type": "string",
                "description": "Stable, machine-readable error identifier."
              },
              "message": {
                "type": "string",
                "description": "Human-readable explanation of the error."
              },
              "resolution": {
                "type": "string",
                "description": "A concrete next step an agent can take."
              },
              "documentation_url": {
                "type": "string",
                "format": "uri",
                "const": "https://alpa.llc/developers/"
              }
            }
          }
        }
      }
    },
    "responses": {
      "MethodNotAllowed": {
        "description": "The endpoint exists, but does not support this HTTP method.",
        "headers": {
          "Allow": {
            "description": "Methods accepted by this endpoint.",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            },
            "example": {
              "error": {
                "code": "method_not_allowed",
                "message": "POST is not supported for /api/site.",
                "resolution": "Retry this endpoint with GET or HEAD.",
                "documentation_url": "https://alpa.llc/developers/"
              }
            }
          }
        }
      },
      "InternalServerError": {
        "description": "The API could not complete the request.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            },
            "example": {
              "error": {
                "code": "internal_error",
                "message": "The ALPA API could not complete the request.",
                "resolution": "Retry later. If the error persists, contact hi@alpacalabs.co.",
                "documentation_url": "https://alpa.llc/developers/"
              }
            }
          }
        }
      }
    }
  }
}
