Skip to content
openlaunch
Esc
↑↓navigate↵open⌘Jpreview
On this page

API workflow

Explore authentication, device grants, action requests, custom functions and results in the shared openlaunch API.

The web console, MCP and device clients use the same command service and permission checks.

Use the generated endpoint reference for every endpoint’s request and response schema, authentication, errors and examples. Download the OpenAPI 3.1 contract for your tooling; /openapi.json is the canonical URL for the same contract. It is generated from shared request validators on each build. The site’s separate /docs-openapi.json describes its public read-only documentation JSON API.

The hosted base URL is https://www.openlaunch.dev. The reference’s Try it panel sends a real request to this service when you press Send. Supply the correct credential for the endpoint and only request an action you intend to run. It does not acquire owner sessions, create grants for an agent or automatically connect your OAuth account. Credentials stay in browser memory unless you explicitly enable the panel’s Remember setting.

End-to-end agent flow

  1. Pair a device with a separate device setup token and save its private child identity.
  2. Create an agent API connection or register and complete OAuth for your MCP host.
  3. In device Access, grant that exact connection the required functions. ChatGPT through Executor uses the Executor connection.
  4. Read /v1/devices and /v1/functions. Choose a returned device and use its exact current argument schema.
  5. Request /v1/devices/{id}/actions with a new idempotency key and bounded TTL. HTTP 202 means queued.
  6. Read /v1/actions/{id} until terminal status. Inspect the result; a firmware acknowledgment does not independently prove physical operation.

New terminal receipts include resultReceivedAt, the server timestamp of the first saved device result. Compare it with createdAt and dispatchedAt to measure queue and processing/delivery delays. Identical result retries preserve this timestamp; older receipts can omit it. Activity displays these timings. Roomba executionMs excludes network result delivery and the autonomous cycle.

The ol CLI follows this flow with ol login --agentid (or a pasted API credential), ol functions list, ol call and ol actions watch. The SDK guide shows the equivalent typed client. MCP’s stable list_functions and invoke_device_function use the same catalog and authorization.

Authentication

Management uses an authenticated owner session or explicitly delegated administrator. Google and AgentID are sign-in providers; email/password sign-in is disabled. A different identity has its own workspace unless invited into another. Raw AgentID tokens cannot authenticate to the device API or MCP. Agent MCP uses an admitted OAuth client, the correct resource audience, openlaunch:read, and a live access policy. openlaunch:act permits action requests within that policy. OAuth uses PKCE.

Device setup and agent API access use separate owner-created credentials. A device setup token (ol_sdk_…) is short-lived and attach-only; by default it expires after 10 minutes and can attach one device. An agent API connection (ol_agent_…) can have read or action access but cannot attach devices. Each attached device gets a private child credential, and function grants remain separate. Existing untyped legacy connections may retain combined behavior; do not create them for new integrations. See the SDK guide.

Device polling and result reports use a private per-device bearer credential. Never compile a device setup token into a firmware image or put it in prompts or logs. USB provisioning may temporarily retain the setup token while attachment is pending; the maintained adapters clear it after saving and verifying the child identity. Device identity files contain only the child credential. Legacy enrollment-issued credentials remain supported. Keep every credential out of source control.

Routes

