API Reference

TrackerAI API

Integrate veterinary AI directly into your applications. Authenticate with your API key and call POST /analyse for one-shot clinical analysis, or POST /telemetry for longitudinal monitoring.

Authentication

All API requests must include an X-API-Key header with a valid API key. Generate one from the API Keys page.

http
X-API-Key: trai_sk_YOUR_KEY_HERE

API key usage is counted against your account's daily quota, same as web app usage.

Base URL

text
https://tracker--trackerai-backend-fastapi-app.modal.run/api/v1

Endpoint

POST/api/v1/analyseRun a veterinary analysis

Request body

FieldTypeRequiredDescription
model_type"completion"|"reasoning"|"behavioral"YesModel to use. "completion" and "reasoning" use the same input schema; "behavioral" requires behavioral_subtype.
behavioral_subtype"collar"|"clinical"NoRequired when model_type is "behavioral". Selects wearable-sensor or clinical-history schema.
chat_idintegerNoIf provided, appends the message to an existing chat. Must be owned by the authenticated user and have the same model_type.
input_dataobjectYesModel-specific input fields. See schemas below.

input_data schemas

FieldTypeRequiredDescription
speciesstringYesAnimal species, e.g. 'Canine', 'Feline'
breedstringYesBreed name, e.g. 'Labrador Retriever'
agestringYesAge with units, e.g. '3 years', '6 months'
sexstringYesSex and reproductive status, e.g. 'Male neutered'
weightstringYesBody weight with units, e.g. '28 kg'
clinical_historystringYesFree-text presenting complaint and relevant history

Response (200)

FieldTypeRequiredDescription
chat_idintegerYesID of the chat record created or updated
message_idintegerYesID of the assistant message created
output.summarystringYes1-2 sentence clinical summary
output.clinical_reasoningstring | nullYesDetailed reasoning (reasoning model only)
output.differentialsDifferential[]YesUp to 5 differential diagnoses
output.confidence_level"low"|"moderate"|"high"YesModel's overall confidence
output.emergency_flagbooleanYesTrue only if objective markers indicate immediate danger
output.emergency_justificationstring | nullYesRequired if emergency_flag is true
output.recommended_workupstring[]YesUp to 8 recommended diagnostic steps
output.initial_managementstring[]YesInitial management steps
output.prognosisstringYesPrognosis statement
output.disclaimerstringYesStandard clinical disclaimer
emergency_flagbooleanYesTop-level emergency flag (mirrors output.emergency_flag)
confidence_levelstringYesTop-level confidence level
retry_countintegerYesNumber of self-consistency retries used

Code examples

curl
curl -X POST https://tracker--trackerai-backend-fastapi-app.modal.run/api/v1/analyse \
  -H "X-API-Key: trai_sk_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "model_type": "completion",
    "input_data": {
      "species": "Canine",
      "breed": "Labrador Retriever",
      "age": "4 years",
      "sex": "Male neutered",
      "weight": "32 kg",
      "clinical_history": "Acute onset vomiting x 3 episodes in 12h. Inappetent. No diarrhoea. Up to date on vaccinations."
    }
  }'

Longitudinal Monitoring (Telemetry)

Stream biomechanical / behavioural observations for a patient over time. TrackerAI maintains per-patient baselines, detects trends and drift, and returns a longitudinal analysis. The POST /telemetry endpoint accepts an X-API-Key or Bearer token; the patient endpoints below use a Bearer session token.

POST/api/v1/telemetryIngest one observation

Request body

FieldTypeRequiredDescription
schema_versionstringNoContract version. Default "petgym.telemetry.v1".
patientobjectYesPatient signalment (see below).
observationobjectYesThe reading (see below).
analysebooleanNoRun the longitudinal analysis immediately and return it. Default true.
FieldTypeRequiredDescription
external_idstringYesYour patient reference. Maps to (or creates) a TrackerAI patient under your account.
speciesstringYese.g. 'Canine', 'Feline'
breedstringNoBreed name
sexstringNoSex
neuter_statusstringNo'Neutered' or 'Intact'
date_of_birthstring (ISO)NoUsed to derive age
weight_kgnumberNoBody weight in kg
namestringNoDisplay name
FieldTypeRequiredDescription
recorded_atstring (ISO 8601)YesTimestamp of the reading.
external_idstringNoIdempotency key — a repeat returns the existing observation.
session_type"rehab_session"|"daily_monitoring"|"post_op_check"|"baseline_capture"|"ad_hoc"NoContext of the reading. Default 'ad_hoc'.
source"petgym_device"|"wearable_collar"|"video_system"|"manual_entry"NoWhere the data came from.
deviceobjectNo{ device_id, firmware_version } — provenance.
processingobjectNo{ pipeline_version, processed_at } — biomechanics provenance.
metricsMetric[]NoList of measurements (item shape below).
eventsstring[]NoDiscrete observations, e.g. 'completed 8/10 reps'.
notesstringNoFree-text clinician/owner notes.

Response (200)

FieldTypeRequiredDescription
patient_idintegerYesTrackerAI patient id.
observation_idintegerYesStored observation id.
createdbooleanYesFalse if an idempotent duplicate was found.
analysisobject | nullYesLongitudinalAnalysisOutput when analyse=true: summary, trend_assessment, metric_trends, clinical_reasoning, drift_detected, alerts, recommended_actions, confidence_level…
bash
curl -X POST https://tracker--trackerai-backend-fastapi-app.modal.run/api/v1/telemetry \
  -H "X-API-Key: trai_sk_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "schema_version": "petgym.telemetry.v1",
    "patient": {
      "external_id": "PG-10293",
      "species": "Canine",
      "breed": "Labrador Retriever",
      "sex": "Male", "neuter_status": "Neutered", "weight_kg": 31.2
    },
    "observation": {
      "external_id": "OBS-55821",
      "recorded_at": "2026-06-04T09:00:00Z",
      "session_type": "rehab_session",
      "source": "petgym_device",
      "metrics": [
        { "key": "mobility_score", "value": 72, "unit": "index_0_100", "confidence": 0.9 },
        { "key": "gait_symmetry_index", "value": 0.82, "unit": "ratio" }
      ],
      "events": ["completed 8/10 reps"],
      "notes": "Owner reports stiffness after rest."
    },
    "analyse": true
  }'

Patient & analysis endpoints

POST/telemetryIngest one observation (creates/links the patient, updates baselines, runs the analysis). API key or Bearer.
GET/patientsList your monitored patients.
POST/patientsCreate a patient.
GET/patients/{id}Get a patient.
DELETE/patients/{id}Delete a patient and all of its data.
GET/patients/{id}/observationsList a patient's observations.
POST/patients/{id}/observationsAdd one observation to a known patient (runs the analysis).
GET/patients/{id}/timelineMetric series + full analysis & observation history + open alerts.
GET/patients/{id}/alertsList open alerts.
POST/patients/{id}/alerts/{alertId}/ackAcknowledge an alert.
POST/patients/{id}/analyseRe-run the analysis on the latest observation.

Error codes

401

Unauthorized

Missing or invalid API key / Bearer token.

403

Forbidden

Account is inactive, or API access is not enabled for your account.

404

Not Found

Patient or resource not found, or not owned by your account.

422

Unprocessable Entity

Input validation failed. Check the error detail for which field is missing or invalid.

429

Too Many Requests

Daily quota exhausted. Resets at midnight UTC.

500

Internal Server Error

Analysis pipeline failed. Retry once; if persistent, contact support.