Overview

General information about how to use our API.

The core of SportAI is the API. The API lets you interact with our state-of-the-art models, letting you do things like activity detection and automatic extraction of game statistics. To use the API, you need to have valid API key. You automatically get a key when you create a SportAI account, which you can do through our Console. When you have an account, you can also create more keys, and manage the keys you have. See more API Keys.

Content Types

The SportAI API exclusively accepts JSON for request bodies and responds with JSON. Ensure that requests include the content-type: application/json header.

How the API works

The intended use is explained here interacting with the activity-detection endpoints:

You pass your API key in the Authorization header with a "Bearer " prefix:

fetch('https://api.sportai.com/api/activity_detection', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${apiKey}`,
	'Content-Type': 'application/json'
  },
  body: JSON.serialize({
    video_url: 'https://example.com/video/3cab8744-fd22-4efe-a5f4-9a7fc8ad3716.mp4'
  })

A successful response will contain task_id:

{
  "data": {
    "task_id": "52921d5c-eb41-45d6-96a8-f2da5616c717"
  }
}

You will use task_id in the following steps.

Use the task_id as a path parameter:

fetch('https://api.sportai.com/api/activity_detection/52921d5c-eb41-45d6-96a8-f2da5616c717/status', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${apiKey}`,
	'Content-Type': 'application/json'
  })

A successful reponse:

{
  "data": {
	"task_id": "52921d5c-eb41-45d6-96a8-f2da5616c717",
	"video_url": "https://example.com/video/3cab8744-fd22-4efe-a5f4-9a7fc8ad3716.mp4",
	"task_status": "pending",
	"task_progress": 0.45
  }
}
Webhooks are under active development. When they are available, you will be able to set up automatic notifications of when your tasks are done.
Webhooks are now available in an early beta. See Webhooks for more information!

Use the task_id as a path parameter:

fetch('https://api.sportai.com/api/activity_detection/52921d5c-eb41-45d6-96a8-f2da5616c717', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${apiKey}`,
	'Content-Type': 'application/json'
  })

A successful reponse:

{
  "data": {
    "activity_blocks": [
	  {
	    "start_time": 122.4000015258789,
	    "stop_time": 772.7999877929688,
	    "label": "activity"
      }
	]
  }
}

Get started

In our Console, you can also test our API indirectly by interacting with the pages under "Capabilities".

If you want to go ahead and start incorporating our API in your project, you can find all the details under API Reference.

In the following pages, you can read more about what the different endpoints provide, how they work, etc.

FAQ

On this page