Backend Routes
Backend Routes
Section titled “Backend Routes”API endpoint definitions - REST API and WebSocket route configurations.
Overview
Section titled “Overview”The backend exposes two types of routes:
- REST API Routes (
api.go) - HTTP endpoints for CRUD operations - Channel Routes (
channels.go) - WebSocket endpoints for real-time communication
Route Files
Section titled “Route Files”| File | Purpose |
|---|---|
routes/api.go | REST API endpoints |
routes/channels.go | WebSocket endpoints |
REST API Routes
Section titled “REST API Routes”Route Groups
Section titled “Route Groups”graph TD A["/api"] --> B["/api/2.0/webcomponent"] A --> C["/api/1.0/tenants/{tenantId}"]
B --> D[WebComponent Auth] C --> E[JWT + Tenant Auth]Public Webhooks
Section titled “Public Webhooks”No authentication required:
| Method | Endpoint | Controller | Description |
|---|---|---|---|
| ANY | /webhook/{tenantId}/{webhookUuid} | WebhookCompanyExecution | Company webhook |
| ANY | /webhook/{webhookUuid} | HandleAccountWebhook | Account webhook |
| GET | /oauth/callback | HandleOAuth2Callback | OAuth2 callback |
WebComponent Routes (/api/2.0/webcomponent)
Section titled “WebComponent Routes (/api/2.0/webcomponent)”Authenticated via WebComponent middleware:
Connections:
| Method | Endpoint | Controller |
|---|---|---|
| POST | /connections | NewAttempt |
| GET | /connections/{attemptId}/test | TestConnection |
| GET | /connections/{connectionId}/check | CheckConnection |
| GET | /connections/{connectionId} | GetConnection |
Integrations:
| Method | Endpoint | Controller |
|---|---|---|
| GET | /integrations/{integrationId}/board | GetIntegrationBoard |
| POST | /integrations | InstallIntegration |
| PUT | /integrations/{integrationId} | UpdateIntegration |
| POST | /integrations/{integrationId}/execute | ExecuteIntegration |
Flows:
| Method | Endpoint | Controller |
|---|---|---|
| GET | /flows/{flowId} | FindAccountFlow |
| POST | /flows | NewAccountFlow |
| PUT | /flows/{flowId} | UpdateAccountFlow |
| DELETE | /flows/{flowId} | DeleteAccountFlow |
| GET | /flows/{flowId}/intent | AccountIntentExecution |
| GET | /flows-schemas | ListAccountFlowsWithSchemas |
Flow Version Control:
| Method | Endpoint | Controller |
|---|---|---|
| GET | /flows/{flowId}/commits | ListAccountFlowCommits |
| POST | /flows/{flowId}/commits | NewAccountFlowCommit |
| GET | /flows/{flowId}/commits/{hash} | GetAccountFlowCommit |
| GET | /flows/{flowId}/branches | ListAccountFlowBranches |
| POST | /flows/{flowId}/branches | NewAccountFlowBranch |
| POST | /flows/{flowId}/checkout | CheckoutAccountFlow |
| POST | /flows/{flowId}/restore | RestoreAccountFlow |
Data Storage:
| Method | Endpoint | Controller |
|---|---|---|
| GET | /data-store | ListDataStores |
| POST | /data-store | NewDataStore |
| PUT | /data-store/{dataStoreId} | UpdateDataStore |
| GET | /data-store/{dataStoreId}/content | GetDataStoreContent |
| GET | /data-structure | ListDataStructures |
| POST | /data-structure | NewDataStructure |
| PUT | /data-structure/{dataStructureId} | UpdateDataStructure |
| GET | /data-structure/{dataStructureId} | GetDataStructure |
Apps:
| Method | Endpoint | Controller |
|---|---|---|
| GET | /app-nodes | GetAppAccountNodes |
| POST | /apps-node/{appName} | GetAppNode |
Tenant Routes (/api/1.0/tenants/{tenantId})
Section titled “Tenant Routes (/api/1.0/tenants/{tenantId})”JWT + Tenant authentication required:
Flows:
| Method | Endpoint | Controller |
|---|---|---|
| GET | /flows/{flowId} | FindCompanyFlow |
| POST | /flows | NewCompanyFlow |
| PUT | /flows/{flowId} | UpdateCompanyFlow |
| DELETE | /flows/{flowId} | DeleteCompanyFlow |
| POST | /flows/{flowId}/run-mapper | RunMapper |
| GET | /flows/{flowId}/intent | IntentExecution |
| GET | /flows-schemas | ListCompanyFlowsWithSchemas |
Connections:
| Method | Endpoint | Controller |
|---|---|---|
| POST | /connections | NewIntegration |
| GET | /connections/{attemptId}/test | TestIntegration |
| GET | /connections/{connectionId}/check | CheckIntegration |
| GET | /connections/{integrationId} | GetIntegration |
Apps:
| Method | Endpoint | Controller |
|---|---|---|
| GET | /apps-tenant-nodes | ListAppCompanyNodes |
| POST | /apps-tenant-node/{tenantAppName} | GetTenantAppNode |
| GET | /apps-nodes | ListAppServiceNodes |
| POST | /apps-node/{appName} | GetAppNode |
| GET | /apps | ListCompanyApps |
| GET | /apps/{appId} | GetCompanyApp |
App Webhooks:
| Method | Endpoint | Controller |
|---|---|---|
| GET | /apps/{appId}/app-webhooks | GetCompanyAppWebhooks |
| GET | /app-webhooks/{appWbId} | GetCompanyAppWebhookByID |
App Actions:
| Method | Endpoint | Controller |
|---|---|---|
| GET | /apps/{appId}/app-actions | GetCompanyAppActions |
| GET | /app-actions/{appActId} | GetCompanyAppActionByID |
App Connections:
| Method | Endpoint | Controller |
|---|---|---|
| GET | /apps/{appId}/app-connections | GetCompanyAppConnections |
| GET | /app-connections/{appConnId} | GetCompanyAppConnectionByID |
WebSocket Routes
Section titled “WebSocket Routes”| Endpoint | Controller | Description |
|---|---|---|
/tenant/{tenantId}/ws | ChannelCompanyController | Company WebSocket |
/webcomponent/{accountId}/ws | ChannelAccountController | Account WebSocket |
WebSocket Message Format
Section titled “WebSocket Message Format”Client to Server:
{ "command": "start|pause|resume|stop|input", "payload": { /* command-specific data */ }}Server to Client:
{ "command": "log|progress|error|waiting|complete", "payload": { /* message data */ }}Middleware Stack
Section titled “Middleware Stack”Request │ ├─► Public Webhooks (no auth) │ ├─► /api/2.0/webcomponent │ └─► WebComponentAuthMiddleware │ └─► /api/1.0/tenants/{tenantId} ├─► JWTAuthMiddleware └─► TenantAuthMiddlewareRelated Documentation
Section titled “Related Documentation”- API Routes - Detailed API documentation
- Channel Routes - WebSocket details
- Controllers - Controller implementations