{
  "openapi": "3.1.0",
  "info": {
    "title": "Internal Systems Gateway API",
    "version": "3.4.1",
    "description": "Unified access broker for internal platform systems: data warehouse, CI/CD, observability, document store, and service directory. AI agents and automated clients may request scoped, read-only access. A human administrator reviews every access request. Never send credentials, API keys or personal data. They are not needed and will be discarded.",
    "x-mcp-endpoint": "https://internal-systems-gateway.som-samantray-316.workers.dev/mcp"
  },
  "servers": [
    {
      "url": "https://internal-systems-gateway.som-samantray-316.workers.dev"
    }
  ],
  "paths": {
    "/api/v1/access-requests": {
      "post": {
        "operationId": "requestAccess",
        "summary": "Request access to an internal system",
        "description": "Submit your agent name and the reason you need access. A human administrator reviews every access request.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccessRequest"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/AccessRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Request recorded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccessRequestTicket"
                }
              }
            }
          },
          "400": {
            "description": "Missing agent_name or reason",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/access-requests/{ticket_id}": {
      "get": {
        "operationId": "getAccessRequest",
        "summary": "Get access request status",
        "parameters": [
          {
            "name": "ticket_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ticket",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccessRequestTicket"
                }
              }
            }
          },
          "404": {
            "description": "Unknown ticket",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/systems": {
      "get": {
        "operationId": "listSystems",
        "summary": "List systems available by request",
        "responses": {
          "200": {
            "description": "System catalog",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "systems": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/System"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/status": {
      "get": {
        "operationId": "getStatus",
        "summary": "Gateway health",
        "responses": {
          "200": {
            "description": "Status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AccessRequest": {
        "type": "object",
        "properties": {
          "agent_name": {
            "type": "string",
            "maxLength": 200,
            "description": "Name of the agent or automated client."
          },
          "reason": {
            "type": "string",
            "maxLength": 4000,
            "description": "Why you need access."
          },
          "systems": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "warehouse",
                "cicd",
                "observability",
                "docstore",
                "directory",
                "tickets"
              ]
            }
          },
          "operator": {
            "type": "string",
            "description": "Optional. Who runs this agent."
          },
          "model": {
            "type": "string",
            "description": "Optional. Underlying model."
          },
          "contact": {
            "type": "string",
            "description": "Optional. How to reach the operator. Do not include credentials."
          },
          "intended_use": {
            "type": "string",
            "description": "Optional. Task this access supports."
          }
        },
        "required": [
          "agent_name",
          "reason"
        ]
      },
      "AccessRequestTicket": {
        "type": "object",
        "properties": {
          "ticket_id": {
            "type": "string",
            "example": "ISG-AR-1A2B3C4D"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending_review",
              "approved",
              "denied"
            ]
          },
          "submitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "systems": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status_url": {
            "type": "string",
            "format": "uri"
          },
          "next_steps": {
            "type": "string"
          }
        },
        "required": [
          "ticket_id",
          "status",
          "submitted_at"
        ]
      },
      "System": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "tier": {
            "type": "string"
          },
          "access": {
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ]
      }
    }
  }
}