> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreflux.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Flow Fuse Api

> Client-mode REST API connectors for Node-RED and FlowFuse: read and deploy Node-RED flows through the Admin API, start and stop flows, read context, manage node modules, send MQTT data to your own HTTP In endpoints, and manage FlowFuse teams, applications, hosted instances, snapshots and devices from MQTT

Technical Preview

## Overview

Client-mode REST API connectors for Node-RED and FlowFuse: read and deploy Node-RED flows through the Admin API, start and stop flows, read context, manage node modules, send MQTT data to your own HTTP In endpoints, and manage FlowFuse teams, applications, hosted instances, snapshots and devices from MQTT.

This is one of the templates in the Node-RED (Admin API, HTTP In nodes) and FlowFuse REST API app (`node-red-and-flowfuse`). Deploy it alongside the other connectors of that app when they depend on each other (for example a token connector plus an API connector).

## Auth

Auth headers used by the template: `Authorization: Bearer {value.json.token}`.

## Template parameters

| Placeholder | Type | Description | Required |
| - | - | - | - |
| `RouteName` | string | Name of the Flow Fuse Api connector | no |
| `BaseUrl` | string | Flow Fuse Api base URL without trailing slash (e.g. [https://app.flowfuse.com](https://app.flowfuse.com)) | yes |

`BASE_ADDRESS` default: `https://app.flowfuse.com`.

## Events

| Event | Method | Endpoint | Request topic | Response topic | Payload fields |
| - | - | - | - | - | - |
| `GetPlatformSettings` | GET | `/api/v1/settings/` | `historian/flowfuse/platform-settings/get` | `historian/flowfuse/platform-settings/get/response` | none |
| `GetCurrentUser` | GET | `/api/v1/user/` | `historian/flowfuse/user/get` | `historian/flowfuse/user/get/response` | `token` |
| `ListUserTeams` | GET | `/api/v1/user/teams` | `historian/flowfuse/team/list` | `historian/flowfuse/team/list/response` | `token` |
| `GetTeam` | GET | `/api/v1/teams/{value.json.teamId}` | `historian/flowfuse/team/get` | `historian/flowfuse/team/get/response` | `teamId`, `token` |
| `GetTeamBySlug` | GET | `/api/v1/teams/slug/{value.json.slug}` | `historian/flowfuse/team-slug/get` | `historian/flowfuse/team-slug/get/response` | `slug`, `token` |
| `ListTeamApplications` | GET | `/api/v1/teams/{value.json.teamId}/applications` | `historian/flowfuse/application/list` | `historian/flowfuse/application/list/response` | `teamId`, `token` |
| `ListTeamApplicationsStatus` | GET | `/api/v1/teams/{value.json.teamId}/applications/status` | `historian/flowfuse/application-status/list` | `historian/flowfuse/application-status/list/response` | `teamId`, `token` |
| `GetApplication` | GET | `/api/v1/applications/{value.json.applicationId}` | `historian/flowfuse/application/get` | `historian/flowfuse/application/get/response` | `applicationId`, `token` |
| `ListApplicationInstances` | GET | `/api/v1/applications/{value.json.applicationId}/instances` | `historian/flowfuse/instance/list` | `historian/flowfuse/instance/list/response` | `applicationId`, `token` |
| `ListApplicationInstancesStatus` | GET | `/api/v1/applications/{value.json.applicationId}/instances/status` | `historian/flowfuse/instance-status/list` | `historian/flowfuse/instance-status/list/response` | `applicationId`, `token` |
| `GetInstance` | GET | `/api/v1/projects/{value.json.id}` | `historian/flowfuse/instance/get` | `historian/flowfuse/instance/get/response` | `id`, `token` |
| `GetInstanceStatus` | GET | `/api/v1/projects/{value.json.id}/status` | `historian/flowfuse/instance-status/get` | `historian/flowfuse/instance-status/get/response` | `id`, `token` |
| `StartInstance` | POST | `/api/v1/projects/{value.json.id}/actions/start` | `historian/flowfuse/instance/start` | `historian/flowfuse/instance/start/response` | `id`, `token` |
| `StopInstance` | POST | `/api/v1/projects/{value.json.id}/actions/stop` | `historian/flowfuse/instance/stop` | `historian/flowfuse/instance/stop/response` | `id`, `token` |
| `RestartInstance` | POST | `/api/v1/projects/{value.json.id}/actions/restart` | `historian/flowfuse/instance/restart` | `historian/flowfuse/instance/restart/response` | `id`, `token` |
| `SuspendInstance` | POST | `/api/v1/projects/{value.json.id}/actions/suspend` | `historian/flowfuse/instance/suspend` | `historian/flowfuse/instance/suspend/response` | `id`, `token` |
| `RollbackInstance` | POST | `/api/v1/projects/{value.json.id}/actions/rollback` | `historian/flowfuse/instance/rollback` | `historian/flowfuse/instance/rollback/response` | `body`, `id`, `token` |
| `GetInstanceLogs` | GET | `/api/v1/projects/{value.json.id}/logs` | `historian/flowfuse/instance-log/list` | `historian/flowfuse/instance-log/list/response` | `id`, `token` |
| `ImportInstanceFlows` | POST | `/api/v1/projects/{value.json.id}/import` | `historian/flowfuse/instance-flows/import` | `historian/flowfuse/instance-flows/import/response` | `body`, `id`, `token` |
| `ListInstanceSnapshots` | GET | `/api/v1/projects/{value.json.id}/snapshots/` | `historian/flowfuse/snapshot/list` | `historian/flowfuse/snapshot/list/response` | `id`, `token` |
| `CreateInstanceSnapshot` | POST | `/api/v1/projects/{value.json.id}/snapshots/` | `historian/flowfuse/snapshot/create` | `historian/flowfuse/snapshot/create/response` | `body`, `id`, `token` |
| `ListTeamDevices` | GET | `/api/v1/teams/{value.json.teamId}/devices/` | `historian/flowfuse/device/list` | `historian/flowfuse/device/list/response` | `teamId`, `token` |
| `ListApplicationDevices` | GET | `/api/v1/applications/{value.json.applicationId}/devices` | `historian/flowfuse/application-device/list` | `historian/flowfuse/application-device/list/response` | `applicationId`, `token` |
| `GetDevice` | GET | `/api/v1/devices/{value.json.deviceId}` | `historian/flowfuse/device/get` | `historian/flowfuse/device/get/response` | `deviceId`, `token` |

## Deploy

Get the template card (JSON with `template` and `metadata`) from the broker, then deploy the connector:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
mosquitto_pub -t '$SYS/Coreflux/Command' -m "-routeCode FLOW_FUSE_API"
```

The deployable connector from the REST API app, with `BASE_ADDRESS` already filled in:

```lot theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
DEFINE ROUTE FlowFuseApi WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://app.flowfuse.com"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '30'
        WITH DEFAULT_CONTENT_TYPE "application/json"
    ADD EVENT GetPlatformSettings
        WITH SOURCE_TOPIC "historian/flowfuse/platform-settings/get"
        WITH DESTINATION_TOPIC "historian/flowfuse/platform-settings/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v1/settings/"
        WITH HEADERS
            ADD "Accept" "application/json"
    ADD EVENT GetCurrentUser
        WITH SOURCE_TOPIC "historian/flowfuse/user/get"
        WITH DESTINATION_TOPIC "historian/flowfuse/user/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v1/user/"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
    ADD EVENT ListUserTeams
        WITH SOURCE_TOPIC "historian/flowfuse/team/list"
        WITH DESTINATION_TOPIC "historian/flowfuse/team/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v1/user/teams"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
    ADD EVENT GetTeam
        WITH SOURCE_TOPIC "historian/flowfuse/team/get"
        WITH DESTINATION_TOPIC "historian/flowfuse/team/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v1/teams/{value.json.teamId}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
    ADD EVENT GetTeamBySlug
        WITH SOURCE_TOPIC "historian/flowfuse/team-slug/get"
        WITH DESTINATION_TOPIC "historian/flowfuse/team-slug/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v1/teams/slug/{value.json.slug}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
    ADD EVENT ListTeamApplications
        WITH SOURCE_TOPIC "historian/flowfuse/application/list"
        WITH DESTINATION_TOPIC "historian/flowfuse/application/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v1/teams/{value.json.teamId}/applications"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
    ADD EVENT ListTeamApplicationsStatus
        WITH SOURCE_TOPIC "historian/flowfuse/application-status/list"
        WITH DESTINATION_TOPIC "historian/flowfuse/application-status/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v1/teams/{value.json.teamId}/applications/status"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
    ADD EVENT GetApplication
        WITH SOURCE_TOPIC "historian/flowfuse/application/get"
        WITH DESTINATION_TOPIC "historian/flowfuse/application/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v1/applications/{value.json.applicationId}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
    ADD EVENT ListApplicationInstances
        WITH SOURCE_TOPIC "historian/flowfuse/instance/list"
        WITH DESTINATION_TOPIC "historian/flowfuse/instance/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v1/applications/{value.json.applicationId}/instances"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
    ADD EVENT ListApplicationInstancesStatus
        WITH SOURCE_TOPIC "historian/flowfuse/instance-status/list"
        WITH DESTINATION_TOPIC "historian/flowfuse/instance-status/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v1/applications/{value.json.applicationId}/instances/status"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
    ADD EVENT GetInstance
        WITH SOURCE_TOPIC "historian/flowfuse/instance/get"
        WITH DESTINATION_TOPIC "historian/flowfuse/instance/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v1/projects/{value.json.id}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
    ADD EVENT GetInstanceStatus
        WITH SOURCE_TOPIC "historian/flowfuse/instance-status/get"
        WITH DESTINATION_TOPIC "historian/flowfuse/instance-status/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v1/projects/{value.json.id}/status"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
    ADD EVENT StartInstance
        WITH SOURCE_TOPIC "historian/flowfuse/instance/start"
        WITH DESTINATION_TOPIC "historian/flowfuse/instance/start/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/api/v1/projects/{value.json.id}/actions/start"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
        WITH BODY "{}"
    ADD EVENT StopInstance
        WITH SOURCE_TOPIC "historian/flowfuse/instance/stop"
        WITH DESTINATION_TOPIC "historian/flowfuse/instance/stop/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/api/v1/projects/{value.json.id}/actions/stop"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
        WITH BODY "{}"
    ADD EVENT RestartInstance
        WITH SOURCE_TOPIC "historian/flowfuse/instance/restart"
        WITH DESTINATION_TOPIC "historian/flowfuse/instance/restart/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/api/v1/projects/{value.json.id}/actions/restart"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
        WITH BODY "{}"
    ADD EVENT SuspendInstance
        WITH SOURCE_TOPIC "historian/flowfuse/instance/suspend"
        WITH DESTINATION_TOPIC "historian/flowfuse/instance/suspend/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/api/v1/projects/{value.json.id}/actions/suspend"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
        WITH BODY "{}"
    ADD EVENT RollbackInstance
        WITH SOURCE_TOPIC "historian/flowfuse/instance/rollback"
        WITH DESTINATION_TOPIC "historian/flowfuse/instance/rollback/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/api/v1/projects/{value.json.id}/actions/rollback"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
        WITH BODY "{value.json.body}"
    ADD EVENT GetInstanceLogs
        WITH SOURCE_TOPIC "historian/flowfuse/instance-log/list"
        WITH DESTINATION_TOPIC "historian/flowfuse/instance-log/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v1/projects/{value.json.id}/logs"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
    ADD EVENT ImportInstanceFlows
        WITH SOURCE_TOPIC "historian/flowfuse/instance-flows/import"
        WITH DESTINATION_TOPIC "historian/flowfuse/instance-flows/import/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/api/v1/projects/{value.json.id}/import"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
        WITH BODY "{value.json.body}"
    ADD EVENT ListInstanceSnapshots
        WITH SOURCE_TOPIC "historian/flowfuse/snapshot/list"
        WITH DESTINATION_TOPIC "historian/flowfuse/snapshot/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v1/projects/{value.json.id}/snapshots/"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
    ADD EVENT CreateInstanceSnapshot
        WITH SOURCE_TOPIC "historian/flowfuse/snapshot/create"
        WITH DESTINATION_TOPIC "historian/flowfuse/snapshot/create/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/api/v1/projects/{value.json.id}/snapshots/"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
        WITH BODY "{value.json.body}"
    ADD EVENT ListTeamDevices
        WITH SOURCE_TOPIC "historian/flowfuse/device/list"
        WITH DESTINATION_TOPIC "historian/flowfuse/device/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v1/teams/{value.json.teamId}/devices/"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
    ADD EVENT ListApplicationDevices
        WITH SOURCE_TOPIC "historian/flowfuse/application-device/list"
        WITH DESTINATION_TOPIC "historian/flowfuse/application-device/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v1/applications/{value.json.applicationId}/devices"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
    ADD EVENT GetDevice
        WITH SOURCE_TOPIC "historian/flowfuse/device/get"
        WITH DESTINATION_TOPIC "historian/flowfuse/device/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v1/devices/{value.json.deviceId}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
```

Deploy it with `-addRoute` (do not include `ADD METADATA`).

## Usage example

Call `GetPlatformSettings` by publishing a JSON payload to its request topic, and read the reply on the response topic:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
mosquitto_sub -t 'historian/flowfuse/platform-settings/get/response' &
mosquitto_pub -t 'historian/flowfuse/platform-settings/get' -m '{}'
```

## Related

* [REST API Connectors](/latest/lot-language/routes/rest-api-routes)
* [REST API Apps catalog](/latest/lot-language/routes/rest-api-apps)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.