{"openapi":"3.0.3","info":{"title":"AFFA Fantasy PFL Integration API","version":"1.1.0","description":"PFL source endpoints for AFFA Fantasy players, seasons, match lineups and fixtures."},"servers":[{"url":"https://pfl.az/api/v1/affa-fantasy"}],"security":[{"bearerAuth":[],"psign":[]}],"paths":{"/players":{"get":{"summary":"Active footballers","operationId":"getAffaFantasyPlayers","parameters":[{"$ref":"#/components/parameters/Page"},{"$ref":"#/components/parameters/PerPage"},{"$ref":"#/components/parameters/Search"},{"$ref":"#/components/parameters/Timestamp"},{"$ref":"#/components/parameters/Psign"}],"responses":{"200":{"description":"Paginated active players list","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Player"}},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"401":{"$ref":"#/components/responses/AuthError"},"426":{"$ref":"#/components/responses/HttpsRequired"}}}},"/matches/{matchId}/lineups":{"get":{"summary":"Match starting lineup and substitutes","operationId":"getAffaFantasyMatchLineups","parameters":[{"name":"matchId","in":"path","required":true,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/Page"},{"$ref":"#/components/parameters/PerPage"},{"$ref":"#/components/parameters/Search"},{"$ref":"#/components/parameters/Timestamp"},{"$ref":"#/components/parameters/Psign"}],"responses":{"200":{"description":"Paginated match lineup","content":{"application/json":{"schema":{"type":"object","required":["startingLineup","substitutes","meta"],"properties":{"startingLineup":{"type":"array","items":{"$ref":"#/components/schemas/LineupPlayer"}},"substitutes":{"type":"array","items":{"$ref":"#/components/schemas/LineupPlayer"}},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"404":{"$ref":"#/components/responses/NotFound"},"401":{"$ref":"#/components/responses/AuthError"},"426":{"$ref":"#/components/responses/HttpsRequired"}}}},"/fixtures":{"get":{"summary":"Season fixtures","operationId":"getAffaFantasyFixtures","parameters":[{"name":"season_id","in":"query","required":false,"description":"Filter fixtures by season id. Use /seasons to discover available values.","schema":{"type":"integer"}},{"name":"league_id","in":"query","required":false,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/Page"},{"$ref":"#/components/parameters/PerPage"},{"$ref":"#/components/parameters/Search"},{"$ref":"#/components/parameters/Timestamp"},{"$ref":"#/components/parameters/Psign"}],"responses":{"200":{"description":"Paginated fixtures list","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Fixture"}},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"401":{"$ref":"#/components/responses/AuthError"},"426":{"$ref":"#/components/responses/HttpsRequired"}}}},"/seasons":{"get":{"summary":"Available seasons","operationId":"getAffaFantasySeasons","parameters":[{"$ref":"#/components/parameters/Page"},{"$ref":"#/components/parameters/PerPage"},{"$ref":"#/components/parameters/Search"},{"$ref":"#/components/parameters/Timestamp"},{"$ref":"#/components/parameters/Psign"}],"responses":{"200":{"description":"Paginated seasons list","content":{"application/json":{"schema":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Season"}},"meta":{"$ref":"#/components/schemas/Meta"}}}}}},"401":{"$ref":"#/components/responses/AuthError"},"426":{"$ref":"#/components/responses/HttpsRequired"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"access-token"},"psign":{"type":"apiKey","in":"header","name":"Psign"}},"parameters":{"Page":{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1}},"PerPage":{"name":"per_page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},"Search":{"name":"search","in":"query","required":false,"schema":{"type":"string"},"description":"Search by main text fields for the selected endpoint."},"Timestamp":{"name":"X-Timestamp","in":"header","required":true,"description":"Unix timestamp used for HMAC signature and replay protection.","schema":{"type":"integer","example":1750000000}},"Psign":{"name":"Psign","in":"header","required":true,"description":"HMAC-SHA256 signature over \"timestamp.canonical_body\".","schema":{"type":"string","example":"7b5a0c9d8b1c5f2d8f8a5f5b1f0e9c7d6a4b3c2d1e0f9a8b7c6d5e4f3a2b1c0d"}}},"schemas":{"Player":{"type":"object","required":["id","firstName","lastName","position","club","shirtNumber","photo"],"properties":{"id":{"type":"integer","example":1},"firstName":{"type":"string","nullable":true,"example":"Rahil"},"lastName":{"type":"string","nullable":true,"example":"Məmmədov"},"position":{"type":"string","nullable":true,"example":"Defender"},"club":{"type":"string","nullable":true,"example":"Qarabağ FK"},"shirtNumber":{"type":"integer","nullable":true,"example":4},"photo":{"type":"string","nullable":true,"format":"uri","example":"https://cdn.example.com/player.jpg"}}},"LineupPlayer":{"type":"object","required":["id","firstName","lastName","position","shirtNumber","photo","teamId","teamName","lineupType"],"properties":{"id":{"type":"integer"},"firstName":{"type":"string","nullable":true},"lastName":{"type":"string","nullable":true},"position":{"type":"string","nullable":true},"shirtNumber":{"type":"integer","nullable":true},"photo":{"type":"string","nullable":true,"format":"uri"},"teamId":{"type":"integer","nullable":true},"teamName":{"type":"string","nullable":true},"lineupType":{"type":"string","enum":["starting","substitute"]}}},"Fixture":{"type":"object","required":["matchId","round","matchDate","kickoffTime","homeTeam","awayTeam","stadium","status","season"],"properties":{"matchId":{"type":"integer"},"round":{"oneOf":[{"type":"integer"},{"type":"string"}],"nullable":true},"matchDate":{"type":"string","nullable":true,"format":"date","example":"2026-08-15"},"kickoffTime":{"type":"string","nullable":true,"example":"20:00"},"homeTeam":{"type":"string","nullable":true},"awayTeam":{"type":"string","nullable":true},"stadium":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","started","paused","finished","unknown"]},"season":{"type":"string","nullable":true}}},"Season":{"type":"object","required":["id","title","status","leaguesCount"],"properties":{"id":{"type":"integer","example":1},"title":{"type":"string","nullable":true,"example":"2025/2026"},"status":{"type":"string","enum":["active","passive"]},"leaguesCount":{"type":"integer"}}},"Meta":{"type":"object","required":["request_id","statusCode","timestamp","psign"],"properties":{"request_id":{"type":"string","example":"affa_65f2c74f09c338.51864327"},"statusCode":{"type":"integer","example":200},"timestamp":{"type":"string","format":"date-time"},"psign":{"type":"string","nullable":true},"pagination":{"$ref":"#/components/schemas/Pagination"}}},"Pagination":{"type":"object","required":["current_page","per_page","total","last_page","from","to"],"properties":{"current_page":{"type":"integer"},"per_page":{"type":"integer"},"total":{"type":"integer"},"last_page":{"type":"integer"},"from":{"type":"integer","nullable":true},"to":{"type":"integer","nullable":true}}},"ErrorResponse":{"type":"object","required":["success","error","meta"],"properties":{"success":{"type":"boolean","example":false},"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","example":"INVALID_SIGNATURE"},"message":{"type":"string","example":"Request signature is invalid"}}},"meta":{"$ref":"#/components/schemas/Meta"}}}},"responses":{"AuthError":{"description":"Authentication or signature error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"HttpsRequired":{"description":"HTTPS is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"NotFound":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}