{
  "openapi": "3.0.3",
  "info": {
    "title": "VolleyHook API",
    "version": "1.0.0",
    "description": "Mestaruusliigan julkinen kuvapalvelurajapinta: pelaajien, joukkueiden ja tuomareiden hyväksytyt kuvat. Kaikki kutsut vaativat API-avaimen otsakkeessa X-API-Key. Yksittäishauissa tunnisteena voi käyttää sovelluksen sisäistä tunnistetta tai Torneopal-tunnistetta. Kuvan `url` (sama kuin `r2_url`) on suora, allekirjoitettu latauslinkki rajattuun ja syvättyyn kuvatiedostoon, voimassa 24 h (ks. url_expires) — vanhennuttuaan uusi linkki saadaan kutsumalla rajapintaa uudelleen. Vain hyväksytyt, käsiteltyihin versioihin saakka edenneet kuvat listataan. `image_updated_at` kertoo, milloin nykyinen kuvatiedosto on tehty (muuttuu vain kun kuva vaihtuu); `updated_at` voi muuttua myös muista syistä. Uudet kuvat saa haettua listareiteillä parametrilla `updated_since`."
  },
  "servers": [
    {
      "url": "https://api.volleyhook.lentopallo.app/api/public"
    },
    {
      "url": "/api/public"
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    }
  },
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/v1/player-images/{id}": {
      "get": {
        "summary": "Pelaajan hyväksytty kuva",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "x-scope": "images:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Sovelluksen sisäinen tunniste (UUID) tai Torneopal-tunniste. Nimiin perustuvia tunnisteita ei tueta.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "id": "0f2a…",
                    "type": "pelaajakuva",
                    "torneopal_id": "123456",
                    "torneopal_person_id": "123456",
                    "name": "Matti Meikäläinen",
                    "role": "Hakkuri",
                    "number": "7",
                    "position": "Hakkuri",
                    "team": "Esimerkki Volley",
                    "team_id": "8c1b…",
                    "torneopal_team_id": "98765",
                    "season": "2026-27",
                    "series": "ml",
                    "club_id": "4f2a…",
                    "club_name": "Esimerkki Seura",
                    "torneopal_club_id": "1234",
                    "width": 1200,
                    "height": 1600,
                    "url": "https://<account>.r2.cloudflarestorage.com/<bucket>/…/7-matti-meikalainen.webp?X-Amz-Expires=86400&X-Amz-Signature=…",
                    "url_expires": "2026-09-21T09:12:00Z",
                    "r2_url": "https://<account>.r2.cloudflarestorage.com/<bucket>/…/7-matti-meikalainen.webp?X-Amz-Expires=86400&X-Amz-Signature=…",
                    "image_updated_at": "2026-09-20T09:10:41Z",
                    "updated_at": "2026-09-20T09:12:00Z"
                  },
                  "meta": {}
                }
              }
            }
          },
          "404": {
            "description": "Ei löytynyt"
          }
        }
      }
    },
    "/v1/team-images/{id}": {
      "get": {
        "summary": "Joukkueen hyväksytty kuva",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "x-scope": "images:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Sovelluksen sisäinen tunniste (UUID) tai Torneopal-tunniste. Nimiin perustuvia tunnisteita ei tueta.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "id": "9d4e…",
                    "type": "joukkuekuva",
                    "torneopal_id": null,
                    "torneopal_person_id": null,
                    "name": null,
                    "role": null,
                    "number": null,
                    "position": null,
                    "team": "Esimerkki Volley",
                    "team_id": "8c1b…",
                    "torneopal_team_id": "98765",
                    "season": "2026-27",
                    "series": "ml",
                    "club_id": "4f2a…",
                    "club_name": "Esimerkki Seura",
                    "torneopal_club_id": "1234",
                    "width": 1600,
                    "height": 1200,
                    "url": "https://<account>.r2.cloudflarestorage.com/<bucket>/…/esimerkki-volley.webp?X-Amz-Expires=86400&X-Amz-Signature=…",
                    "url_expires": "2026-09-21T09:12:00Z",
                    "r2_url": "https://<account>.r2.cloudflarestorage.com/<bucket>/…/esimerkki-volley.webp?X-Amz-Expires=86400&X-Amz-Signature=…",
                    "image_updated_at": "2026-09-20T09:10:41Z",
                    "updated_at": "2026-09-20T09:12:00Z"
                  },
                  "meta": {}
                }
              }
            }
          },
          "404": {
            "description": "Ei löytynyt"
          }
        }
      }
    },
    "/v1/team-images": {
      "get": {
        "summary": "Joukkueiden hyväksytyt joukkuekuvat",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "x-scope": "images:read",
        "parameters": [
          {
            "name": "season",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "2026-27"
            }
          },
          {
            "name": "series",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "ML"
            }
          },
          {
            "name": "team",
            "in": "query",
            "description": "Joukkueen tunniste: sisäinen UUID tai Torneopalin joukkuetunniste",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "club",
            "in": "query",
            "description": "Seuran tunniste: sisäinen UUID tai Torneopalin club_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "updated_since",
            "in": "query",
            "description": "ISO-aika. Palauttaa vain kuvat, joiden image_updated_at on tätä myöhempi. Tallenna edellisen haun aika ja käytä sitä seuraavassa haussa.",
            "schema": {
              "type": "string",
              "format": "date-time",
              "example": "2026-09-20T00:00:00Z"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "maximum": 200
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": [
                    {
                      "id": "9d4e…",
                      "type": "joukkuekuva",
                      "torneopal_id": null,
                      "torneopal_person_id": null,
                      "name": null,
                      "role": null,
                      "number": null,
                      "position": null,
                      "team": "Esimerkki Volley",
                      "team_id": "8c1b…",
                      "torneopal_team_id": "98765",
                      "season": "2026-27",
                      "series": "ml",
                      "club_id": "4f2a…",
                      "club_name": "Esimerkki Seura",
                      "torneopal_club_id": "1234",
                      "width": 1600,
                      "height": 1200,
                      "url": "https://<account>.r2.cloudflarestorage.com/<bucket>/…/esimerkki-volley.webp?X-Amz-Expires=86400&X-Amz-Signature=…",
                      "url_expires": "2026-09-21T09:12:00Z",
                      "r2_url": "https://<account>.r2.cloudflarestorage.com/<bucket>/…/esimerkki-volley.webp?X-Amz-Expires=86400&X-Amz-Signature=…",
                      "image_updated_at": "2026-09-20T09:10:41Z",
                      "updated_at": "2026-09-20T09:12:00Z"
                    }
                  ],
                  "meta": {
                    "total": 1,
                    "limit": 50,
                    "offset": 0
                  }
                }
              }
            }
          },
          "401": {
            "description": "Avain puuttuu tai on virheellinen"
          },
          "403": {
            "description": "Avaimelta puuttuu oikeustaso"
          },
          "429": {
            "description": "Kutsuraja ylittyi"
          }
        }
      }
    },
    "/v1/referee-images/{id}": {
      "get": {
        "summary": "Tuomarin hyväksytty kuva",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "x-scope": "images:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Sovelluksen sisäinen tunniste (UUID) tai Torneopal-tunniste. Nimiin perustuvia tunnisteita ei tueta.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "id": "0f2a…",
                    "type": "tuomarikuva",
                    "torneopal_id": "123456",
                    "torneopal_person_id": "123456",
                    "name": "Matti Meikäläinen",
                    "role": "Hakkuri",
                    "number": "7",
                    "position": "Hakkuri",
                    "team": "Esimerkki Volley",
                    "team_id": "8c1b…",
                    "torneopal_team_id": "98765",
                    "season": "2026-27",
                    "series": "ml",
                    "club_id": "4f2a…",
                    "club_name": "Esimerkki Seura",
                    "torneopal_club_id": "1234",
                    "width": 1200,
                    "height": 1600,
                    "url": "https://<account>.r2.cloudflarestorage.com/<bucket>/…/7-matti-meikalainen.webp?X-Amz-Expires=86400&X-Amz-Signature=…",
                    "url_expires": "2026-09-21T09:12:00Z",
                    "r2_url": "https://<account>.r2.cloudflarestorage.com/<bucket>/…/7-matti-meikalainen.webp?X-Amz-Expires=86400&X-Amz-Signature=…",
                    "image_updated_at": "2026-09-20T09:10:41Z",
                    "updated_at": "2026-09-20T09:12:00Z"
                  },
                  "meta": {}
                }
              }
            }
          },
          "404": {
            "description": "Ei löytynyt"
          }
        }
      }
    },
    "/v1/staff-images/{id}": {
      "get": {
        "summary": "Taustahenkilön hyväksytty kuva",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "x-scope": "images:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Sovelluksen sisäinen tunniste (UUID) tai Torneopal-tunniste. Nimiin perustuvia tunnisteita ei tueta.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "id": "0f2a…",
                    "type": "taustahenkilokuva",
                    "torneopal_id": "123456",
                    "torneopal_person_id": "123456",
                    "name": "Matti Meikäläinen",
                    "role": "Valmentaja",
                    "number": "7",
                    "position": "Hakkuri",
                    "team": "Esimerkki Volley",
                    "team_id": "8c1b…",
                    "torneopal_team_id": "98765",
                    "season": "2026-27",
                    "series": "ml",
                    "club_id": "4f2a…",
                    "club_name": "Esimerkki Seura",
                    "torneopal_club_id": "1234",
                    "width": 1200,
                    "height": 1600,
                    "url": "https://<account>.r2.cloudflarestorage.com/<bucket>/…/7-matti-meikalainen.webp?X-Amz-Expires=86400&X-Amz-Signature=…",
                    "url_expires": "2026-09-21T09:12:00Z",
                    "r2_url": "https://<account>.r2.cloudflarestorage.com/<bucket>/…/7-matti-meikalainen.webp?X-Amz-Expires=86400&X-Amz-Signature=…",
                    "image_updated_at": "2026-09-20T09:10:41Z",
                    "updated_at": "2026-09-20T09:12:00Z"
                  },
                  "meta": {}
                }
              }
            }
          },
          "404": {
            "description": "Ei löytynyt"
          }
        }
      }
    },
    "/v1/team/{id}/images": {
      "get": {
        "summary": "Joukkueen kaikki hyväksytyt kuvat kerralla",
        "description": "Palauttaa joukkueen joukkuekuvan, pelaajakuvat ja taustahenkilöiden kuvat yhdellä kutsulla. Tunnisteena joukkueen sisäinen UUID tai Torneopal-tunniste; ilman season-parametria käytetään viimeisintä kautta.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "x-scope": "images:read",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Joukkueen sisäinen tunniste (UUID) tai Torneopal-tunniste.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "season",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "2026-27"
            }
          },
          {
            "name": "updated_since",
            "in": "query",
            "description": "ISO-aika. Palauttaa vain kuvat, joiden image_updated_at on tätä myöhempi. Tallenna edellisen haun aika ja käytä sitä seuraavassa haussa.",
            "schema": {
              "type": "string",
              "format": "date-time",
              "example": "2026-09-20T00:00:00Z"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "team": {
                      "id": "8c1b…",
                      "torneopal_team_id": "98765",
                      "name": "Esimerkki Volley",
                      "season": "2026-27",
                      "series": "ml",
                      "club_id": "4f2a…"
                    },
                    "team_image": {
                      "id": "9d4e…",
                      "type": "joukkuekuva",
                      "torneopal_id": null,
                      "torneopal_person_id": null,
                      "name": null,
                      "role": null,
                      "number": null,
                      "position": null,
                      "team": "Esimerkki Volley",
                      "team_id": "8c1b…",
                      "torneopal_team_id": "98765",
                      "season": "2026-27",
                      "series": "ml",
                      "club_id": "4f2a…",
                      "club_name": "Esimerkki Seura",
                      "torneopal_club_id": "1234",
                      "width": 1600,
                      "height": 1200,
                      "url": "https://<account>.r2.cloudflarestorage.com/<bucket>/…/esimerkki-volley.webp?X-Amz-Expires=86400&X-Amz-Signature=…",
                      "url_expires": "2026-09-21T09:12:00Z",
                      "r2_url": "https://<account>.r2.cloudflarestorage.com/<bucket>/…/esimerkki-volley.webp?X-Amz-Expires=86400&X-Amz-Signature=…",
                      "image_updated_at": "2026-09-20T09:10:41Z",
                      "updated_at": "2026-09-20T09:12:00Z"
                    },
                    "players": [
                      {
                        "id": "0f2a…",
                        "type": "pelaajakuva",
                        "torneopal_id": "123456",
                        "torneopal_person_id": "123456",
                        "name": "Matti Meikäläinen",
                        "role": "Hakkuri",
                        "number": "7",
                        "position": "Hakkuri",
                        "team": "Esimerkki Volley",
                        "team_id": "8c1b…",
                        "torneopal_team_id": "98765",
                        "season": "2026-27",
                        "series": "ml",
                        "club_id": "4f2a…",
                        "club_name": "Esimerkki Seura",
                        "torneopal_club_id": "1234",
                        "width": 1200,
                        "height": 1600,
                        "url": "https://<account>.r2.cloudflarestorage.com/<bucket>/…/7-matti-meikalainen.webp?X-Amz-Expires=86400&X-Amz-Signature=…",
                        "url_expires": "2026-09-21T09:12:00Z",
                        "r2_url": "https://<account>.r2.cloudflarestorage.com/<bucket>/…/7-matti-meikalainen.webp?X-Amz-Expires=86400&X-Amz-Signature=…",
                        "image_updated_at": "2026-09-20T09:10:41Z",
                        "updated_at": "2026-09-20T09:12:00Z"
                      }
                    ],
                    "staff": [
                      {
                        "id": "0f2a…",
                        "type": "taustahenkilokuva",
                        "torneopal_id": "123456",
                        "torneopal_person_id": "123456",
                        "name": "Matti Meikäläinen",
                        "role": "Valmentaja",
                        "number": "7",
                        "position": "Hakkuri",
                        "team": "Esimerkki Volley",
                        "team_id": "8c1b…",
                        "torneopal_team_id": "98765",
                        "season": "2026-27",
                        "series": "ml",
                        "club_id": "4f2a…",
                        "club_name": "Esimerkki Seura",
                        "torneopal_club_id": "1234",
                        "width": 1200,
                        "height": 1600,
                        "url": "https://<account>.r2.cloudflarestorage.com/<bucket>/…/7-matti-meikalainen.webp?X-Amz-Expires=86400&X-Amz-Signature=…",
                        "url_expires": "2026-09-21T09:12:00Z",
                        "r2_url": "https://<account>.r2.cloudflarestorage.com/<bucket>/…/7-matti-meikalainen.webp?X-Amz-Expires=86400&X-Amz-Signature=…",
                        "image_updated_at": "2026-09-20T09:10:41Z",
                        "updated_at": "2026-09-20T09:12:00Z"
                      }
                    ]
                  },
                  "meta": {}
                }
              }
            }
          },
          "404": {
            "description": "Ei löytynyt"
          }
        }
      }
    }
  }
}