Method Route Purpose
GET /healthz Service health; not a device result
GET /v1/devices Devices visible to the current principal
GET /v1/functions Granted built-in and custom functions
POST /v1/sdk/devices Attach a device using a setup token and stable request ID
POST /v1/enrollments Owner creates a 10-minute, single-use enrollment
GET /v1/device-setup-tokens Owner lists setup-purpose and eligible legacy tokens; secrets are omitted
POST /v1/device-setup-tokens Owner creates a setup token (one-device default), shown once
POST /v1/device-setup-tokens/{id}/revoke Owner revokes a setup token; an issued child credential remains valid
GET /v1/sdk-tokens Legacy alias for listing setup-purpose and eligible legacy tokens
POST /v1/sdk-tokens Legacy alias for creating a device setup token
POST /v1/sdk-tokens/{id}/revoke Legacy alias for revoking a device setup token
GET /v1/agent-connections Owner lists agent API connections; secrets are omitted
POST /v1/agent-connections Owner creates an ol_agent_ API credential, shown once
POST /v1/agent-connections/{id}/revoke Owner revokes an agent connection and its grants
POST /v1/device/{id}/manifest Device publishes implemented functions; changed manifests revoke grants
POST /v1/device/enroll Device exchanges an enrollment for its credential
GET /v1/grants Owner lists active saved grants
POST /v1/grants Owner approves agent/device/capability access
POST /v1/grants/revoke Owner revokes that agent’s access to a device
POST /v1/devices/{id}/revoke Owner revokes the device credential
POST /v1/devices/{id}/actions Request a supported capability
POST /v1/broadcasts Request an action for up to 20 devices, with a result for each
GET /v1/actions Owner lists the latest 100 action receipts
GET /v1/actions/export Owner downloads all retained action receipts
GET /v1/actions/{id} Inspect the command result
POST /v1/actions/{id}/cancel Cancel an undispatched command
POST /v1/device/{id}/heartbeat Device refreshes presence while busy; does not dispatch or extend actions
POST /v1/device/{id}/next Device polls for its next command
POST /v1/device/{id}/result Device reports success or failure
POST /v1/device/{id}/events-ticket Issue a 30-second, single-use WebSocket handshake ticket
GET /v1/device/{id}/events WebSocket connection for payload-free device wake hints
POST /mcp Stateless device MCP requests
GET /v1/oauth-clients Owner lists this workspace’s OAuth clients and registration availability
POST /v1/oauth-clients Owner registers a PKCE/consent OAuth client; optional secret returned once
POST /v1/oauth-clients/{id}/revoke Owner revokes client access, grants and queued commands
GET /v1/workspaces Verified identity lists home and joined workspaces with roles
POST /v1/workspaces/accept Verified identity accepts a one-time workspace invitation
POST /v1/workspaces/select Selects the workspace; only a browser session persists the identity default
GET /v1/workspace/agents Administrator or owner lists workspace agent members
POST /v1/workspace/invitations Administrator or owner creates a one-time ol_inv_ invitation
POST /v1/workspace/agents/{id}/revoke Administrator or owner revokes a member and its bound connections
POST /v1/cli-login/authorize Verified browser session starts an ol login --agentid PKCE exchange
POST /v1/cli-login/exchange Public exchange of the one-time code and PKCE verifier for a credential
GET /v1/access Current principal reads its effective access policy
GET /v1/access-policies Administrator or owner lists workspace access policies
POST /v1/access-policies Administrator or owner sets a member’s mode, exclusions and expiry
GET /v1/onboarding Owner or administrator reads setup readiness and next steps

OAuth client registration accepts name, one to eight exact redirectUris, public (default true), and access (act by default, or read). Callback URLs must use HTTPS or literal loopback HTTP. New clients receive all-functions access within their scope ceiling and cannot attach devices. Client secrets are excluded from persisted records, audit entries and subsequent reads. Workspace storage limits apply; registration requires a configured hosted provider.

Workspace membership and access policies

An owner or delegated administrator admits an agent as a named member with a one-time invitation. POST /v1/workspace/invitations accepts a name (1–64 characters), an optional role (operator by default, or administrator — owner only), and an optional ttlSeconds (60–3600, default 600):

{
  "name": "Test agent",
  "role": "operator",
  "ttlSeconds": 600
}

The response returns an ol_inv_ invitation token once. The signed-in agent accepts it with POST /v1/workspaces/accept; the invitation admits exactly one verified Clerk subject, cannot merge accounts by email, and an already-active member cannot use a fresh invitation to reset its role or exclusions (the request returns 409 conflict). GET /v1/workspace/agents lists members with role and revoked status, and POST /v1/workspace/agents/{id}/revoke denies a member all functions immediately, revokes any agent connection bound to it and cancels its queued work.

New connections and new members default to an all-functions access policy: every current and future workspace device and function, including newly attached devices and Home Assistant discoveries, with the connection’s read/action ceiling still enforced on top. Owners opt out by setting exclusions with POST /v1/access-policies: a mode (all or selected), excludedDevices, excludedFunctions (deviceId may be null to match a capability on every device), role and expiresAt. Exclusions apply live — newly excluded queued actions are cancelled — and a member or its child credentials cannot lift them. selected mode keeps the legacy behavior: per-device grants, which a changed device manifest still revokes. Pre-upgrade connections keep their grant-only behavior until the owner sets an explicit policy.

GET /v1/access shows the caller’s effective policy: role, mode, exclusions, delegation chain and expiry. GET /v1/onboarding reports device setup readiness, connections and next steps to an owner or administrator. Workspace selection (POST /v1/workspaces/select) persists the identity-wide default only for a verified browser session; a scoped credential receives the target without changing that default. An API credential remains bound to its original workspace; use ol login --agentid --workspace WORKSPACE_ID to mint one for another workspace.

