Skip to main content

API Overview

UI Bridge exposes a REST API for programmatic UI control.

Base URL​

The API is available at:

http://localhost:9876/ui-bridge

Or your configured apiPath (e.g., /api/ui-bridge for Next.js).

Response Format​

All responses follow this format:

{
"success": true,
"data": { ... },
"timestamp": 1234567890
}

Error responses:

{
"success": false,
"error": "Error message",
"code": "ERROR_CODE",
"timestamp": 1234567890
}

Error Codes​

CodeDescription
NOT_FOUNDElement or resource not found
INVALID_REQUESTInvalid request parameters
ACTION_FAILEDAction execution failed
TIMEOUTOperation timed out
INTERNAL_ERRORServer error

Endpoints Summary​

Control API​

MethodEndpointDescription
GET/control/elementsList registered elements
GET/control/element/:idGet element details
GET/control/element/:id/stateGet element state
POST/control/element/:id/actionExecute action
GET/control/componentsList components
GET/control/component/:idGet component details
POST/control/component/:id/action/:actionIdExecute component action
POST/control/discoverDiscover elements
GET/control/snapshotGet full snapshot

Workflow API​

MethodEndpointDescription
GET/control/workflowsList workflows
GET/control/workflow/:idGet workflow details
POST/control/workflow/:id/runRun workflow
GET/control/workflow/:id/statusGet run status

Render Log API​

MethodEndpointDescription
GET/render-logGet log entries
POST/render-log/snapshotCapture snapshot
DELETE/render-logClear log

Debug API​

MethodEndpointDescription
GET/debug/action-historyGet action history
GET/debug/metricsGet metrics
POST/debug/highlight/:idHighlight element

AI API​

MethodEndpointDescription
POST/ai/executeExecute natural language action
POST/ai/searchSearch elements by criteria
POST/ai/assertAssert element state
POST/ai/assert-batchBatch assertions
GET/ai/snapshotGet semantic snapshot
GET/ai/summaryGet page summary
POST/ai/diffGet semantic diff
POST/ai/intent/executeExecute an intent
POST/ai/intent/findFind matching intents
GET/ai/intentsList available intents
POST/ai/intent/registerRegister custom intent

State API​

MethodEndpointDescription
GET/state/activeGet active states
GET/state/allGet all states
POST/state/find-pathFind path to target states
POST/state/execute-transitionExecute a transition
GET/state/navigation-contextGet navigation context
POST/state/navigation-hintsGet navigation hints
GET/state/graphGet state graph
POST/state/discovery/enableEnable auto-discovery
POST/state/discovery/disableDisable auto-discovery
POST/state/discovery/process-renderProcess render for discovery
GET/state/exportExport state machine

Health​

MethodEndpointDescription
GET/healthServer health check

Authentication​

UI Bridge doesn't include built-in authentication. Implement it at the server level:

# Example with Bearer token
import requests

headers = {
'Authorization': 'Bearer your-token',
'Content-Type': 'application/json'
}

response = requests.post(
'http://localhost:9876/ui-bridge/control/element/btn/action',
headers=headers,
json={'action': 'click'}
)

Rate Limiting​

No built-in rate limiting. Implement at the server/proxy level if needed.

CORS​

CORS is off unless you ask for it. Any truthy cors value turns it on:

await createStandaloneServer(handlers, { cors: true });

The standalone server treats cors as a boolean switch and always answers Access-Control-Allow-Origin: *. Only the Express adapter honours a CORSOptions object with specific origins:

app.use('/ui-bridge', uiBridgeMiddleware(handlers, {
cors: {
origin: ['http://localhost:3000'],
credentials: true,
},
}));