swagger: '2.0'
info:
description: 'This is Genius Sports Services Fixture API.
Changelog resume
- 2.0.261 - Ability to filter by WELL-KNOWN external system identifiers e.g optaId, vesselId, fibaId, etc.
- 2.0.196 - Added the ability to retrieve deleted fixtures
- 2.0.193 - Expose outright fixtures with an extra query param (eventTypes) on GET and (eventType) on GetById for fixtures.
- 2.0.107 - Made fixtures round optional for POST and PUT.
Authentication
You need to provide two tokens in every API call. The access_token for Auth0 client AND your API key
- In order to get Auth0 client and API-KEY contact the SBOT team.
- Once you have the client you can make a request to Auth0 to get a token by:
curl --request POST --url https://{env or nothing for prod}.auth.geniussports.com/oauth/token --header ''content-type: application/json'' --data ''{''client_id'':''4Ew9c8DX58O1i0zsrTW9DlLSlDg9Rrt7'',''client_secret'':''client-secret'',''audience'':''https://api.geniussports.com'',''grant_type'':''client_credentials''}'' - Once you the get the response you would need to take the value from the ''access_token'' property. At this point you are ready to get started!
-
- Use the sports/10 call to retrieve Football (sport ID = 10)
curl https://{env or nothing for prod}fixtures.api.geniussports.com/v2/sports?filter=id[equals]:10 -H ''Content-Type: application/json'' -H ''x-api-key: YOUR_API_KEY'' -H ''Authorization: Bearer YOUR_ACCESS_TOKEN''
What is new in Fixtures API v2.
- Consistent pagination with up to 200 items per page
- Consistent response using HATEOAS model wrapper (when listing items)
- Sorting by specific field(s) (see each endpoint details for fore info, about which fields you can sort by)
- in order to sort just pass ''sortBy'' query param, example: sortBy=id
- then by sorting, example: sortBy=id,name
- sort by descending: example: sortBy=id:desc,name
- Powerful filter by specific field (see each endpoint details for fore info, about which fields you can filter by)
- in order to filter just pass ''filter'' query param, example: filter=id[equals]:1
- multiple IDs filtering, example: filter=id[in]:1,2,3
- Filter stacking (separate them with ~), example: filter=id[in]:1,2,3~sportId[in]:1,2,3,4,5
- different filter comparators: equals, in, gte, lte, contains, startsWith, notequals, nin:
- filter=id[equals]:1 - Equals comparator works with all data type
- filter=id[notequals]:1 - Not Equals comparator works with all data type
- filter=id[in]:1,2,3 - In comparator works only with integer and decimal values
- filter=id[nin]:1,2,3 - NIN comparator works only with integer and decimal values
- filter=startDate[gte]:2021-07-28~startDate[lte]:2021-07-29 - duplications of filter property allowed only in this ''range'' case
- filter=name[contains]:test
- filter=name[startsWith]:test
- filter=cityName[equals]:null
- filter=cityName[notequals]:null
- Filter by external id. Filter works only the Fixtures system has external provider and have explicitly allowed persisting external ids fir tat source. example: filter=externalIds.optaId[equals]:12345
- Imporoved and consistent structure of the API endpoints
- Each endpoint (which needs) from the hierarchy has exactly 2 endpoints:
- One for listing multiple items - the filtering sorting are implemented by query params
- One for single item by id
- No deleted fixtures by default
- Does not use SpoCoSy database (Party), but the Proposal API database (therefore there is Eventual consistency, and not everything is available right away)
Fixture Tree Structure
- organisations
- venue
- locality
- sports
- competitions
- seasons
- rounds (competitionPhase)
- fixture
- fixturecompetitors
- competitor (team, player, doubles, horse, etc)
Examples
I am interested in round 2 fixtures for the English Premier League
- Use sports call to retrieve the relevant sport ID - in this case ID 10 for Football
curl https://ci.fixtures.api.geniussports.com/v2/sports -H ''Content-Type: application/json'' -H ''x-api-key: YOUR_API_KEY'' -H ''Authorization: Bearer YOUR_ID_TOKEN'' - Use competitions call to see competitions for your sport - in this case ID 36 for ''England Premier League''
curl https://ci.fixtures.api.geniussports.com/v2/competitions?filter=sportId[equals]:10~name[contains]:Premier -H ''Content-Type: application/json'' -H ''x-api-key: YOUR_API_KEY'' -H ''Authorization: Bearer YOUR_ID_TOKEN'' - Use seasons call to see seasons for your competition - in this case you will see the 2017/2018 season as ID 64525
curl https://ci.fixtures.api.geniussports.com/v2/seasons?filter=competitionId[equals]:36 -H ''Content-Type: application/json'' -H ''x-api-key: YOUR_API_KEY'' -H ''Authorization: Bearer YOUR_ID_TOKEN'' - Use rounds call to see rounds for your season - Find Round 2 with ID 338088
curl https://ci.fixtures.api.geniussports.com/v2/rounds?filter=seasonId[equals]:64525 -H ''Content-Type: application/json'' -H ''x-api-key: YOUR_API_KEY'' -H ''Authorization: Bearer YOUR_ID_TOKEN'' - Use fixtures call to get all fixtures we have for Round 2
curl https://ci.fixtures.api.geniussports.com/v2/fixtures?filter=roundId[equals]:338088 -H ''Content-Type: application/json'' -H ''x-api-key: YOUR_API_KEY'' -H ''Authorization: Bearer YOUR_ID_TOKEN''
I am interested in Arsenal and their players
- You can re-use the 2017/2018 EPL season ID from the example above, ID 64525 to get Season Details
curl https://ci.fixtures.api.geniussports.com/v2/seasons/64525 - ''Content-Type: application/json'' -H ''x-api-key: YOUR_API_KEY'' -H ''Authorization: Bearer YOUR_ID_TOKEN'' - Find Arsenal in the response with competitor ID 10025 and use this ID to get all Arsenal contracts
curl https://ci.fixtures.api.geniussports.com/v2/competitors/teams/10025 -H ''Content-Type: application/json'' -H ''x-api-key: YOUR_API_KEY'' -H ''Authorization: Bearer YOUR_ID_TOKEN''
'
version: 2.0.280
title: Fixtures-v2 Competitions Matches API
contact:
email: sbonboarding@geniussports.com
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
host: fixtures.api.geniussports.com
basePath: /v2
schemes:
- https
tags:
- name: Matches
description: Match data and broadcasts
paths:
/v1/matches:
get:
tags:
- Matches
summary: List matches
operationId: listMatches
parameters:
- $ref: '#/components/parameters/Limit'
- $ref: '#/components/parameters/Offset'
- $ref: '#/components/parameters/Fields'
- name: competitionId
in: query
schema:
type: string
- name: from
in: query
schema:
type: string
format: date
- name: to
in: query
schema:
type: string
format: date
responses:
'200':
description: Matches envelope
content:
application/json:
schema:
$ref: '#/components/schemas/ResponseEnvelope'
/v1/matches/{matchId}:
parameters:
- name: matchId
in: path
required: true
schema:
type: string
get:
tags:
- Matches
summary: Get a match
operationId: getMatch
responses:
'200':
description: Match envelope
content:
application/json:
schema:
$ref: '#/components/schemas/ResponseEnvelope'
components:
parameters:
Offset:
name: offset
in: query
description: Skip the first N records
schema:
type: integer
default: 0
Fields:
name: fields
in: query
description: Comma-separated list of fields to return
schema:
type: string
Limit:
name: limit
in: query
description: Record limit (default 10, maximum 500)
schema:
type: integer
default: 10
maximum: 500
schemas:
ResponseEnvelope:
type: object
properties:
meta:
$ref: '#/components/schemas/ResponseMeta'
data:
oneOf:
- type: object
- type: array
items:
type: object
ResponseMeta:
type: object
properties:
version:
type: string
code:
type: integer
status:
type: string
enum:
- success
- failure
request:
type: string
time:
type: integer
count:
type: integer
limit:
type: integer
securityDefinitions:
Auth0:
type: apiKey
name: Authorization
in: header
x-amazon-apigateway-authtype: oauth2
api_key:
type: apiKey
name: x-api-key
in: header
x-amazon-apigateway-security-policy: TLS_1_0