The "alterMqSession" property modifies an existing MQTT or MQ API session identified by the required "clientName" property. If a client with the same "clientName" is connected, it does not disconnect that session. This allows an administrator to alter session settings without disrupting a connected client.
Important You can alter the session of any client including those connected through MQTT and those connected through this MQ API. This works because the properties of MQTT and MQ API sessions are the same.
- You can set the session's properties, such as MQTT's Will Message and User Properties, which is a convenient way to centrally manage settings for all sessions.
- You can set
"temporarySession"totrueto make a session temporary. The server cleans the session after the client disconnects. A clean session resets the session state and clears its subscriptions. - It returns information about a client connection and the session's capabilities.
- You can set
"sessionStatus"to"hidden","banned","inactive", or"normal"to hide its visibility in API results and dashboard views, ban a client from connecting, mark a client as inactive, or restore a client to normal status. If omitted, the session status does not change.
To subscribe to and unsubscribe from topics, use the "subscribeToMq" action.
Note When you set the
"binaryFormat"property to"utf8"or"json", the server automatically assigns the"willPayloadFormatIndicator"property to utf8 to indicate that the payload contains UTF-8 encoded characters, such as JSON.
Request example
Maximal
{
"api": "mq",
"action": "alterMqSession",
"cleanSession": false,
"params":
{
"clientName": "a unique client identifier for MQTT or MQ API",
"temporarySession": false,
"sessionStatus": "normal | hidden | banned | inactive",
"keepAliveSeconds": 60,
"userProperties": [
{
"key": "some key",
"value": "some value"
}
],
"mqttPayloadType": "utf8",
"sessionExpiryInterval": 60,
"receiveMaximum": 1024,
"maximumPacketSize": 1024,
"topicAliasMaximum": 0,
"requestProblemInformation": true,
"requestResponseInformation": false,
"willTopic": "some/Topic/Name/",
"willQoS": 2,
"willPayload": "This message is sent when client disconnects.",
"willRetain": true,
"willContentType": "IanaMediaType or a CustomType",
"willCorrelationData": "any JSON value up to 65500 bytes",
"willPayloadFormatIndicator": "none | utf8",
"willExpirySeconds": 60,
"willDelaySeconds": 60,
"willResponseTopic": "topic/name/for/subscriber/to/respond/to",
"willUserProperties": [
{
"key": "some key",
"value": "some value"
}
],
"label": {
"group": "group name",
"name": "label name"
},
"minHealthySendRatePerMinute": 10,
"maxHealthySendRatePerMinute": 1000,
"maxHealthyBacklogRatePerMinute": 10,
"minHealthySubscribedTopicFiltersCount": 10,
"maxHealthySubscribedTopicFiltersCount": 1000,
"metadata": {}
},
"apiVersion": "1.0",
"debug": "max",
"requestId": "optionalUniqueRequestIdFromTheClient",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
Response example
Maximal
{
"authToken": "BAz72agLF4M1s8acj6kyO5fNt9QhhxnbbPT33fGPZ1Eu1DEpknYcNXGBZkQ3NBM0",
"result": {
"clientName": "client1",
"sessionStatus": "normal",
"username": "ADMIN",
"ipaddress": "127.0.0.1",
"port": 64283,
"mqttProtocol": "3.1.1",
"keepAliveSeconds": 60,
"connectionStatus": "connected",
"connectionDateTime": "2025-09-17T16:24:41",
"defaultBinaryFormat": "hex",
"defaultVariantFormat": "json",
"defaultResponseOptions": {
"binaryFormat": "hex",
"variantFormat": "json",
"dataFormat": "objects",
"numberFormat": "number"
},
"sessionType": "mqApi",
"willTopic": "some/Topic/Name/",
"willQoS": 2,
"willPayload": "This message is sent when client disconnects.",
"willRetain": true,
"metadata": {}
},
"requestId": "00000003",
}
Properties
Request properties ("params")
| Property | Description | Default | Type | Limits (inclusive) |
|---|---|---|---|---|
clientName |
The "clientName" property specifies the unique name that identifies the client to the FairCom MQ engine. |
Optional with default of ""
|
string | 0 to 65,550 bytes |
keepAliveSeconds |
The |
Optional with default of 0
|
integer | No limit |
label |
The A label is a tag that you can add to some objects, such as an MQTT topic or session. You can use list actions such as The |
Optional with default of null
|
object | "label": {
"group": "group name",
"name": "label name"
} |
|
label .group |
The The When you assign a group name to a label, the server automatically checks if the group name exists in the list of groups that the
|
Optional with default of ""
|
string | 1 to 64 bytes of UTF-8 encoded characters |
|
label .name |
The The The
|
Required - No default value | string | 1 to 64 bytes |
maxHealthyBacklogRatePerMinute |
The A connected session is healthy when its message backlog rate does not exceed the maximum. The |
Optional with default of 0
|
integer | Any positive integer |
maxHealthySendRatePerMinute |
The A connected session is healthy when its message send rate does not exceed the maximum. The |
Optional with default of 0
|
integer | Any positive integer |
maxHealthySubscribedTopicFiltersCount |
The A connected session is healthy when it has subscribed to at most the maximum number of topic filters. The A topic filter may include MQTT wildcard characters, which allows one topic filter to subscribe to many topics. The |
Optional with default of 0
|
integer | Any positive integer |
maximumPacketSize |
The |
Optional with default of 1024
|
integer | |
metadata |
The "metadata" property contains user-defined properties that add keywords and tags about the code package. The server indexes this field with a full-text index so you can search for any word or phrase to find code packages. |
Optional with default of {}
|
object | 0 or more key/value pairs |
minHealthySendRatePerMinute |
The A connected session is healthy when its message send rate exceeds the minimum. The |
Optional with default of 0
|
integer | Any positive number |
minHealthySubscribedTopicFiltersCount |
The A connected session is healthy when it has subscribed to at least the minimum number of topic filters. The A topic filter may include MQTT wildcard characters, which allows one topic filter to subscribe to many topics. The |
Optional with default of 0
|
integer | Any positive number |
mqttPayloadType |
The |
Optional with default of "binary"
|
string enum |
|
receiveMaximum |
The |
Optional with default of 1024
|
integer |
1 to 65535
|
requestProblemInformation |
The |
Optional with default of true
|
Boolean |
|
requestResponseInformation |
The |
Optional with default of false
|
Boolean |
|
sessionExpiryInterval |
The The
The
|
If "temporarySession" is true, "sessionExpiryInterval" defaults to 0 to ensure the temporary session expires when the JSON session does. If "temporarySession" is false, it defaults to 4294967296 because a permanent session never expires. |
integer |
0 to 4294967296
|
sessionStatus |
The
|
Optional with default of "normal"
|
string enum |
|
temporarySession |
The When Use the |
Optional with default of false
|
Boolean |
|
topicAliasMaximum |
The |
Optional with default of 0
|
integer |
0 to 65535
|
userProperties |
The "userProperties": [
{
"key": "some key",
"value": "some value"
}
] |
Optional with default of null
|
array | 0 or more key/value pairs |
|
userProperties .key |
The "key" property is part of an optional key-value object that is defined in an array in the "userProperties" property. It is a user-defined string value. |
Optional with default of
Required in the Key-Value API |
string | 1 to 128 bytes |
|
userProperties .value |
The
In Key-Value actions, the required |
Required - No default value | string |
|
willContentType |
The |
Optional with default of ""
|
string |
IanaMediaType CustomType |
willCorrelationData |
The |
Optional with default of ""
|
JSON | 0 to 65,500 bytes |
willDelaySeconds |
The |
Optional with default of 60
|
integer | |
willExpirySeconds |
The |
Optional with default of 60
|
integer | |
willPayload |
The |
Required - No default value | JSON | |
willPayloadFormatIndicator |
The |
Optional with default of "none"
|
ENUM |
|
willQoS |
The property |
Optional with default of 2
|
integer | |
willResponseTopic |
The |
Optional with default of ""
|
string | |
willRetain |
The |
Optional with default of false
|
Boolean |
|
willTopic |
The |
Optional with default of ""
|
UTF-8 string | |
willUserProperties |
The |
Optional with default of []
|
array |
|
|
willUserProperties .key |
The "key" property is part of an optional key-value object that is defined in an array in the "userProperties" property. It is a user-defined string value. |
Optional with default of
Required in the Key-Value API |
string | 1 to 128 bytes |
|
willUserProperties .value |
The
In Key-Value actions, the required |
Required - No default value | string |
|
Response properties ("result")
| Property | Description | Type | Limits (inclusive) |
|---|---|---|---|
clientName |
The "Clientname" property uniquely identifies an MQ session. |
string | |
connectionDateTime |
The "connectionDateTime" property indicates when the connection was made. |
timestamp | An ISO 8601 timestamp |
connectionStatus |
The "connectionStatus" property specifies if and how a client is connected to an MQ session. |
string enum |
"disconnected""connected""connectedTemporarily"
|
defaultBinaryFormat |
Defines the default value of "binaryFormat". |
string | One of the following: "base64", "hex", or "byteArray". |
defaultResponseOptions |
The JSON NAV allows you to choose how your program detects errors. By default, all error properties are included in each response – unless you override this behavior as shown in the example. The example omits the error object in all responses which makes it easier for statically typed languages, such as C, C++, Java, C#, and VB, because they prefer properties to always be present. To help these languages, the Example "defaultResponseOptions": {
"binaryFormat": "hex",
"dataFormat": "objects",
"numberFormat": "number",
"variantFormat": "json"
} |
object |
|
|
defaultResponseOptions .binaryFormat |
The "binaryFormat" property designates the format of binary values embedded in JSON strings. For more details, see "binaryFormat". |
string | One of the following: "base64", "hex", or "byteArray". |
|
defaultResponseOptions .dataFormat |
The There are three different (but similar) versions of the "dataFormat" property:
Two of those versions occur in a request, and another occurs in a response. They all indicate how data is formatted.
|
string |
|
|
defaultResponseOptions .numberFormat |
The |
string |
|
|
defaultResponseOptions .variantFormat |
The "variantFormat" property tells the server how to interpret the variant data included in a JSON Action request. For more details, see "variantFormat". |
string |
|
defaultVariantFormat |
The |
string |
|
ipaddress |
The "ipAddress" property specifies the PLC/Equipment IPV4 Address. |
string | A valid IP address |
keepAliveSeconds |
The |
integer | No limit |
metadata |
The |
JSON | 0 to 65,500 bytes |
mqttProtocol |
The "mqttProtocol" property specifies the version of MQTT protocol to use in your session. |
string enum |
|
port |
The |
integer | an integer port number |
sessionStatus |
The
|
string enum |
|
sessionType |
"sessionType" specifies which type of session the requested client is currently running. |
string |
|
username |
The It is required by the All API actions are performed in the context of the account identified by In JSON DB API and JSON Hub API, use the Unlike other property names, such as A zero-length username is invalid.
In Key-Value actions, the
|
string
|
1 to 64 bytes |
willPayload |
The |
JSON | |
willQoS |
The property |
integer | |
willRetain |
When |
Boolean |
|
willTopic |
The "willTopic" property contains the topic that the FairCom server will use to publish the will message. If you set it to an empty string, "", null, or omit it, the FairCom server will not add the will message to the connection. |
UTF-8 string |