{
  "openapi": "3.1.1",
  "info": {
    "title": "Sportwey External Read API",
    "version": "1.0.0",
    "description": "Read-only tournament information, scoped by expiring API keys and current organizer permissions. All data operations require HTTPS Bearer authentication and consume shared daily reservation units. Production availability is operator-controlled; documentation publication does not enable it."
  },
  "servers": [
    {
      "url": "https://api.sportwey.com/external/v1",
      "description": "Production target; availability requires separate operator enablement. Do not assume enabled."
    }
  ],
  "security": [
    {
      "ApiKeyBearer": []
    }
  ],
  "paths": {
    "/access": {
      "get": {
        "operationId": "getApiKeyAccess",
        "summary": "Verificar acceso",
        "description": "Validate the configured key. This call consumes one admitted request. Does not return tournament grants.",
        "tags": [
          "Read-only tournaments"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful bounded read. Each admitted HTTP request consumes one shared daily unit, including later failures.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccessResponse"
                },
                "example": {
                  "data": {
                    "key_id": "000000000000000000000001",
                    "scopes": [
                      "tournaments:read"
                    ],
                    "expires_at": 1900000000
                  },
                  "request_id": "example-request-id"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query, cursor, date range or HTTPS validation. Correct inputs; do not retry unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked API key. Stop and ask owner to check credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or hidden standings. Do not bypass permissions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or tournament not authorized. Do not enumerate other IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Only GET data operations are supported. Do not use POST, PUT, PATCH or DELETE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Standings or individual statistics changed during pagination. Restart with no after once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported competition kind.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate, concurrency or daily account quota exceeded. Honor Retry-After in seconds; never rotate keys to evade quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "503": {
            "description": "API disabled, dependencies unavailable or standings snapshot not ready. Do not invent results. Retry only within a bounded budget; honor Retry-After when present.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          }
        },
        "x-read-only": true,
        "x-consumption-units": 1,
        "x-display-description": "Consulta el identificador, los permisos y el vencimiento de la clave. No devuelve el secreto ni la lista de torneos. No acepta parámetros."
      }
    },
    "/capabilities": {
      "get": {
        "operationId": "getApiCapabilities",
        "summary": "Capacidades",
        "description": "Discover supported resources. MCP availability is false; do not assume an MCP transport exists.",
        "tags": [
          "Read-only tournaments"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful bounded read. Each admitted HTTP request consumes one shared daily unit, including later failures.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapabilitiesResponse"
                },
                "example": {
                  "data": {
                    "version": "v1",
                    "read_only": true,
                    "resources": [
                      "tournaments",
                      "calendar",
                      "results",
                      "standings",
                      "player_statistics",
                      "teams",
                      "team_players",
                      "team_results",
                      "match"
                    ],
                    "authentication": "bearer_api_key",
                    "mcp": {
                      "available": false,
                      "adapter_ready": true
                    }
                  },
                  "request_id": "example-request-id"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query, cursor, date range or HTTPS validation. Correct inputs; do not retry unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked API key. Stop and ask owner to check credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or hidden standings. Do not bypass permissions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or tournament not authorized. Do not enumerate other IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Only GET data operations are supported. Do not use POST, PUT, PATCH or DELETE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Standings or individual statistics changed during pagination. Restart with no after once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported competition kind.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate, concurrency or daily account quota exceeded. Honor Retry-After in seconds; never rotate keys to evade quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "503": {
            "description": "API disabled, dependencies unavailable or standings snapshot not ready. Do not invent results. Retry only within a bounded budget; honor Retry-After when present.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          }
        },
        "x-read-only": true,
        "x-consumption-units": 1,
        "x-display-description": "Describe los recursos disponibles y confirma que la API es de solo consulta. No acepta parámetros."
      }
    },
    "/tournaments": {
      "get": {
        "operationId": "listAuthorizedTournaments",
        "summary": "Torneos autorizados",
        "description": "List authorized active tournaments. Use returned IDs for subsequent queries; do not infer IDs. Empty items may mean no current grants. Ascending id order.",
        "tags": [
          "Read-only tournaments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/AfterTournament"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful bounded read. Each admitted HTTP request consumes one shared daily unit, including later failures.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TournamentsResponse"
                },
                "example": {
                  "data": {
                    "items": [
                      {
                        "id": "torneo_demo",
                        "name": "Liga de ejemplo",
                        "season": "2026"
                      }
                    ],
                    "next_cursor": null
                  },
                  "request_id": "example-request-id"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query, cursor, date range or HTTPS validation. Correct inputs; do not retry unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked API key. Stop and ask owner to check credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or hidden standings. Do not bypass permissions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or tournament not authorized. Do not enumerate other IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Only GET data operations are supported. Do not use POST, PUT, PATCH or DELETE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Standings or individual statistics changed during pagination. Restart with no after once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported competition kind.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate, concurrency or daily account quota exceeded. Honor Retry-After in seconds; never rotate keys to evade quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "503": {
            "description": "API disabled, dependencies unavailable or standings snapshot not ready. Do not invent results. Retry only within a bounded budget; honor Retry-After when present.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          }
        },
        "x-read-only": true,
        "x-consumption-units": 1,
        "x-display-description": "Devuelve únicamente los torneos autorizados que el propietario todavía administra."
      }
    },
    "/tournaments/{tournament_id}/calendar": {
      "get": {
        "operationId": "listTournamentCalendar",
        "summary": "Calendario",
        "description": "Read published waiting matches only. Dates required, maximum93 inclusive days. Stored local times have no timezone offset. Ascending date/id; no writes.",
        "tags": [
          "Read-only tournaments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Tournament"
          },
          {
            "$ref": "#/components/parameters/From"
          },
          {
            "$ref": "#/components/parameters/To"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/After"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful bounded read. Each admitted HTTP request consumes one shared daily unit, including later failures.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MatchesResponse"
                },
                "example": {
                  "data": {
                    "tournament": "torneo_demo",
                    "kind_competitor": "team",
                    "time_basis": "stored_local",
                    "items": [
                      {
                        "id": "partido_demo",
                        "scheduled_at_local": "2026-10-21T18:00:00",
                        "status": "waiting",
                        "type": "calendar",
                        "round": 1,
                        "title": "Jornada 1",
                        "group": null,
                        "field": "Cancha de ejemplo",
                        "local": {
                          "id": "equipo_local",
                          "name": "Equipo local"
                        },
                        "visitor": {
                          "id": "equipo_visitante",
                          "name": "Equipo visitante"
                        },
                        "score": null
                      }
                    ],
                    "next_cursor": null
                  },
                  "request_id": "example-request-id"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query, cursor, date range or HTTPS validation. Correct inputs; do not retry unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked API key. Stop and ask owner to check credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or hidden standings. Do not bypass permissions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or tournament not authorized. Do not enumerate other IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Only GET data operations are supported. Do not use POST, PUT, PATCH or DELETE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Standings or individual statistics changed during pagination. Restart with no after once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported competition kind.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate, concurrency or daily account quota exceeded. Honor Retry-After in seconds; never rotate keys to evade quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "503": {
            "description": "API disabled, dependencies unavailable or standings snapshot not ready. Do not invent results. Retry only within a bounded budget; honor Retry-After when present.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          }
        },
        "x-read-only": true,
        "x-consumption-units": 1,
        "x-display-description": "Partidos pendientes publicados, dentro del rango solicitado."
      }
    },
    "/tournaments/{tournament_id}/results": {
      "get": {
        "operationId": "listTournamentResults",
        "summary": "Resultados",
        "description": "Read completed matches only. Dates required, maximum93 inclusive days. Descending date/id. score=null means unavailable, never invent a zero.",
        "tags": [
          "Read-only tournaments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Tournament"
          },
          {
            "$ref": "#/components/parameters/From"
          },
          {
            "$ref": "#/components/parameters/To"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/After"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful bounded read. Each admitted HTTP request consumes one shared daily unit, including later failures.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MatchesResponse"
                },
                "example": {
                  "data": {
                    "tournament": "torneo_demo",
                    "kind_competitor": "team",
                    "time_basis": "stored_local",
                    "items": [
                      {
                        "id": "partido_demo",
                        "scheduled_at_local": "2026-10-21T18:00:00",
                        "status": "complete",
                        "type": "calendar",
                        "round": 1,
                        "title": "Jornada 1",
                        "group": null,
                        "field": "Cancha de ejemplo",
                        "local": {
                          "id": "equipo_local",
                          "name": "Equipo local"
                        },
                        "visitor": {
                          "id": "equipo_visitante",
                          "name": "Equipo visitante"
                        },
                        "score": {
                          "local": 2,
                          "visitor": 1
                        }
                      }
                    ],
                    "next_cursor": null
                  },
                  "request_id": "example-request-id"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query, cursor, date range or HTTPS validation. Correct inputs; do not retry unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked API key. Stop and ask owner to check credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or hidden standings. Do not bypass permissions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or tournament not authorized. Do not enumerate other IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Only GET data operations are supported. Do not use POST, PUT, PATCH or DELETE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Standings or individual statistics changed during pagination. Restart with no after once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported competition kind.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate, concurrency or daily account quota exceeded. Honor Retry-After in seconds; never rotate keys to evade quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "503": {
            "description": "API disabled, dependencies unavailable or standings snapshot not ready. Do not invent results. Retry only within a bounded budget; honor Retry-After when present.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          }
        },
        "x-read-only": true,
        "x-consumption-units": 1,
        "x-display-description": "Partidos finalizados dentro del rango solicitado. Un marcador no disponible es null, no cero."
      }
    },
    "/tournaments/{tournament_id}/standings": {
      "get": {
        "operationId": "listTournamentStandings",
        "summary": "Tabla de posiciones",
        "description": "Read the canonical published snapshot. generated_at is null; no freshness guarantee. If409standings_changed, restart pagination once with bounded pages. Canonical refresh runs after supported score saves on the internal writer; this endpoint never recalculates or writes. Replica lag and refresh failures may delay availability.",
        "tags": [
          "Read-only tournaments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Tournament"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/After"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful bounded read. Each admitted HTTP request consumes one shared daily unit, including later failures.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StandingsResponse"
                },
                "example": {
                  "data": {
                    "tournament": "torneo_demo",
                    "kind_competitor": "team",
                    "source": "position_web_snapshot",
                    "snapshot_id": "0000000000000000000000000000000000000000000000000000000000000000",
                    "generated_at": null,
                    "items": [
                      {
                        "group": {
                          "index": 0,
                          "name": "Grupo A"
                        },
                        "position": 1,
                        "competitor": {
                          "id": "equipo_local",
                          "name": "Equipo local"
                        },
                        "statistics": [
                          {
                            "id": "points",
                            "label": "Puntos",
                            "value": 3
                          }
                        ]
                      }
                    ],
                    "next_cursor": null
                  },
                  "request_id": "example-request-id"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query, cursor, date range or HTTPS validation. Correct inputs; do not retry unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked API key. Stop and ask owner to check credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or hidden standings. Do not bypass permissions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or tournament not authorized. Do not enumerate other IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Only GET data operations are supported. Do not use POST, PUT, PATCH or DELETE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Standings or individual statistics changed during pagination. Restart with no after once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported competition kind.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate, concurrency or daily account quota exceeded. Honor Retry-After in seconds; never rotate keys to evade quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "503": {
            "description": "API disabled, dependencies unavailable or standings snapshot not ready. Do not invent results. Retry only within a bounded budget; honor Retry-After when present.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          }
        },
        "x-read-only": true,
        "x-consumption-units": 1,
        "x-display-description": "Consulta la tabla publicada. Puede no estar disponible o cambiar mientras se pagina."
      }
    },
    "/tournaments/{tournament_id}/teams": {
      "get": {
        "operationId": "listTournamentTeams",
        "summary": "Equipos del torneo",
        "description": "List confirmed active teams for a team competition. Ascending public ID, limit1..100. Individual competitions return422.",
        "tags": [
          "Read-only tournaments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Tournament"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/After"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful bounded read. Each admitted HTTP request consumes one shared daily unit, including later failures.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamsResponse"
                },
                "example": {
                  "data": {
                    "tournament": "torneo_demo",
                    "items": [
                      {
                        "id": "equipo_local",
                        "name": "Equipo local"
                      }
                    ],
                    "next_cursor": null
                  },
                  "request_id": "example-request-id"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query, cursor, date range or HTTPS validation. Correct inputs; do not retry unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked API key. Stop and ask owner to check credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or hidden standings. Do not bypass permissions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or tournament not authorized. Do not enumerate other IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Only GET data operations are supported. Do not use POST, PUT, PATCH or DELETE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Standings or individual statistics changed during pagination. Restart with no after once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported competition kind.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate, concurrency or daily account quota exceeded. Honor Retry-After in seconds; never rotate keys to evade quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "503": {
            "description": "API disabled, dependencies unavailable or standings snapshot not ready. Do not invent results. Retry only within a bounded budget; honor Retry-After when present.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          }
        },
        "x-read-only": true,
        "x-consumption-units": 1,
        "x-display-description": "Equipos activos con inscripción confirmada. Solo identificador público y nombre; sin contactos ni plantilla de jugadores."
      }
    },
    "/tournaments/{tournament_id}/teams/{team_id}/results": {
      "get": {
        "operationId": "listTeamResults",
        "summary": "Resultados por equipo",
        "description": "Read completed team matches in the exact authorized tournament, descending date/id. Team must still be active and confirmed. Dates span at most93 inclusive days; cursor is bound to team/tournament/dates.",
        "tags": [
          "Read-only tournaments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Tournament"
          },
          {
            "$ref": "#/components/parameters/Team"
          },
          {
            "$ref": "#/components/parameters/From"
          },
          {
            "$ref": "#/components/parameters/To"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/After"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful bounded read. Each admitted HTTP request consumes one shared daily unit, including later failures.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MatchesResponse"
                },
                "example": {
                  "data": {
                    "tournament": "torneo_demo",
                    "kind_competitor": "team",
                    "time_basis": "stored_local",
                    "items": [
                      {
                        "id": "partido_demo",
                        "scheduled_at_local": "2026-10-21T18:00:00",
                        "status": "complete",
                        "type": "calendar",
                        "round": 1,
                        "title": "Jornada 1",
                        "group": null,
                        "field": "Cancha de ejemplo",
                        "local": {
                          "id": "equipo_local",
                          "name": "Equipo local"
                        },
                        "visitor": {
                          "id": "equipo_visitante",
                          "name": "Equipo visitante"
                        },
                        "score": {
                          "local": 2,
                          "visitor": 1
                        }
                      }
                    ],
                    "next_cursor": null
                  },
                  "request_id": "example-request-id"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query, cursor, date range or HTTPS validation. Correct inputs; do not retry unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked API key. Stop and ask owner to check credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or hidden standings. Do not bypass permissions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or tournament not authorized. Do not enumerate other IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Only GET data operations are supported. Do not use POST, PUT, PATCH or DELETE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Standings or individual statistics changed during pagination. Restart with no after once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported competition kind.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate, concurrency or daily account quota exceeded. Honor Retry-After in seconds; never rotate keys to evade quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "503": {
            "description": "API disabled, dependencies unavailable or standings snapshot not ready. Do not invent results. Retry only within a bounded budget; honor Retry-After when present.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          }
        },
        "x-read-only": true,
        "x-consumption-units": 1,
        "x-display-description": "Partidos finalizados de ese equipo en este torneo, como local o visitante. Requiere from/to."
      }
    },
    "/tournaments/{tournament_id}/matches/{match_id}": {
      "get": {
        "operationId": "getTournamentMatch",
        "summary": "Detalle del partido",
        "description": "One exact match from the authorized tournament. Complete matches include available score; published waiting matches always have score=null even when draft score exists. Other states and unpublished matches return404. Stored-local times, no date filters or pagination. Does not return events/lineups/private records.",
        "tags": [
          "Read-only tournaments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Tournament"
          },
          {
            "$ref": "#/components/parameters/Match"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful bounded read. Each admitted HTTP request consumes one shared daily unit, including later failures.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MatchDetailResponse"
                },
                "example": {
                  "data": {
                    "tournament": "torneo_demo",
                    "kind_competitor": "team",
                    "time_basis": "stored_local",
                    "match": {
                      "id": "partido_demo",
                      "scheduled_at_local": "2026-10-21T18:00:00",
                      "status": "complete",
                      "type": "calendar",
                      "round": 1,
                      "title": "Jornada 1",
                      "group": null,
                      "field": "Cancha de ejemplo",
                      "local": {
                        "id": "equipo_local",
                        "name": "Equipo local"
                      },
                      "visitor": {
                        "id": "equipo_visitante",
                        "name": "Equipo visitante"
                      },
                      "score": {
                        "local": 2,
                        "visitor": 1
                      }
                    }
                  },
                  "request_id": "example-request-id"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query, cursor, date range or HTTPS validation. Correct inputs; do not retry unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked API key. Stop and ask owner to check credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or hidden standings. Do not bypass permissions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or tournament not authorized. Do not enumerate other IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Only GET data operations are supported. Do not use POST, PUT, PATCH or DELETE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Standings or individual statistics changed during pagination. Restart with no after once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported competition kind.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate, concurrency or daily account quota exceeded. Honor Retry-After in seconds; never rotate keys to evade quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "503": {
            "description": "API disabled, dependencies unavailable or standings snapshot not ready. Do not invent results. Retry only within a bounded budget; honor Retry-After when present.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          }
        },
        "x-read-only": true,
        "x-consumption-units": 1,
        "x-display-description": "Detalle de un partido terminado o pendiente publicado. En pendientes, score es null. No incluye jugadores ni datos de contacto."
      }
    },
    "/tournaments/{tournament_id}/teams/{team_id}/players": {
      "get": {
        "operationId": "listTeamPlayers",
        "summary": "Jugadores del equipo",
        "description": "Active roster in the exact confirmed team and authorized tournament. Each item contains only name, last_name and image (null when unavailable). No player IDs, contacts, birthdays or membership data. Cursor is bound to team and tournament; no date filters.",
        "tags": [
          "Read-only tournaments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Tournament"
          },
          {
            "$ref": "#/components/parameters/Team"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/After"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful bounded read. Each admitted HTTP request consumes one shared daily unit, including later failures.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TeamPlayersResponse"
                },
                "example": {
                  "data": {
                    "tournament": "torneo_demo",
                    "team": "equipo_local",
                    "items": [
                      {
                        "name": "Alex",
                        "last_name": "Ejemplo",
                        "image": null
                      }
                    ],
                    "next_cursor": null
                  },
                  "request_id": "example-request-id"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query, cursor, date range or HTTPS validation. Correct inputs; do not retry unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked API key. Stop and ask owner to check credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or hidden standings. Do not bypass permissions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or tournament not authorized. Do not enumerate other IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Only GET data operations are supported. Do not use POST, PUT, PATCH or DELETE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Standings or individual statistics changed during pagination. Restart with no after once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported competition kind.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate, concurrency or daily account quota exceeded. Honor Retry-After in seconds; never rotate keys to evade quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "503": {
            "description": "API disabled, dependencies unavailable or standings snapshot not ready. Do not invent results. Retry only within a bounded budget; honor Retry-After when present.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          }
        },
        "x-read-only": true,
        "x-consumption-units": 1,
        "x-display-description": "Jugadores activos del equipo autorizado. Solo fotografía, nombre y apellido."
      }
    },
    "/tournaments/{tournament_id}/players/statistics": {
      "get": {
        "operationId": "listPlayerStatistics",
        "summary": "Estadísticas individuales",
        "description": "Canonical Sportwey numeric statistics, not an approximate sum. sort=name|last_name|metrics.id; order=asc|desc. Null values last. Cursor binds sort/order/snapshot.409 player_statistics_changed requires restart;503 player_statistics_not_ready is not an empty result. No from/to.",
        "tags": [
          "Read-only tournaments"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Tournament"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/After"
          },
          {
            "$ref": "#/components/parameters/Sort"
          },
          {
            "$ref": "#/components/parameters/Order"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful bounded read. Each admitted HTTP request consumes one shared daily unit, including later failures.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlayerStatisticsResponse"
                },
                "example": {
                  "data": {
                    "tournament": "torneo_demo",
                    "source": "score_player_web_snapshot",
                    "snapshot_id": "0000000000000000000000000000000000000000000000000000000000000000",
                    "generated_at": null,
                    "metrics": [
                      {
                        "id": "goles_demo",
                        "label": "Goles"
                      }
                    ],
                    "sort": "goles_demo",
                    "order": "desc",
                    "total": 1,
                    "items": [
                      {
                        "player": {
                          "name": "Alex",
                          "last_name": "Ejemplo",
                          "image": null
                        },
                        "team": "Equipo local",
                        "statistics": [
                          {
                            "id": "goles_demo",
                            "label": "Goles",
                            "value": 2
                          }
                        ]
                      }
                    ],
                    "next_cursor": null
                  },
                  "request_id": "example-request-id"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query, cursor, date range or HTTPS validation. Correct inputs; do not retry unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked API key. Stop and ask owner to check credentials.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient scope or hidden standings. Do not bypass permissions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Resource not found or tournament not authorized. Do not enumerate other IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Only GET data operations are supported. Do not use POST, PUT, PATCH or DELETE.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Standings or individual statistics changed during pagination. Restart with no after once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported competition kind.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate, concurrency or daily account quota exceeded. Honor Retry-After in seconds; never rotate keys to evade quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "503": {
            "description": "API disabled, dependencies unavailable or standings snapshot not ready. Do not invent results. Retry only within a bounded budget; honor Retry-After when present.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before a bounded retry.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          }
        },
        "x-read-only": true,
        "x-consumption-units": 1,
        "x-display-description": "Estadísticas individuales con paginación y orden por nombre, apellido o métrica publicada."
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyBearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Sportwey API key",
        "description": "Full sw_ext_... key from API keys. Authorization header only; never query parameters, cookies or session tokens."
      }
    },
    "schemas": {
      "Participant": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "additionalProperties": false
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              }
            },
            "required": [
              "code"
            ],
            "additionalProperties": false
          },
          "request_id": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      },
      "Access": {
        "type": "object",
        "properties": {
          "key_id": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "tournaments:read"
              ]
            }
          },
          "expires_at": {
            "type": "integer",
            "description": "Unix timestamp in seconds."
          }
        },
        "required": [
          "key_id",
          "scopes",
          "expires_at"
        ],
        "additionalProperties": false
      },
      "Capabilities": {
        "type": "object",
        "properties": {
          "version": {
            "const": "v1"
          },
          "read_only": {
            "const": true
          },
          "resources": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "authentication": {
            "const": "bearer_api_key"
          },
          "mcp": {
            "type": "object",
            "properties": {
              "available": {
                "const": false
              },
              "adapter_ready": {
                "const": true
              }
            },
            "required": [
              "available",
              "adapter_ready"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "version",
          "read_only",
          "resources",
          "authentication",
          "mcp"
        ],
        "additionalProperties": false
      },
      "Tournament": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "season": {
            "type": [
              "string",
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "season"
        ],
        "additionalProperties": false
      },
      "Tournaments": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Tournament"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "next_cursor"
        ],
        "additionalProperties": false
      },
      "Match": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "scheduled_at_local": {
            "type": [
              "string",
              "null"
            ],
            "description": "Stored local wall-clock time; no timezone/UTC offset is supplied. Do not assume UTC.",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "waiting",
              "complete"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "calendar",
              "friendly",
              "playoff"
            ]
          },
          "round": {
            "type": [
              "string",
              "integer",
              "null"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "group": {
            "type": [
              "string",
              "null"
            ]
          },
          "field": {
            "type": [
              "string",
              "null"
            ]
          },
          "local": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Participant"
              },
              {
                "type": "null"
              }
            ]
          },
          "visitor": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Participant"
              },
              {
                "type": "null"
              }
            ]
          },
          "score": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "local": {
                    "type": "number"
                  },
                  "visitor": {
                    "type": "number"
                  }
                },
                "required": [
                  "local",
                  "visitor"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "scheduled_at_local",
          "status",
          "type",
          "round",
          "title",
          "group",
          "field",
          "local",
          "visitor",
          "score"
        ],
        "additionalProperties": false
      },
      "Matches": {
        "type": "object",
        "properties": {
          "tournament": {
            "type": "string"
          },
          "kind_competitor": {
            "type": "string",
            "enum": [
              "team",
              "player"
            ]
          },
          "time_basis": {
            "const": "stored_local"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Match"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "tournament",
          "kind_competitor",
          "time_basis",
          "items",
          "next_cursor"
        ],
        "additionalProperties": false
      },
      "Standing": {
        "type": "object",
        "properties": {
          "group": {
            "type": "object",
            "properties": {
              "index": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "index",
              "name"
            ],
            "additionalProperties": false
          },
          "position": {
            "type": "integer",
            "minimum": 1
          },
          "competitor": {
            "$ref": "#/components/schemas/Participant"
          },
          "statistics": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "value": {
                  "type": [
                    "number",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "label",
                "value"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "group",
          "position",
          "competitor",
          "statistics"
        ],
        "additionalProperties": false
      },
      "Standings": {
        "type": "object",
        "properties": {
          "tournament": {
            "type": "string"
          },
          "kind_competitor": {
            "type": "string",
            "enum": [
              "team",
              "player"
            ]
          },
          "source": {
            "const": "position_web_snapshot"
          },
          "snapshot_id": {
            "type": "string"
          },
          "generated_at": {
            "type": "null",
            "description": "Freshness timestamp unavailable; never infer live data."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Standing"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "tournament",
          "kind_competitor",
          "source",
          "snapshot_id",
          "generated_at",
          "items",
          "next_cursor"
        ],
        "additionalProperties": false
      },
      "TeamPlayer": {
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "image": {
            "type": [
              "string",
              "null"
            ],
            "description": "Public photo URL; null when no safe photo is available."
          }
        },
        "required": [
          "name",
          "last_name",
          "image"
        ],
        "additionalProperties": false
      },
      "TeamPlayers": {
        "type": "object",
        "properties": {
          "tournament": {
            "type": "string"
          },
          "team": {
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TeamPlayer"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "tournament",
          "team",
          "items",
          "next_cursor"
        ],
        "additionalProperties": false
      },
      "Teams": {
        "type": "object",
        "properties": {
          "tournament": {
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Participant"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "tournament",
          "items",
          "next_cursor"
        ],
        "additionalProperties": false
      },
      "MatchDetail": {
        "type": "object",
        "properties": {
          "tournament": {
            "type": "string"
          },
          "kind_competitor": {
            "type": "string",
            "enum": [
              "team",
              "player"
            ]
          },
          "time_basis": {
            "const": "stored_local"
          },
          "match": {
            "$ref": "#/components/schemas/Match"
          }
        },
        "required": [
          "tournament",
          "kind_competitor",
          "time_basis",
          "match"
        ],
        "additionalProperties": false
      },
      "PlayerStatistics": {
        "type": "object",
        "properties": {
          "tournament": {
            "type": "string"
          },
          "source": {
            "const": "score_player_web_snapshot"
          },
          "snapshot_id": {
            "type": "string"
          },
          "generated_at": {
            "type": "null"
          },
          "metrics": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "label"
              ],
              "additionalProperties": false
            }
          },
          "sort": {
            "type": "string"
          },
          "order": {
            "type": "string",
            "enum": [
              "asc",
              "desc"
            ]
          },
          "total": {
            "type": "integer"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "player": {
                  "$ref": "#/components/schemas/TeamPlayer"
                },
                "team": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "statistics": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      },
                      "value": {
                        "type": [
                          "number",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "label",
                      "value"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "player",
                "team",
                "statistics"
              ],
              "additionalProperties": false
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "tournament",
          "source",
          "snapshot_id",
          "generated_at",
          "metrics",
          "sort",
          "order",
          "total",
          "items",
          "next_cursor"
        ],
        "additionalProperties": false
      },
      "AccessResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Access"
          },
          "request_id": {
            "type": "string"
          }
        },
        "required": [
          "data",
          "request_id"
        ],
        "additionalProperties": false
      },
      "CapabilitiesResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Capabilities"
          },
          "request_id": {
            "type": "string"
          }
        },
        "required": [
          "data",
          "request_id"
        ],
        "additionalProperties": false
      },
      "TournamentsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Tournaments"
          },
          "request_id": {
            "type": "string"
          }
        },
        "required": [
          "data",
          "request_id"
        ],
        "additionalProperties": false
      },
      "MatchesResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Matches"
          },
          "request_id": {
            "type": "string"
          }
        },
        "required": [
          "data",
          "request_id"
        ],
        "additionalProperties": false
      },
      "StandingsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Standings"
          },
          "request_id": {
            "type": "string"
          }
        },
        "required": [
          "data",
          "request_id"
        ],
        "additionalProperties": false
      },
      "TeamsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Teams"
          },
          "request_id": {
            "type": "string"
          }
        },
        "required": [
          "data",
          "request_id"
        ],
        "additionalProperties": false
      },
      "MatchDetailResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/MatchDetail"
          },
          "request_id": {
            "type": "string"
          }
        },
        "required": [
          "data",
          "request_id"
        ],
        "additionalProperties": false
      },
      "TeamPlayersResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/TeamPlayers"
          },
          "request_id": {
            "type": "string"
          }
        },
        "required": [
          "data",
          "request_id"
        ],
        "additionalProperties": false
      },
      "PlayerStatisticsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/PlayerStatistics"
          },
          "request_id": {
            "type": "string"
          }
        },
        "required": [
          "data",
          "request_id"
        ],
        "additionalProperties": false
      }
    },
    "parameters": {
      "Limit": {
        "name": "limit",
        "in": "query",
        "description": "Page size. Fetch only what is needed.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 50
        }
      },
      "Tournament": {
        "name": "tournament_id",
        "in": "path",
        "required": true,
        "description": "Exact id returned by listAuthorizedTournaments; never guess or enumerate IDs.",
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{1,64}$"
        }
      },
      "AfterTournament": {
        "name": "after",
        "in": "query",
        "description": "Pass next_cursor unchanged. Omit on first page.",
        "schema": {
          "type": "string",
          "maxLength": 64,
          "pattern": "^[A-Za-z0-9_-]{0,64}$"
        }
      },
      "After": {
        "name": "after",
        "in": "query",
        "description": "Opaque next_cursor from previous page of this same resource/tournament and identical dates. Do not decode or edit.",
        "schema": {
          "type": "string",
          "maxLength": 600,
          "pattern": "^[A-Za-z0-9_-]+$"
        }
      },
      "From": {
        "name": "from",
        "in": "query",
        "required": true,
        "description": "Inclusive YYYY-MM-DD in the stored local calendar date basis, not converted from UTC. Must be supplied with to.",
        "schema": {
          "type": "string",
          "format": "date"
        }
      },
      "To": {
        "name": "to",
        "in": "query",
        "required": true,
        "description": "Inclusive YYYY-MM-DD; from/to span at most93 calendar dates (difference<=92days).",
        "schema": {
          "type": "string",
          "format": "date"
        }
      },
      "Team": {
        "name": "team_id",
        "in": "path",
        "required": true,
        "description": "Exact public team ID returned by listTournamentTeams in this same authorized tournament.",
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{1,64}$"
        }
      },
      "Match": {
        "name": "match_id",
        "in": "path",
        "required": true,
        "description": "Exact public match ID from this tournament calendar or results.",
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{1,64}$"
        }
      },
      "Sort": {
        "name": "sort",
        "in": "query",
        "description": "name, last_name or exact metrics.id from this response. Hidden/unknown metrics rejected; null values last, stable ties. Names use case-sensitive codepoint order.",
        "schema": {
          "type": "string",
          "default": "name",
          "pattern": "^[A-Za-z0-9_-]{1,64}$"
        }
      },
      "Order": {
        "name": "order",
        "in": "query",
        "description": "Keep sort/order unchanged when passing after.",
        "schema": {
          "type": "string",
          "enum": [
            "asc",
            "desc"
          ],
          "default": "asc"
        }
      }
    }
  },
  "x-guide-es": {
    "title": "API de Sportwey",
    "intro": "Conecta tu sitio, tus reportes o un asistente de IA con la información de tus torneos. Tú decides qué torneos puede consultar cada integración.",
    "steps": [
      {
        "title": "Crea una clave",
        "body": "En API keys, selecciona Crear API key, asigna un nombre, elige los torneos y una vigencia de 7, 30, 90 o 365 días. Puedes tener hasta 3 claves activas y autorizar hasta 100 torneos por clave."
      },
      {
        "title": "Guárdala en tu servidor",
        "body": "La clave completa se muestra una sola vez. Guárdala en el gestor de secretos de tu aplicación. No la publiques en el navegador, una app distribuida, repositorios, logs, URLs ni conversaciones con IA."
      },
      {
        "title": "Conecta y consulta",
        "body": "Envía Authorization: Bearer TU_API_KEY por HTTPS. Consulta primero access o capabilities; después tournaments para obtener los identificadores autorizados. Usa esos IDs para calendario, resultados o posiciones."
      },
      {
        "title": "Controla el acceso",
        "body": "Consulta el consumo desde API keys. Puedes editar los torneos sin cambiar la clave ni su consumo y revocarla con un motivo. Los cambios pueden tardar en reflejarse. Una clave revocada no se puede recuperar."
      }
    ],
    "limits": "Configuración inicial: 10.000 peticiones admitidas al día por cuenta, compartidas entre sus claves. Por clave: ráfaga de 10, recuperación de 1 por segundo y 2 consultas simultáneas. La cuenta y el servicio también tienen límites compartidos. Son valores configurables por el operador. El reinicio diario es a las 00:00 UTC.",
    "accounting": "Una petición admitida reserva una unidad, aunque después termine en error. Las bloqueadas antes de admitirlas no consumen esa cuota. Un reintento nuevo puede consumir otra unidad. No hay datos de consumo global ni administración de claves en esta API externa.",
    "pagination": "Usa limit entre 1 y 100 (predeterminado 50). Si next_cursor no es null, envíalo sin modificar en after para la siguiente página. Conserva torneo, recurso, equipo y rango; detente al recibir null o al completar la necesidad del usuario.",
    "dates": "Calendario, resultados y resultados por equipo requieren from y to en formato YYYY-MM-DD, ambos incluidos, con máximo 93 fechas. Comparan fechas locales almacenadas; scheduled_at_local no incluye zona horaria. No lo interpretes como UTC. Equipos, jugadores, estadísticas individuales, detalle y posiciones no aceptan from/to.",
    "availability": "La URL base de la API es https://api.sportwey.com/external/v1. Usa una clave autorizada para este servicio; comprueba la disponibilidad con el administrador.",
    "ai": "La especificación OpenAPI permite describir estas consultas como herramientas de un agente. Autoriza la clave en el gestor de credenciales de la herramienta; no pegues secretos en un prompt. MCP no está publicado: esta documentación prepara la interfaz para un adaptador futuro."
  }
}