The same management surface is available through hosted MCP tools: workspace_invite, workspace_agents, workspace_agent_revoke, workspace_list, workspace_accept, workspace_select, policy_list, policy_update, access_get and onboarding_status. Each call re-checks the live policy; only owners and live delegated administrators can write, and only the owner grants the administrator role.

Create a device setup token

An authenticated owner creates a setup token with POST /v1/device-setup-tokens:

{
  "name": "Uno setup",
  "ttlSeconds": 600,
  "deviceLimit": 1
}

The setup token uses the ol_sdk_ prefix and the response has purpose: "device-setup". It can only call the device attachment route. ttlSeconds defaults to 600 (10 minutes) and deviceLimit defaults to one; the allowed setup-token lifetime is 60–86,400 seconds and device limit is 1–20. The response includes the token once; listing tokens never returns the secret again. It cannot authenticate an agent, call MCP tools, or approve grants. Revoking or expiring it blocks future attachment with that token but does not revoke an already issued device credential. The legacy /v1/sdk-tokens create alias uses this same strict setup-only schema; old fields such as access and canAttach are not accepted for new token creation.

Create agent API credentials separately with POST /v1/agent-connections and a body containing name, optional ttlSeconds, and optional access (read or act). access defaults to act. The default lifetime is 86,400 seconds; set ttlSeconds to null to keep the credential active until revoked. Finite lifetimes are 60–2,592,000 seconds. For example:

{
  "name": "Roomba agent",
  "access": "act",
  "ttlSeconds": null
}

The response has purpose: "agent" and expiresAt is null for a non-expiring connection. The returned ol_agent_ credential can authenticate API requests but cannot attach devices. A newly created connection receives an all-functions access policy (action access to every current and future workspace function, with owner-set exclusions); an explicitly read-only connection stays read-only, and pre-upgrade connections keep their grant-only behavior until the owner sets an explicit policy. OAuth clients use the hosted OAuth flow instead. Older untyped combined connection records remain supported for compatibility; do not create new combined records.

List devices and functions

GET /v1/devices gives owners the complete device inventory. Agent responses contain only devices with currently permitted functions, and filter their capabilities and functions to the current credential’s grants and read/action scope. The same permission filter powers MCP and CLI discovery.

GET /v1/functions returns { "data": [...] } with only advertised built-in and custom functions the current credential may use. Each row has deviceId, deviceName, kind, the device’s definition (name, title, description, access, and bounded input schema), and guide. The guide contains schema-based usage notes and may include a profile-specific note only when the device kind and full function schema match a verified catalog entry. It is explanatory text, not authorization, and does not add arguments or capabilities. This route requires the same bearer token and workspace context as other agent API calls. Rows reflect current per-device grants; read-only credentials do not receive write functions. Device setup tokens cannot use this route. Use the returned definitions as the available call schema, and check each operation’s result through the action receipt APIs.

Attach a device

A device setup token sends POST /v1/sdk/devices with a function manifest and UUID request ID:

{
  "requestId": "2fd1a6d4-d177-4ec9-9f0f-e2d5ad5368d9",
  "manifest": {
    "name": "Workshop sensor",
    "kind": "custom.rp2040",
    "capabilities": ["device.health"],
    "functions": []
  }
}

The response contains deviceId and a private child credential token. Keep those in the device’s protected identity store; do not persist the setup token there. A retry must use the same request ID and identical manifest for 10 minutes to recover the same attachment. After that, inspect the device inventory before starting another request. All-functions policies cover the new device automatically unless excluded; selected-function connections still need grants.

Grant functions

An authenticated owner sends POST /v1/grants with principal, deviceId, capabilities, and optional ttlSeconds. The default is 3,600 seconds. Set ttlSeconds to null for a persistent grant that stays active until explicitly revoked. GET /v1/grants returns each grant’s expiresAt as a timestamp or null. The console’s Access view can create either kind. Revoke a grant with POST /v1/grants/revoke; revoking an agent connection also removes its grants.

Publish device functions

A device authenticates with its own credential and sends { "manifest": ... } to POST /v1/device/{id}/manifest. Its kind must match attachment. Publishing an identical manifest keeps grants intact. A changed manifest removes previous device grants, cancels queued actions and marks outstanding received actions uncertain. Selected-functions connections need updated grants; all-functions policies cover the updated catalog unless excluded. Use the SDK’s publishManifest() or adapter CLI publish command rather than copying credentials into commands.

