Download OpenAPI specification:Download
The Sporfie system exposes a set of REST APIs at https://api.sporfie.com.
These APIs allow you to
This API will only answer to authenticated requests.
A request is authenticated by adding the token we have given you in the HTTP request header:
Authorization: Bearer {token}
This end point returns all the Places of the targeted Company/organization
companyKey required | string The company/organization's key |
{- "places": [
- {
- "key": "string",
- "companyKey": "string",
- "name": "string",
- "sport": "string",
- "timeZoneID": "string",
- "location": {
- "name": "string",
- "geoLoc": {
- "lat": 0,
- "lng": 0
}
}, - "activeEventKey": "string",
- "thumbnailURL": "string"
}
]
}
Finds a specific Sporfie Event for a given place and time.
The end point looks for the event that started after, and within one hour of, the given date and time and returns its unique identifier. If there are several matching events (multiple events on that place within the same hour), the key of the first one is returned.
Important: the date & time information must be given in UTC, not local time.
placeKey required | string Example: placeKey=Place_345 The Place identifier |
year required | number Example: year=2021 The year the event started (UTC) |
month required | integer [ 1 .. 12 ] Example: month=5 The month the event started (UTC) |
day required | integer [ 1 .. 31 ] Example: day=6 The day the event started (UTC) |
hour required | integer [ 0 .. 23 ] Example: hour=16 The hour the event started (UTC) |
{- "eventKey": "string"
}
Finds events belonging to a given company/organization and having a given state.
The results are paginated and include a trimmed-down representation of found events. For the full event data about a particular event and separate request should be made on the Event data endpoint with the event key retrieved from this list.
Three event states are supported:
future
- the event has not started yetcurrent
- the event has started but not finished yetpast
- the event has finishedThe order of events in the response depends on the state of the events:
future
- increasing order of scheduled start timecurrent
- increasing order of start timepast
- decreasing order of start timecompanyKey required | string The company/organization's key |
state required | string Enum: "future" "current" "past" The state of the event |
pageSize required | number The number of events to return per page |
page required | number The page number. The first page is page 0. |
{- "page": 0,
- "pageSize": 0,
- "totalCount": 0,
- "events": [
- {
- "key": "string",
- "externalEventID": "string",
- "name": "string",
- "creationDate": 0,
- "scheduledStartTime": 0,
- "scheduledEndTime": 0,
- "announcedTime": 0,
- "startTime": 0,
- "endTime": 0,
- "description": "string",
- "thumbnailURL": "string",
- "metadata": { }
}
]
}
This end point returns all the relevant data for the given event key.
Note event data changes over time as the event unfolds, e.g. live streams are started and stopped, moments are captured, etc.
This API returns a snapshot of the event data at the time of the request. To stay informed of changes in the event data, use the Watch API.
eventKey
may either be a Sporfie-internal event key, or an event's externalID
.
eventKey required | string The event externalID or eventKey |
{- "key": "string",
- "externalEventID": "string",
- "companyKey": "string",
- "name": "string",
- "description": "string",
- "notSearchable": true,
- "creationDate": 0,
- "placeKey": "string",
- "scheduledStartTime": 0,
- "scheduledEndTime": 0,
- "announcedTime": 0,
- "startTime": 0,
- "endTime": 0,
- "thumbnailURL": "string",
- "homeTeam": "string",
- "awayTeam": "string",
- "shortInviteUrl": "string",
- "sport": "string",
- "pinCode": 0,
- "cameraPinCode": 0,
- "scoreSupported": true,
- "score": {
- "key": "string",
- "timeStamp": 0
}, - "scoreStream": [
- {
- "key": "string",
- "timeStamp": 0
}
], - "highlightsURL": "string",
- "highlightsShareURL": "string",
- "location": {
- "name": "string",
- "geoLoc": {
- "lat": 0,
- "lng": 0
}
}, - "moments": [
- {
- "key": "string",
- "momentStatus": "string",
- "momentStartTime": 0,
- "scoreStreamEntryKey": "string",
- "videoClips": [
- {
- "key": "string",
- "rank": 0,
- "thumbnailURL": "string",
- "videoURL": "string",
- "downloadURL": "string",
- "shortUrl": "string",
- "views": 0,
- "orientation": "string",
- "thumbnailSizes": "string",
- "startTime": 0,
- "endTime": 0
}
], - "players": [
- {
- "id": "string",
- "name": "string"
}
], - "metadata": { }
}
], - "mediaFiles": [
- {
- "startTime": 0,
- "thumbnailURL": "string",
- "videoURL": "string",
- "downloadURL": "string",
- "status": "m3u8_uploaded",
- "deviceID": "string"
}
], - "hiddenDevices": { },
- "liveStreams": [
- {
- "thumbnailURL": "string",
- "liveURL": "string",
- "deviceID": "string"
}
], - "metadata": { }
}
Creates an event in the Sporfie database.
The event's externalID
is set to the value of the eventKey
parameter. Upon successful event creation, the event's internal ID is returned in the response in the eventKey
field. The event may thereafter be referred to either by its externalID
or its internal eventKey
.
You are free to choose your external ID as you see fit, within the following constraints:
Only the name
and location
fields are mandatory in the body data, if placeKey
is not set. If placeKey
is set, location
field is optional because the location will be inherited from the place. name
may not be emtpy.
The sport
field must be one of the following code:
baseball
: Baseballbasketball
: Basketballbeachvolleyball
: Beach Volleyballbowling
: Bowlingfootball
: Footballfrontenis
: Frontenisfutsal
: Futsalgolf
: Golfhockey
: Hockeylacrosse
: Lacrosseother
: Othersoccer
: Soccertennis
: Tennisunihockey
: Floorballvolleyball
: VolleyballIf the given sport is not one of those, or if not provided, other
will be used.
If placeKey
is present, then so must scheduledStartTime
and scheduledEndTime
.
When provided, scheduledStartTime
and scheduledEndTime
must both be present and be in the future and scheduledEndTime
must be greater than scheduledStartTime
by at least 5 minutes.
The thumbnailURL
must point to a publicly accessible image resource. The image is copied by the Sporfie system and may be resized or cropped to fit Sporfie's requirements.
eventKey required | string The event externalID or eventKey |
companyKey required | string The identifier of the company/organization this event is associated with |
name required | string The event name. May not be empty. |
description | string The event description |
notSearchable | boolean Set to true to exclude this event from public listing in the Sporfie system. Default value is |
placeKey | string The key of the Place on which the event is scheduled to run. |
scheduledStartTime | number The date & time the event is scheduled to start (UTC, epoch in milliseconds) |
scheduledEndTime | number The date & time the event is scheduled to end (UTC, epoch in milliseconds) |
thumbnailURL | string A public URL pointing to the event's thumbnail |
homeTeam | string The name of the team playing at home |
awayTeam | string The name of the team playing away |
sport | string The sport code for this event |
pinCode | number The pin code controlling access to the event. A value of -1 or between 0000 and 9999. A value of -1 indicates no pin code. Default is -1. |
cameraPinCode | number The pin code required to add a camera and edit the score. A value of -1 or between 0000 and 9999. A value of -1 indicates no pin code. Default is -1. |
object (Location) A geo location | |
metadata | object A dictionary of custom fields. Its JSON string representation (UTF-8) may not exceed 4000 bytes. Keys may not contain the following characters |
hiddenDevices | object A dictionary of device keys that should be hidden from the event. The keys are the device keys, and the values are |
{- "companyKey": "string",
- "name": "string",
- "description": "string",
- "notSearchable": true,
- "placeKey": "string",
- "scheduledStartTime": 0,
- "scheduledEndTime": 0,
- "thumbnailURL": "string",
- "homeTeam": "string",
- "awayTeam": "string",
- "sport": "string",
- "pinCode": 0,
- "cameraPinCode": 0,
- "location": {
- "name": "string",
- "geoLoc": {
- "lat": 0,
- "lng": 0
}
}, - "metadata": { },
- "hiddenDevices": { }
}
{- "eventKey": "string"
}
Modifies an existing event.
eventKey
may either be a Sporfie-internal event key, or an event's externalID
.
No field is mandatory in the body data. Only fields present in the body data will be updated in the event, other fields will be left unmodified. The location
and metadata
fields are considered as atomic values in that respect.
When present, scheduledStartTime
and scheduledEndTime
must be in the future.
Current values of scheduledStartTime
and scheduledEndTime
must be in the future to be modifiable.
The value of placeKey
may not be modified if scheduledStartTime
is in the past.
The thumbnailURL
must point to a publicly accessible image resource. The image is copied by the Sporfie system and may be resized or cropped to fit Sporfie's requirements.
eventKey required | string The event externalID or eventKey |
companyKey required | string The identifier of the company/organization this event is associated with |
name required | string The event name. May not be empty. |
description | string The event description |
notSearchable | boolean Set to true to exclude this event from public listing in the Sporfie system. Default value is |
placeKey | string The key of the Place on which the event is scheduled to run. |
scheduledStartTime | number The date & time the event is scheduled to start (UTC, epoch in milliseconds) |
scheduledEndTime | number The date & time the event is scheduled to end (UTC, epoch in milliseconds) |
thumbnailURL | string A public URL pointing to the event's thumbnail |
homeTeam | string The name of the team playing at home |
awayTeam | string The name of the team playing away |
sport | string The sport code for this event |
pinCode | number The pin code controlling access to the event. A value of -1 or between 0000 and 9999. A value of -1 indicates no pin code. Default is -1. |
cameraPinCode | number The pin code required to add a camera and edit the score. A value of -1 or between 0000 and 9999. A value of -1 indicates no pin code. Default is -1. |
object (Location) A geo location | |
metadata | object A dictionary of custom fields. Its JSON string representation (UTF-8) may not exceed 4000 bytes. Keys may not contain the following characters |
hiddenDevices | object A dictionary of device keys that should be hidden from the event. The keys are the device keys, and the values are |
{- "companyKey": "string",
- "name": "string",
- "description": "string",
- "notSearchable": true,
- "placeKey": "string",
- "scheduledStartTime": 0,
- "scheduledEndTime": 0,
- "thumbnailURL": "string",
- "homeTeam": "string",
- "awayTeam": "string",
- "sport": "string",
- "pinCode": 0,
- "cameraPinCode": 0,
- "location": {
- "name": "string",
- "geoLoc": {
- "lat": 0,
- "lng": 0
}
}, - "metadata": { },
- "hiddenDevices": { }
}
Add a score entry in the score stream of the event.
eventKey
may either be a Sporfie-internal event key, or an event's externalID
.
eventKey required | string The key of the event to add the score to |
The score information at timeStamp
.
The score
object may contain any score information that is relevant for the sport of the event. It must contain a timeStamp
field.
The generic score format includes the following fields
left
: integer, the score of the 'left' player (typically Home)period
: integer, the current period (e.g. first half, or second set, etc...)right
: integer, the score of the 'right' player (typically Away)Please ask for details about your sport.
The timeStamp
and key
fields are reserved field names in the score object.
The scoreValue
object contains two components: gameScores
and pointScore
.
gameScores
is an array of pairs representing sets, where each pair contains games won by home and away teams.pointScore
is a pair representing the point total in the current game. Instead of 15, 30, 40, A, the values 1, 2, 3, and 4 are used, respectively.
Even though left
, right
, and period
are not used in scoring, they must be present.The scoreValue
object contains only gameScores
, which functions similarly to Tennis but without pointScore
.
gameScores
represents a set, where values indicate the points won by the home and away teams.Example - Volleyball Score Update
{
"period": 0,
"right": -1,
"left": -1,
"timeStamp": 1692319468961,
"scoreValue": {
"gameScores": [[25, 22], [19, 25], [25, 20]]
}
}
timeStamp required | integer Absolute time of the score information (UTC, unix epoch in milliseconds) |
{- "timeStamp": 0
}
{- "key": "string"
}
Register for notification on event changes.
Call this end point when you need to be notified of changes on a specific event.
eventKey
may either be a Sporfie-internal event key, or an event's externalID
.
Once registered, your webhook will be called whenever anything changes in the event. A change of any of the following event property will trigger a callback
Your webhook is called with the updated event data:
POST {webhook}
{
... // Event data, in the same format as returned by the Event data end point
}
This registration call is idempotent, calling it several times will register only one webhook for a given event and any previously registered webhook will be replaced with the new one.
When you don't need to be notified of updates anymore, call the same endpoint with the DELETE
verb to unregister.
Important: the registration is valid for a maximum of 12 hours, after which you webhook will be unregistered. To maintain your webhook, you must re-register it within that time limit.
eventKey required | string The key of the event to watch |
url required | string The URL our system will call when a change occurs |
contentType required | string The Content-Type to use in the webhook call. |
{- "url": "string",
- "contentType": "string"
}
Use this end point to validate your overlay templates.
You can specify a source video to use using sourceURL
or use our default test video by not providing a sourceURL
.
The source video is trimmed down to 15 seconds.
Your overlays will be applied to the video and the resulting video's URL is returned in the answer to the call. The video is available for 1 hour at that URL.
The video generation process takes about 30 seconds (up to a minute on the first call) to complete.
sourceURL | string The video on which to test your overlays. This must point to a freely downloadable MP4 video. |
required | Array of objects (Overlay) |
{- "videoURL": "string"
}
Creates a Click and triggers the recording of a Moment with video clips.
All currently active cameras generate a video clip for the requested time range and upload it to the Sporfie system to create a multi-angle Moment.
eventKey
may either be a Sporfie-internal event key, or an event's externalID
.
If no startTime
and endTime
are provided, the default settings for the event's sport are used to compute a recording window.
The score
field is an unconstrained dictionary containing the score information for that moment in time. It is stored as is and will appear at that time stamp in the event's score stream.
The players
field is optional and lists the players involved in the Moment. When present, this information is used by the Sporfie WebApp to allow the user to filter Moments by player on the Event page.
The metadata
field is an optional dictionary that may be used by the caller to store any custom information he/she may want to associate with the Moment. It is stored as is in the Moment generated by the click. See the description of the field for restrictions on the content of this dictionary.
The generated video clips may be augmented with overlays. The list of of overlays to apply is passed in overlays
. See the definition of Overlay for details. All clips have the same overlays.
Note retrieving the clips and applyfing the overlays takes a few seconds. Getting a positive response from the server does not indicate that the videos are available, only that the request has been accepted and that the process of generating the videos is under way.
An Overlay is a still picture burned into a video clip at a fixed location with a fixed size starting at a given time and for a given duration.
There are two ways to provide the picture to be burned in
The imageSource
url must point to a freely accessible and valid PNG or JPEG file. When burned into the video, the aspect ratio of the image is maintained.
The templateSource
url must point to a freely accessible and valid HTML file.
The HTML may contain any number of placeholders that shall be replaced by values found in the values
dictionary.
The template must meet the following requirements:
meta
entry specifying the natural rendering size for the scoreboard must be present in the file <meta renderWidth="410" renderHeight="27"/>
. The rendered overlay will have the specified size. Note that this is not the final size that the overlay will have in the video, that size is specified by heightPercentOfHeight
(see below).<style>
entries<script>
entry is permittedtext1
shall be used in the HTML as [text1]
, e.g. <div>[text1]</div>
.values
dictionary are the name of the placeholders, without the braquets, e.g. { "text1": "Training session" }
. All placeholders found in the template must have a value in the values
dictionary (which can be an empty string if needed).<body>
must be given a background-color
if one does not want a transparent background.<style>
entries as @font-face
, e.g. @font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/roboto/v27/KFOmCnqEu92Fr1Me5Q.ttf) format('truetype');
}
The downloaded template and the values
are used to generate a PNG image, which is then burned into the video at the given location and time.
Here is a sample template:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta renderWidth="410" renderHeight="27" />
<style>
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/roboto/v27/KFOmCnqEu92Fr1Me5Q.ttf) format('truetype');
}
body {
width: 100vw;
height: 100vh;
margin: 0;
overflow: hidden;
font-family: 'Roboto';
}
.Score {
background-color: white;
color: black;
font-size: 20px;
text-align: center;
}
.team {
font-size: 80%;
display: inline-block;
padding: 0.1em 0.4em;
background-color: white;
color: black;
vertical-align: middle;
width: 5em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
text-transform: uppercase;
}
.score {
font-weight: bold;
display: inline-block;
padding: 0.1em 0.4em;
background-color: black;
color: white;
vertical-align: middle;
min-width: 2em;
}
.period {
display: inline-block;
padding: 0.2em 1em;
height: 100%;
font-size: 65%;
font-weight: bold;
vertical-align: middle;
min-width: 2em;
}
</style>
</head>
<body>
<div class="Score">
<div class="team">[home_team]</div>
<div class="score">[left]</div>
<div class="period">[period]</div>
<div class="score">[right]</div>
<div class="team">[away_team]</div>
</div>
</body>
</html>
The overlay image is placed in the position specified by position
:
position: {
horizontal: 'left' | 'center' | 'right',
vertical: 'top' | 'center' | 'bottom'
}
For instance:
{
...
"position": { "horizontal": "left", "vertical": "center" }
...
}
will position the overlay on the left side of the video, vertically centered.
The size of the image in the video is defined by the heightPercentOfHeight
or widthPercentOfWidth
parameter, which specifies the height or width of the image in percent of the height or width of the video. Exactly one of the two parameters must be specified, the other dimension is computed according to the aspect ratio of the image. If both parameters are present, heightPercentOfHeight
takes precendence.
When the overlay is placed in a corner or a side, a margin is added vertically and horizontally to detach the overlay from the border of the video. The size of this margin (both horizontally and vertically) is a percentage of the video's width (marginPercentOfWidth
) or height (marginPercentOfHeight
), either one parameter may be specified, but not both. If both are present, marginPercentOfHeight
takes precedence.
Unless specified otherwise, the overlay is shown from the start to the end of the video.
The startTime
and duration
parameters allow to time the display of the overlay more precisely.
eventKey required | string The event key |
timeStamp required | integer Absolute time of the click (UTC, unix epoch in milliseconds) |
startTime | integer Absolute start time of the recording window (UTC, unix epoch in milliseconds). If |
endTime | integer Absolute end time of the recording window (UTC, unix epoch in milliseconds). If |
object The score information associated with this moment in time. Must contain the | |
Array of objects (Overlay) Overlays to apply on this moment's videos | |
Array of objects (Player) Player information | |
metadata | object A dictionary of custom fields. Its JSON string representation (UTF-8) may not exceed 500 bytes. Keys may not contain the following characters |
{- "timeStamp": 0,
- "startTime": 0,
- "endTime": 0,
- "score": {
- "timeStamp": 0
}, - "overlays": [
- {
- "imageSource": "string",
- "templateSource": "string",
- "values": { },
- "position": {
- "horizontal": "string",
- "vertical": "string"
}, - "heightPercentOfHeight": 0,
- "widthPercentOfWidth": 0,
- "marginPercentOfHeight": 0,
- "marginPercentOfWidth": 0,
- "startTime": 0,
- "duration": 0
}
], - "players": [
- {
- "id": "string",
- "name": "string"
}
], - "metadata": { }
}
{- "momentKey": "string"
}
This end point returns the data for a given Moment.
momentKey required | string The moment key |
{- "key": "string",
- "eventKey": "string",
- "momentStatus": "string",
- "momentStartTime": 0,
- "score": {
- "key": "string",
- "timeStamp": 0
}, - "videoClips": [
- {
- "key": "string",
- "rank": 0,
- "thumbnailURL": "string",
- "videoURL": "string",
- "downloadURL": "string",
- "shortUrl": "string",
- "views": 0,
- "orientation": "string",
- "thumbnailSizes": "string",
- "startTime": 0,
- "endTime": 0
}
], - "players": [
- {
- "id": "string",
- "name": "string"
}
], - "metadata": { }
}
Modifies some properties of a moment.
No field is mandatory in the body data. Only fields present in the body data will be updated in the moment, other fields will be left unmodified.
momentKey required | string The moment key |
object The score information associated with this moment in time. Must contain the | |
Array of objects (Player) Player information | |
metadata | object A dictionary of custom fields. Its JSON string representation (UTF-8) may not exceed 500 bytes. Keys may not contain the following characters |
{- "score": {
- "timeStamp": 0
}, - "players": [
- {
- "id": "string",
- "name": "string"
}
], - "metadata": { }
}