Quickstart
Your first capture
In your page with the SDK, or from your backend with Python or cURL. The key never reaches the browser.
import { createProtocolClient } from '@neurologyca/capture'
const client = createProtocolClient({
baseUrl: '/engine', // your backend's proxy: the browser carries no token
taxonomy: { contextId: 'measurement' },
})
const session = await client.captureProtocol({
userProtocolId, protocolMechanicId, // your backend gives you the pair
source: { type: 'webcam' },
triggerAnalysis: false,
})
const [step] = session.plan.steps // Measurement: one step
await session.step(step.order).run({ durationMs: 15_000 })
const outcome = await session.stop() // the indicators: outcome.hcisimport json, os, sys, time
import requests
# Your environment's Engine URL is in your kit (ENGINE_BASE: the cURL tab calls it $ENGINE). The API key stays on your server.
ENGINE = os.environ["ENGINE_BASE"]
API_KEY = os.environ["ENGINE_API_KEY"]
r = requests.post(f"{ENGINE}/token", json={"apiKey": API_KEY})
r.raise_for_status()
token = r.json()["token"]
auth = {"Authorization": f"Bearer {token}"}export ENGINE="<engine base URL>"
export ENGINE_API_KEY="<your-api-key>"
TOKEN=$(curl -s -X POST "$ENGINE/token" \
-H "Content-Type: application/json" \
-d "{\"apiKey\":\"$ENGINE_API_KEY\"}" | jq -r .token)
EXT="quickstart-$(date +%s)"
curl -s -X POST "$ENGINE/users" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d "{\"externalId\":\"$EXT\",\"name\":\"quickstart-user\"}"