{
    "openapi": "3.0.3",
    "info": {
        "title": "brunomenozzi platform API",
        "version": "2.4.1",
        "description": "Platform API. Authenticate with OAuth 2.0 (authorization code + PKCE) or a service token.",
        "contact": {
            "name": "Platform Team",
            "email": "platform@brunomenozzi.com"
        }
    },
    "servers": [
        {
            "url": "https://brunomenozzi.com"
        }
    ],
    "security": [
        {
            "oauth2": [
                "openid",
                "infra:read"
            ]
        }
    ],
    "components": {
        "securitySchemes": {
            "oauth2": {
                "type": "oauth2",
                "flows": {
                    "authorizationCode": {
                        "authorizationUrl": "https://brunomenozzi.com/oauth/authorize",
                        "tokenUrl": "https://brunomenozzi.com/oauth/token",
                        "scopes": {
                            "openid": "OpenID Connect",
                            "profile": "Profile",
                            "infra:read": "Read infrastructure",
                            "infra:write": "Write infrastructure"
                        }
                    }
                }
            },
            "serviceToken": {
                "type": "http",
                "scheme": "bearer"
            }
        }
    },
    "paths": {
        "/oauth/authorize": {
            "get": {
                "summary": "Authorization endpoint",
                "security": [],
                "parameters": [
                    {
                        "name": "client_id",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "redirect_uri",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "response_type",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "code"
                            ]
                        }
                    },
                    {
                        "name": "scope",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "state",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Login form"
                    },
                    "302": {
                        "description": "Redirect with code"
                    }
                }
            }
        },
        "/oauth/token": {
            "post": {
                "summary": "Token endpoint",
                "security": [],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "grant_type": {
                                        "type": "string",
                                        "enum": [
                                            "authorization_code",
                                            "refresh_token"
                                        ]
                                    },
                                    "code": {
                                        "type": "string"
                                    },
                                    "redirect_uri": {
                                        "type": "string"
                                    },
                                    "code_verifier": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Access token and id_token"
                    }
                }
            }
        },
        "/oauth/userinfo": {
            "get": {
                "summary": "UserInfo",
                "responses": {
                    "200": {
                        "description": "Claims for the token subject"
                    }
                }
            }
        },
        "/api/v2/internal/config": {
            "get": {
                "summary": "Service configuration",
                "description": "Read-only configuration snapshot. Requires infra:read.",
                "responses": {
                    "200": {
                        "description": "Configuration object"
                    },
                    "401": {
                        "description": "Missing credentials"
                    }
                }
            }
        },
        "/api/v2/nodes/{segment}/auth": {
            "get": {
                "summary": "Node session",
                "parameters": [
                    {
                        "name": "segment",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "_ref",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Session token"
                    }
                }
            }
        },
        "/api/v2/internal/{segment}/users": {
            "post": {
                "summary": "Workspace members",
                "parameters": [
                    {
                        "name": "segment",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "session_token"
                                ],
                                "properties": {
                                    "session_token": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Member list"
                    },
                    "401": {
                        "description": "Invalid session token"
                    }
                }
            }
        },
        "/api/v2/auth/verify": {
            "post": {
                "summary": "Integration diagnostics",
                "security": [],
                "description": "Attach client configuration when reporting an integration problem.",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "model": {
                                        "type": "string"
                                    },
                                    "client": {
                                        "type": "string"
                                    },
                                    "task": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Ticket created"
                    }
                }
            }
        },
        "/api/v2/mcp/stream": {
            "post": {
                "summary": "MCP streamable HTTP transport",
                "responses": {
                    "200": {
                        "description": "MCP stream"
                    }
                }
            }
        }
    }
}