Skip to content

API Reference

Reference for the Synthcore API — VM management gateway and VM reporter endpoints for authentication, lifecycle, telemetry, and commands.

API Reference

Synthcore exposes two API gateways as Supabase Edge Functions:

  • VM API (vm-api) — Dashboard-to-VM operations: create, start, stop, delete, and check status. Authenticated with Supabase JWT.
  • VM Reporter (vm-reporter) — VM-to-platform telemetry: health snapshots, metrics, commands, messages, and approvals. Authenticated with per-project reporter tokens.

VM API

All VM lifecycle operations — creating, starting, stopping, and deleting instances — go through a single endpoint.

Base URL:

POST https://<your-supabase-url>/functions/v1/vm-api

Authentication

All requests require a valid Supabase JWT in the Authorization header:

Authorization: Bearer <your-jwt-token>

The gateway verifies your token against Supabase Auth and checks that your user account has access to the requested resource:

  • Create requires membership in the target organization
  • Start / Stop / Delete / Status require membership in the target project

Requests with missing or invalid tokens receive a 401 Unauthorized response. Requests where the user lacks access receive 403 Forbidden.


Rate Limits

The gateway enforces 20 requests per minute per authenticated user. If you exceed this limit, the response includes a Retry-After header indicating when you can retry:

{ "error": "Rate limit exceeded. Please try again later." }

Status code: 429 Too Many Requests


Request Format

All requests are POST with a JSON body containing an action field and action-specific parameters:

{
  "action": "start",
  "project_id": "uuid-here"
}

Endpoints

Create a Project

Provisions a new VM instance and adds you as the project owner.

{
  "action": "create",
  "organization_id": "uuid",
  "name": "my-project",
  "region": "australiaeast",
  "vm_size": "Standard_D2s_v3"
}
ParameterRequiredDefaultDescription
organization_idYesOrganization to create the project under
nameYesDisplay name for the project
regionNoaustraliaeastCloud region for the VM
vm_sizeNoStandard_D2s_v3VM instance size

Response:

{
  "success": true,
  "data": {
    "project_id": "generated-uuid",
    "status": "provisioning"
  }
}

Provisioning typically takes 3–5 minutes. The project status transitions from provisioning to active once the VM is ready.


Start a VM

Starts a stopped VM. The project must be in stopped status.

{
  "action": "start",
  "project_id": "uuid"
}

Response:

{
  "success": true,
  "data": {
    "project_id": "uuid",
    "status": "starting"
  }
}

Stop a VM

Stops a running VM. The project must be in active or running status.

{
  "action": "stop",
  "project_id": "uuid"
}

Response:

{
  "success": true,
  "data": {
    "project_id": "uuid",
    "status": "stopping"
  }
}

Delete a VM

Terminates and deletes a VM. The project must be stopped unless you pass force: true.

{
  "action": "delete",
  "project_id": "uuid",
  "force": false
}
ParameterRequiredDefaultDescription
project_idYesProject to delete
forceNofalseSkip the stopped-state check

Response:

{
  "success": true,
  "data": {
    "project_id": "uuid",
    "status": "deleting"
  }
}

Get VM Status

Returns the project details and last 5 activity log entries.

{
  "action": "status",
  "project_id": "uuid"
}

Response:

{
  "success": true,
  "data": {
    "project": {
      "id": "uuid",
      "name": "my-project",
      "status": "active",
      "health_status": "healthy",
      "region": "australiaeast",
      "vm_size": "Standard_D2s_v3",
      "created_at": "2026-01-15T10:00:00Z",
      "updated_at": "2026-04-01T14:30:00Z"
    },
    "recent_activity": [
      {
        "action": "vm_start_requested",
        "details": {},
        "created_at": "2026-04-01T14:30:00Z"
      }
    ]
  }
}

VM Status Lifecycle

provisioning → active ⇄ stopping → stopped → starting → active
                  ↓                     ↓
               deleting              deleting
StatusDescription
provisioningVM is being created and configured
active / runningVM is running and agents are working
stoppingShutdown in progress
stoppedVM is off — no compute charges
startingBoot in progress
deletingTermination in progress

Error Responses

All errors return a JSON object with an error field:

{ "error": "Description of what went wrong" }
Status CodeMeaning
400Bad request — missing fields, invalid action, or invalid state transition
401Unauthorized — missing or invalid JWT
403Forbidden — user lacks access to the resource
405Method not allowed — only POST is accepted
429Rate limit exceeded
500Server error

CORS

The gateway accepts requests from:

  • http://localhost:3000 and http://localhost:3001 (development)
  • https://app.synthcore.dev and https://uat.synthcore.dev (production and UAT)

Preflight OPTIONS requests are handled automatically.


VM Reporter

The VM Reporter gateway handles all telemetry and command traffic from VMs back to the platform. Each VM calls these endpoints on every agent cycle to report health, push metrics, poll for commands, and manage approvals.

Base URL:

POST https://<your-supabase-url>/functions/v1/vm-reporter/<route>

Authentication

VMs authenticate with a project-scoped reporter token, not a user JWT:

Authorization: Bearer <reporter-token>
X-Project-ID: <project-uuid>

The gateway validates the token against the database on every request. Invalid tokens receive 401 Unauthorized.


Rate Limits

100 requests per minute per project (configurable via VM_REPORTER_RATE_LIMIT environment variable). Returns 429 with Retry-After header when exceeded.


Endpoints

Health

POST /vm-reporter/health

Push a health snapshot (CPU, memory, disk, agent status).

Messages

POST /vm-reporter/messages

Log agent messages for display in the dashboard Chat tab.

Audit

POST /vm-reporter/audit

Push audit events (action logs for the activity trail).

Conflicts

POST /vm-reporter/conflicts

Report git conflict and sync statistics.

Task Metrics

POST /vm-reporter/metrics/tasks

Push task completion metrics (assigned, completed, failed, drifted counts).

Productivity Metrics

POST /vm-reporter/metrics/productivity

Push agent productivity metrics.

CLI Session Metrics

POST /vm-reporter/metrics/cli-sessions

Push CLI session tracking data.

Poll Commands

POST /vm-reporter/commands/poll

VM polls for queued commands to execute (start, stop, restart agents, etc.).

Update Command Status

POST /vm-reporter/commands/status

Report the result of a command execution back to the platform.

Create Approval Request

POST /vm-reporter/approvals

Request human approval before proceeding with an action. Creates an entry visible on the dashboard Approvals tab.

Acknowledge Approval Decision

POST /vm-reporter/approvals/ack

Report the outcome of an approval decision.


Error Responses

Status CodeMeaning
400Bad request — missing project ID, invalid JSON, or RPC error
401Unauthorized — missing or invalid reporter token
404Unknown route
405Method not allowed — only POST is accepted
429Rate limit exceeded
500Server error

Request Logging

All requests are logged to vm_reporter_request_log with project ID, route, status code, latency, and any error message. This powers the Logs tab in the dashboard.