Skip to main content

Overview

The AI Studio mobile sync API connects AgentLab OS to the AI Studio mobile dashboard in both directions. It exposes four endpoints:
  • GET /api/sync/state exports the live operational state of AgentLab OS to your mobile dashboard.
  • POST /api/sync/ingest ingests roaming and field data (leads, voice notes, observations, quick tasks) into AgentLab OS.
  • POST /api/sync/action executes remote actions such as triggering a workflow or approving a paused run.
  • POST /api/aistudio/webhook/register registers a mobile callback URL so AgentLab OS pushes live updates back to AI Studio.
Use this API when you capture data or need to control workflows away from your desk. Each /api/sync/* endpoint is also available under an /api/aistudio/* alias (/api/aistudio/state, /api/aistudio/ingest, /api/aistudio/action). Both paths call the same handler.

Authentication

The tenant middleware scopes requests to a workspace:
  • Send a Bearer JWT in the Authorization header. AgentLab resolves the workspace from the token’s email claim.
  • Without a token, send an X-Workspace-Id header to select a workspace directly. If the header is omitted, requests fall back to the default workspace.

Export operational state

GET /api/sync/state returns a snapshot of the workspace for the mobile dashboard: system health, workflow metrics, deployed workflows, runs paused for approval, recent audit logs, and the last 10 roaming ingestions.
Response (200):
Poll this endpoint for a manual sync, or register a webhook (below) to receive pushes instead. The endpoint returns 500 if the state cannot be compiled.

Ingest roaming data

POST /api/sync/ingest records mobile-captured data in AgentLab OS. AgentLab writes every ingestion to the audit log and can optionally trigger a workflow run.
Response (201):
status is ingested when no workflow was triggered and routed_to_workflow when the entry started a run. After each ingestion, AgentLab dispatches a ROAMING_DATA_INGESTED event to all registered mobile webhooks for the workspace.

Execute remote actions

POST /api/sync/action runs a command against the workspace from the mobile dashboard. Pass an action field plus the parameters that action requires:
Response (200):
The endpoint returns 400 for an unknown action or a missing required field, and 503 if the database is unavailable.

Register a mobile webhook

POST /api/aistudio/webhook/register subscribes a callback URL to workspace events so AgentLab pushes updates to your mobile dashboard without polling.
Response (201):
AgentLab delivers events as JSON POSTs to the registered URL:
The endpoint returns 400 if endpointUrl is missing or does not start with http.
AgentLab holds webhook subscriptions in server memory. Re-register your endpoint after a server restart.