# flespi Streams API

**Canonical:** https://apis.io/apis/flespi/flespi-streams-api/  
**Provider:** flespi — https://apis.io/providers/flespi/  
**Base URL:** https://flespi.io/gw  
**Documentation:** https://flespi.io/docs/#/gw

flespi Streams API is one of 11 APIs that [flespi](https://apis.io/providers/flespi/) publishes on the [APIs.io](https://apis.io/) network, described by a machine-readable OpenAPI specification. Tagged areas include Streams. The published artifact set on APIs.io includes an OpenAPI specification.

[Streams](https://flespi.com/kb/stream-forward-data-from-gateway) push messages into third-party platforms via different protocols. It is possible to subscribe a stream to incoming [messages](https://flespi.com/kb/messages-basic-information-units) received by channels or devices. Streams subscribed to channels forward messages with plain set of parameters, as reported by the device. Streams subscribed to devices forward messages that are enriched with additional device-specific parameters, like device.id, device.name and also this messages can be transformed with [plugins](https://flespi.com/kb/plugins-functionality-extensions-for-flespi-devices). If the stream is subscribed to both device and channel simultaneously stream will forward only device message and ignore plain message from the channel. Each stream has persistent message queue that guarantees message delivery. You can control for how long you want to buffer messages in the stream in case the target is unreachable via the **queue_ttl** parameter. If **blocked** attribute is not zero, the stream message buffer is full and blocked for new messages. Usually this is because used space for stream buffer exceeded the [account limitations](https://flespi.com/kb/how-to-control-account-limitations). To unblock the stream buffer, first check if the stream target receives messages from the stream and if it does, set lower 'queue_ttl' attribute for auto-cleanup. The actual buffer cleanup may take few minutes. List of available stream protocols you can retrieve with [GET /gw/stream-protocols/all](https://flespi.io/docs/#/gw/protocols/get_stream_protocols_stream_protocols_selector) API call. Configuration within each stream instance should match the configuration schema defined for corresponding stream protocols. To stay current with stream protocol updates, subscribe to 'flespi/message/gw/stream-protocols/{protocol-id}/changelog' MQTT topic delivering any changes published in the stream protocol [changelog](https://forum.flespi.com/t/changelog). Whenever you need to troubleshoot stream operation you can investigate raw traffic between flespi stream and its target server. You can fetch traffic packets via API or just use flespi.io panel for this. On 'Logs' tab there is TRAFFIC button and also from each log record you can navigate to associated raw traffic exchange via context menu command. All stream modification operations are recorded to the common [logs subsystem](https://flespi.io/docs/#/platform/logs). In logs you will see corresponding log records for stream connection attempts, disconnections and also all messages deliveries in batches. ###### Stream logs Stream log records can contain following possible event codes: Event code | Description -----|------ 1|stream was created via REST API 2|stream was updated via REST API 3|stream was deleted via REST API 20|stream was blocked, see [customer](https://flespi.io/docs/#/platform/customer) for more information 21|stream was unblocked, see [customer](https://flespi.io/docs/#/platform/customer) for more information 401|stream connected successfully 402|stream has lost connection 403|stream failed to deliver messages 405|stream successfully sent the message 406|stream skipped the message 407|stream connecting 410|new subscription was created for stream 411|stream subscription was updated 412|stream subscription was deleted 420|stream was subscribed for device messages 422|stream was unsubscribed from device messages 430|stream was subscribed for channel messages 432|stream was unsubscribed from channel messages 433|stream subscribed to group 434|stream unsubscribed from group 435|geofence was added to stream 436|geofence was removed from stream For event_code=405 which means stream successfully sent a message to remote target in the log record you can find additional important fields: * ident - ident of the device whose message was sent via the stream * message_timestamp - timestamp of the original message sent via stream * device_id - id of flespi device whose message was sent via the stream (present only if the stream was assigned to device) * ack_latency - how much time it took to process the batch from the moment stream received messages until remote server acknowledged their reciept; * data - any extra data associated with message processing by the stream, optional event_code=406 which means that the message was skipped for some reason and was not sent via the stream, has the same fields as event_code=405 and is supplemented by the fields: * reason - the reason why the message was skipped * data - any extra data associated with message processing by the stream, optional If you have a stream with growing queue buffer check for growing or large ack_latency which may indicate that your server is unable to process messages from stream in time. You may lower batch configuration for some streams in order to attempt better throughput of your server. Or the best will be to look into your server code and remove any blocking operations. Stream will send next batch only after acknowledgement from your server. For event_code=403, when stream encountered problems during connection, protocol errors or during HTTP POST messages operation, the "error_code" field will contain corresponding error code depending on type of stream: * For HTTP streams it will contain HTTP response codes (if target server responses not 200 HTTP code), or may be -1 or -2 (see below). * For MQTT streams it will contain MQTT_CONNECT response code when positive or reflect TCP/SSL connection error when negative. * Wialon retranslator stream type has a single error code (1) - if it is disconnected. The possible values for the "error_code" field are: Error code | Description -----|------ -99|SSL certificate error -2|request sent but no response received -1|failed to connect 1|unacceptable protocol version 2|identifier rejected 3|server unavailable 4|bad username or password 5|connection not authorized For event_code=20, the log record contains the block_code, which is the reason of stream blocking. When blocked due to exceeded storage size (block_code=4), which is the size of the intermediate buffer, the stream stops receiving new messages but continues sending them to the target system. It will be automatically unblocked when the size of the buffer goes below the specified limits. For event_code=1,2,3 that are recorded when you create, update or delete the stream using REST API each record contains the following standard fields: Field name | Description --------|---------- http_data | original request parameters supplied by the caller; applicable for POST and PUT operations new | item's data with default fields after operation; applicable for POST and PUT operations old | item's data with default fields prior to operation; applicable for DELETE and PUT operations token_id | token ID used to authorize the HTTP request host | IP address from which HTTP request was received

## Operations (27)

| Method | Path | Summary |
|---|---|---|
| GET | `/stream-protocols/{stream-protocols.selector}` | Fetch available stream protocols |
| GET | `/stream-protocols/{stream-protocols.selector}/changelog-posts` | Fetch changelog posts of stream protocols |
| POST | `/streams` | Create new stream |
| DELETE | `/streams/{stream.selector}` | Delete selected streams |
| GET | `/streams/{stream.selector}` | List available streams |
| PATCH | `/streams/{stream.selector}` | Patch item properties |
| PUT | `/streams/{stream.selector}` | Modify stream properties |
| DELETE | `/streams/{stream.selector}/channels/{stream.channels.selector}` | Unsubscribe stream from channels |
| GET | `/streams/{stream.selector}/channels/{stream.channels.selector}` | List channels to which stream is subscribed |
| POST | `/streams/{stream.selector}/channels/{stream.channels.selector}` | Subscribe stream to channel messages |
| DELETE | `/streams/{stream.selector}/devices/{stream.devices.selector}` | Unsubscribe stream from devices |
| GET | `/streams/{stream.selector}/devices/{stream.devices.selector}` | List devices to which stream is subscribed |
| POST | `/streams/{stream.selector}/devices/{stream.devices.selector}` | Subscribe stream to device messages |
| PUT | `/streams/{stream.selector}/devices/{stream.devices.selector}` | Modify device data for stream |
| DELETE | `/streams/{stream.selector}/geofences/{stream.geofences.selector}` | Unassign geofences from stream |
| GET | `/streams/{stream.selector}/geofences/{stream.geofences.selector}` | Retrieve geofences in stream |
| POST | `/streams/{stream.selector}/geofences/{stream.geofences.selector}` | Assign geofences to stream |
| PUT | `/streams/{stream.selector}/geofences/{stream.geofences.selector}` | Modify geofence data for stream |
| DELETE | `/streams/{stream.selector}/groups/{stream.groups.selector}` | Unsubscribe stream from group |
| GET | `/streams/{stream.selector}/groups/{stream.groups.selector}` | List groups to which stream is subscribed |
| POST | `/streams/{stream.selector}/groups/{stream.groups.selector}` | Subscribe stream to group of devices |
| GET | `/streams/{stream.selector}/logs` | Retrieve stream logs |
| GET | `/streams/{stream.selector}/logs/calculate` | Calculate intervals from stream logs |
| POST | `/streams/{stream.selector}/logs/calculate` | Calculate intervals from stream logs |
| DELETE | `/streams/{stream.selector}/messages` | Remove all messages from the stream queue |
| POST | `/streams/{stream.selector}/messages` | Post messages to stream queue |
| GET | `/streams/{stream.selector}/packets` | Retrieve raw traffic generated by stream |

## Machine-readable artifacts (1)

- **OpenAPI** — https://artifacts.apis.io/flespi/openapi/flespi-streams-api-openapi.yml

## Other flespi APIs (10)

- [flespi Assets API](https://apis.io/apis/flespi/flespi-assets-api/)
- [flespi Calculators API](https://apis.io/apis/flespi/flespi-calculators-api/)
- [flespi Changelog API](https://apis.io/apis/flespi/flespi-changelog-api/)
- [flespi Channels API](https://apis.io/apis/flespi/flespi-channels-api/)
- [flespi Devices API](https://apis.io/apis/flespi/flespi-devices-api/)
- [flespi Geofences API](https://apis.io/apis/flespi/flespi-geofences-api/)
- [flespi Groups API](https://apis.io/apis/flespi/flespi-groups-api/)
- [flespi Modems API](https://apis.io/apis/flespi/flespi-modems-api/)
- [flespi Plugins API](https://apis.io/apis/flespi/flespi-plugins-api/)
- [flespi Protocols API](https://apis.io/apis/flespi/flespi-protocols-api/)

## Tags

Streams

## Use this from code or an agent

- **REST, no key:** `GET https://apis.io/api/v1/providers/flespi` returns the provider's full profile as JSON.
- **MCP:** `https://apis.io/mcp` (Streamable HTTP) — search the catalog, read any provider, compare providers, check agent readiness.
- **Free API key** for catalog-wide search, ratings and comparisons: sign in with GitHub, Google or LinkedIn at https://apis.io/developer/account/ (plans: https://apis.io/developer/plans/).

---

Profiled by [API Evangelist](https://apievangelist.com) and published on [APIs.io](https://apis.io/apis/flespi/flespi-streams-api/). The API's provider profile, Kin Score and agent-readiness rating are at https://apis.io/providers/flespi/.
