Skip to content

Core Actions API

User-facing endpoints under /api/v1/actions.

Base Configuration

const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || "http://localhost:8080";
const ACTIONS_PATH = "/api/v1/actions";

Sessions

List Sessions

GET /sessions

Query params: - organizationSlug - Filter by organization - teamId - Filter by team - status - Filter by status (Draft, InProgress, Completed)

Response:

{
  "sessions": [
    {
      "id": "session-123",
      "name": "Practice - Jan 15",
      "status": "Completed",
      "formId": "form-456",
      "createdAt": "2024-01-15T10:00:00Z",
      "startedAt": "2024-01-15T10:05:00Z",
      "endedAt": "2024-01-15T12:00:00Z"
    }
  ]
}

Create Session

POST /sessions

Body:

{
  "name": "Practice - Jan 15",
  "formId": "form-456",
  "teamId": "team-789"
}

Get Session

GET /sessions/{sessionId}

Start Session

POST /sessions/{sessionId}/start

End Session

POST /sessions/{sessionId}/end

Delete Session

POST /sessions/{sessionId}/delete

Session Logs

GET /sessions/{sessionId}/logs
POST /sessions/{sessionId}/logs/create

Create body:

{
  "data": {
    "player": "John Doe",
    "action": "touchdown",
    "notes": "Great play"
  }
}

Session Clips

GET /sessions/{sessionId}/clips
POST /sessions/{sessionId}/clips/create

Create body:

{
  "startTime": "2024-01-15T10:30:00Z",
  "endTime": "2024-01-15T10:30:30Z",
  "cameraId": "camera-123"
}

Session Timeline

GET /sessions/{sessionId}/timeline

Response:

{
  "timeline": [
    {
      "id": "item-1",
      "type": "log",
      "timestamp": "2024-01-15T10:15:00Z",
      "data": { ... }
    },
    {
      "id": "item-2",
      "type": "clip",
      "timestamp": "2024-01-15T10:30:00Z",
      "data": { ... }
    }
  ]
}

Forms

List Forms

GET /forms

Query params: - organizationSlug - Filter by organization

Create Form

POST /forms

Body:

{
  "name": "Game Log Template",
  "schema": {
    "fields": [
      {
        "name": "player",
        "type": "text",
        "required": true
      },
      {
        "name": "action",
        "type": "select",
        "options": ["touchdown", "field goal", "turnover"]
      }
    ]
  }
}

Get Form

GET /forms/{formId}

Update Form

PUT /forms/{formId}

Delete Form

DELETE /forms/{formId}

Chats

List Chats

GET /chats

List Pinned Chats

GET /chats/pinned

Create Chat

POST /chats

Body:

{
  "text": "Initial message to start the conversation"
}

Get Chat with Messages

GET /chats/{chatId}

Response:

{
  "chat": {
    "id": "chat-123",
    "title": "Chat Title",
    "pinned": false,
    "archived": false,
    "createdAt": "2024-01-15T10:00:00Z"
  },
  "messages": [
    {
      "id": "msg-1",
      "role": "user",
      "content": "Hello"
    },
    {
      "id": "msg-2",
      "role": "assistant",
      "content": "Hi there!"
    }
  ]
}

Send Message (SSE Stream)

POST /chats/{chatId}/messages

Body:

{
  "prompt": "What plays worked well last game?"
}

Response: Server-Sent Events stream

data: {"type": "chunk", "text": "Based on"}
data: {"type": "chunk", "text": " your session"}
data: {"type": "chunk", "text": " data..."}
data: {"type": "done"}

Pin/Unpin Chat

POST /chats/{chatId}/pin

Archive Chat

POST /chats/{chatId}/archive

Update Chat Title

POST /chats/{chatId}/update-title

Body:

{
  "title": "New Chat Title"
}

Delete Chat

DELETE /chats/{chatId}

Embeddings

List Embeddings

GET /embedding/data

Query params: - limit - Max results (default: 100) - offset - Pagination offset

Upload Embedding

POST /embedding/upload
Content-Type: multipart/form-data

Form data: - file - File to upload

Search by Text

GET /embedding/search

Query params: - query - Search text

Search by Filename

GET /embedding/search-by-file

Query params: - filename - Filename to match - limit - Max results

Search Similar Content

GET /embedding/search-similar-content

Query params: - contentType - Content type filter - footballRelated - Boolean filter

Get Embedding

GET /embedding/{embeddingId}

Get Embedding Media

GET /embedding/{embeddingId}/media

Returns: Binary blob (image, video, etc.)

Delete Embedding

DELETE /embedding/{embeddingId}

Training

List Jobs

GET /train/jobs

Response:

{
  "jobs": [
    {
      "id": "job-123",
      "name": "Q1 Analysis Model",
      "status": "completed",
      "createdAt": "2024-01-15T10:00:00Z"
    }
  ]
}

Start Training

POST /train

Body:

{
  "name": "Q1 Analysis Model",
  "description": "Training on Q1 game data",
  "epochs": 10,
  "learningRate": 0.001,
  "batchSize": 32
}

Get Job

GET /train/jobs/{jobId}

Get Job Status

GET /train/jobs/{jobId}/status

Response:

{
  "status": "running",
  "progress": 45,
  "metrics": {
    "loss": 0.23,
    "accuracy": 0.87,
    "epoch": 5
  }
}

Cancel Job

DELETE /train/jobs/{jobId}

Rollback Job

POST /train/rollback/{jobId}

Vision

List Cameras

GET /vision/cameras/list

Get Connected Cameras

GET /vision/cameras/connected

Get Active Camera

GET /vision/cameras/active

Change Active Camera

POST /vision/cameras/change

Body:

{
  "cameraId": "camera-123"
}

Get Detection Status

GET /vision/detection/status

Enable Detection

POST /vision/detection/enable

Disable Detection

POST /vision/detection/disable

Send Stream Frame

POST /actions/send

Query params: - streamName - Stream identifier (e.g., "webcam") - streamType - Type (e.g., "frame")

Body:

{
  "frame": "base64-encoded-jpeg",
  "timestamp": 1705315200000,
  "camera_id": "camera-123"
}