{
  "openapi": "3.1.0",
  "info": {
    "title": "Fluid API",
    "version": "1.0.0",
    "summary": "The Fluid Assistant MCP endpoint and the public guides for pickleball clubs, tournaments and leagues.",
    "description": "Fluid runs pickleball and racquet clubs: memberships, court reservations, programs, tournaments and leagues. Agents act on Fluid through the Fluid Assistant, a Model Context Protocol (MCP) server reached over Streamable HTTP at `/assistant`. Its tools are listed by the MCP `tools/list` method, not here. A token comes from the OAuth 2.0 authorization code flow with PKCE (dynamic client registration supported) and acts as the signed-in person, within their own Fluid role. Request scope `assistant:read` for a read-only connection: it lists only tools that look things up, and any change is refused. The same endpoint is served on each club's own domain. Errors are JSON: `application/problem+json` (RFC 9457) with a stable `code` and a `resolution` hint, or RFC 6749 `error` objects from the OAuth endpoints.",
    "contact": {
      "name": "Fluid support",
      "url": "https://app.fluidpb.com/connector"
    }
  },
  "externalDocs": {
    "description": "Fluid API and MCP server documentation",
    "url": "https://app.fluidpb.com/developers"
  },
  "servers": [
    {
      "url": "https://app.fluidpb.com"
    }
  ],
  "tags": [
    {
      "name": "Assistant",
      "description": "The Fluid Assistant MCP endpoint"
    },
    {
      "name": "OAuth",
      "description": "OAuth 2.0 authorization server for the Fluid Assistant"
    },
    {
      "name": "Discovery",
      "description": "Metadata and guides"
    }
  ],
  "security": [],
  "paths": {
    "/assistant": {
      "post": {
        "tags": [
          "Assistant"
        ],
        "operationId": "callAssistant",
        "summary": "Send an MCP JSON-RPC message",
        "description": "MCP Streamable HTTP. Send one JSON-RPC 2.0 request (`tools/list`, `tools/call`, …) with `Accept: application/json, text/event-stream`. Without a valid token the endpoint answers 401 with a `WWW-Authenticate` challenge naming the protected-resource metadata.",
        "security": [
          {
            "fluidOAuth": [
              "assistant"
            ]
          },
          {
            "fluidOAuth": [
              "assistant:read"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JsonRpcRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response, as JSON or as a server-sent event stream.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or expired token. `code` is `missing_token` or `invalid_token`.",
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Bearer resource_metadata=\"…/.well-known/oauth-protected-resource\", scope=\"assistant\""
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "Request body over 256 KB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Retry after the `Retry-After` seconds.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/mcp/oauth/register": {
      "post": {
        "tags": [
          "OAuth"
        ],
        "operationId": "registerClient",
        "summary": "Register an OAuth client (RFC 7591)",
        "description": "Public clients only. `redirect_uris` must be loopback http, an allow-listed MCP client https host, or a known IDE app scheme.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "redirect_uris"
                ],
                "properties": {
                  "redirect_uris": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uri"
                    },
                    "minItems": 1
                  },
                  "client_name": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Client registered.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "client_id": {
                      "type": "string"
                    },
                    "redirect_uris": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "client_name": {
                      "type": "string"
                    },
                    "token_endpoint_auth_method": {
                      "const": "none"
                    },
                    "grant_types": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "response_types": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_client_metadata` or `invalid_redirect_uri`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            }
          }
        }
      }
    },
    "/api/mcp/oauth/authorize": {
      "get": {
        "tags": [
          "OAuth"
        ],
        "operationId": "authorize",
        "summary": "Start the authorization code flow",
        "description": "A browser page: the person signs in to Fluid and approves the client, then is redirected to `redirect_uri` with `code`, `state` and `iss`.",
        "parameters": [
          {
            "name": "response_type",
            "in": "query",
            "required": true,
            "schema": {
              "const": "code"
            }
          },
          {
            "name": "client_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "redirect_uri",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri"
            }
          },
          {
            "name": "code_challenge",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code_challenge_method",
            "in": "query",
            "schema": {
              "const": "S256",
              "default": "S256"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "description": "`assistant` (the default when omitted) or `assistant:read` for a read-only connection. An unknown scope redirects back with `error=invalid_scope`.",
            "schema": {
              "type": "string",
              "enum": [
                "assistant",
                "assistant:read"
              ],
              "default": "assistant"
            }
          },
          {
            "name": "resource",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uri"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sign-in or consent page.",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "302": {
            "description": "Redirect to the client."
          }
        }
      }
    },
    "/api/mcp/oauth/token": {
      "post": {
        "tags": [
          "OAuth"
        ],
        "operationId": "exchangeCode",
        "summary": "Exchange an authorization code for an access token",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "grant_type",
                  "code",
                  "code_verifier",
                  "client_id",
                  "redirect_uri"
                ],
                "properties": {
                  "grant_type": {
                    "const": "authorization_code"
                  },
                  "code": {
                    "type": "string"
                  },
                  "code_verifier": {
                    "type": "string"
                  },
                  "client_id": {
                    "type": "string"
                  },
                  "redirect_uri": {
                    "type": "string",
                    "format": "uri"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Access token (valid for 7 days).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "access_token",
                    "token_type",
                    "expires_in"
                  ],
                  "properties": {
                    "access_token": {
                      "type": "string"
                    },
                    "token_type": {
                      "const": "bearer"
                    },
                    "expires_in": {
                      "type": "integer"
                    },
                    "scope": {
                      "type": "string",
                      "enum": [
                        "assistant",
                        "assistant:read"
                      ],
                      "description": "The granted scope."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request`, `unsupported_grant_type` or `invalid_grant`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/oauth-protected-resource": {
      "get": {
        "tags": [
          "Discovery"
        ],
        "operationId": "getProtectedResourceMetadata",
        "summary": "Protected-resource metadata (RFC 9728)",
        "responses": {
          "200": {
            "description": "Metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/oauth-authorization-server": {
      "get": {
        "tags": [
          "Discovery"
        ],
        "operationId": "getAuthorizationServerMetadata",
        "summary": "Authorization-server metadata (RFC 8414)",
        "responses": {
          "200": {
            "description": "Metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/api-catalog": {
      "get": {
        "tags": [
          "Discovery"
        ],
        "operationId": "getApiCatalog",
        "summary": "API catalog (RFC 9727)",
        "responses": {
          "200": {
            "description": "Linkset.",
            "content": {
              "application/linkset+json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "tags": [
          "Discovery"
        ],
        "operationId": "getGuideIndex",
        "summary": "Index of the guides for AI agents and models",
        "responses": {
          "200": {
            "description": "llms.txt index.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/llms-full.txt": {
      "get": {
        "tags": [
          "Discovery"
        ],
        "operationId": "getAllGuides",
        "summary": "Every guide in one file",
        "responses": {
          "200": {
            "description": "All guides.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/docs/{guide}.md": {
      "get": {
        "tags": [
          "Discovery"
        ],
        "operationId": "getGuide",
        "summary": "One guide, as Markdown",
        "parameters": [
          {
            "name": "guide",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "A guide id from /llms.txt."
          }
        ],
        "responses": {
          "200": {
            "description": "The guide.",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "No guide with that id; the body links to /llms.txt.",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "fluidOAuth": {
        "type": "oauth2",
        "description": "Authorization code flow with PKCE (S256). Public clients; register with RFC 7591 dynamic client registration.",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://app.fluidpb.com/api/mcp/oauth/authorize",
            "tokenUrl": "https://app.fluidpb.com/api/mcp/oauth/token",
            "scopes": {
              "assistant": "Use the Fluid Assistant as the signed-in person, within what their own Fluid role and club permissions allow: look things up and make changes.",
              "assistant:read": "Read-only: look up and report on what the signed-in person's role can see. No bookings, payments, messages or other changes."
            }
          }
        }
      }
    },
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details, with a stable `code` and a `resolution` hint.",
        "required": [
          "title",
          "status",
          "code",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "code": {
            "type": "string",
            "description": "Stable machine-readable error code."
          },
          "detail": {
            "type": "string"
          },
          "resolution": {
            "type": "string",
            "description": "What the caller can do about it."
          }
        }
      },
      "OAuthError": {
        "type": "object",
        "description": "RFC 6749 error response.",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "error_description": {
            "type": "string"
          }
        }
      },
      "JsonRpcRequest": {
        "type": "object",
        "required": [
          "jsonrpc",
          "method"
        ],
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "id": {
            "type": [
              "string",
              "integer"
            ]
          },
          "method": {
            "type": "string"
          },
          "params": {
            "type": "object"
          }
        }
      }
    }
  }
}