Download activity

In the console, open Activity → Download full history. The JSON file includes all retained receipts, function arguments and results; keep it in private storage. The normal Activity list shows the latest 100 actions.

GET /v1/actions/export requires an owner session and returns { "data": { "format": "openlaunch.actions.v1", "exportedAt": 0, "actions": [] } }. exportedAt is a Unix timestamp in milliseconds. Internal idempotency metadata and device credentials are excluded. Agents cannot export owner history.

A workspace retains up to 5,000 actions within a 16 MiB logical storage budget. New actions, attachments, grants and manifest growth can reach the byte limit earlier and return HTTP 429 with storage_full. Pending actions reserve 16 KiB for their result when accepted. A full workspace still accepts results from already received actions, permits revocation and serves saved history; it does not dispatch more queued work while over budget.

Downloading is a copy. When accepting new work, the service may prune the oldest settled receipts past their command TTL to stay within count and byte budgets. Queued, received and uncertain (unknown) actions are not pruned. Durable request keys remain after pruning: retrying one returns HTTP 409 with history_pruned rather than executing again. A new key means an intentional new action. Export history you want to keep. The service can still return 429 when pending work, uncertain results or retained request keys exhaust capacity.

There is no plan-level cap on paired devices or agent connections. Device setup tokens retain their owner-selected attachment limit; broadcasts are bounded to 20 devices per request. Hosted storage, rate and pending-work limits still apply.

Request an action

{
  "capability": "led.set",
  "arguments": { "on": true },
  "idempotencyKey": "your-unique-request-id",
  "ttlSeconds": 60
}

Built-in capabilities are device.health with {}, led.set with { "on": true }, and display.text with { "text": "hello" }. A device must advertise and implement the requested capability. Pi currently reports health; Uno implements all three.

TTL is 1–300 seconds. Reuse an idempotency key only for an identical request. A conflicting duplicate is rejected. Devices poll every 10 seconds, so allow enough time for delivery.

Device wake hints

The Node adapter can request a one-use ticket with its per-device credential from /v1/device/{id}/events-ticket. The ticket expires after 30 seconds and is offered in the WebSocket Sec-WebSocket-Protocol header for /v1/device/{id}/events; it is not sent in the URL. The WebSocket sends only a small work hint, never action arguments or results. On a hint, the adapter checks for the action through the normal HTTPS poll endpoint. The Node runner keeps its 10-second HTTP polling fallback. Go polls every 10 seconds when idle, then drains queued work with a 100 ms wait after each acknowledged result. Generic Uno and ESP32 adapters poll every 10 seconds; the Roomba sketch polls every second. JSON responses include their UTF-8 byte length for embedded HTTP/1.1 connection reuse. Network, agent planning and approval delays still contribute to the time you observe.

Custom device functions

A device can advertise custom functions in its manifest with a name, title, description and input schema. Schemas accept a root object with bounded string, number, integer or boolean fields. Additional root properties and external schema references are rejected. Each manifest supports up to 64 functions for Home Assistant linked devices, 24 for Linux or 16 for other kinds, and each function up to 16 parameters; a custom function cannot replace a built-in capability.

Permitted custom functions appear as device-specific MCP tools. All-functions policies cover them automatically unless excluded. Selected-function connections require device grants. Every invocation and queued dispatch checks the current policy, so an excluded or revoked function stops working immediately.

Broadcasts

POST /v1/broadcasts accepts up to 20 device IDs and a capability request, including its arguments, idempotency key and TTL. It returns an independent action or error for each device. A broadcast is not atomic: devices can accept, reject or complete the action independently. Inspect each action result.

Responses and errors

REST success responses use { "data": ... }. Errors use { "error": { "code": "...", "message": "..." } }; validation errors also identify invalid fields. HTTP 202 means accepted into the queue, not physically completed.

Inspect the returned action ID. queued and received are intermediate states. Terminal states distinguish success, failure, cancellation and expiry; an uncertain delivered outcome must not be reported as success. See pairing and permissions for the lifecycle.

Source

Protocol schemas, command service, HTTP adapter and MCP adapter live in the same repository. See resources for current source downloads and upstream tools.

Home Assistant linked functions additionally accept bounded nested JSON objects for native service data and targets. Their MCP catalog uses stable discovery and generic invocation to avoid thousands of cached per-entity tools; every granted function remains callable.

Was this page helpful?