The "alterTag" action modifies an existing tag. You can identify the tag using either the "id" or "tagName" properties.
When you set the "sourceFieldName" to the name of a field in the tag's integration, it links the tag to the field. Once linked, a field is managed by the tag instead of the "alterIntegrationTable" action. The tag becomes the source of truth for the field definition and the server ensures the tag's data is synchronized between the tag's property in the source_payload field and the tag's user-defined field.
Tips: The optional
"newTagName"property renames a tag.
Set the"status"property to"inactive"to deprecate a tag and set it to"active"to activate a tag.Note: The action returns the following error message if you specify both the
"id"and"tagName"properties:
The"id"and"tagName"properties are mutually exclusive.
How to use the "alterTag" action to manage the tag's field
-
To create a field and link it to a tag, assign a tag's
"sourceFieldName"to a non-existent field and specify the"sourceFieldType","sourceFieldLength", and"sourceFieldScale"properties. If necessary, it unlinks the tag from a previously linked field. -
To rename a field linked to a tag, take a tag that is already linked to a field and change its
"sourceFieldName"to a non-existent field. In contrast, if you assign an existing field name to"sourceFieldName", the action will link the tag to that field instead of renaming it. -
To modify a field linked to a tag, change the values of the tag's
"sourceFieldType","sourceFieldLength", and/or"sourceFieldScale"properties. The action archives the existing field by renaming it to<previousName>_ARCHIVED<N>and creates a new field with the original name, new type, new length, and/or new scale. This approach preserves previously collected data in the archived field. You can use the"alterIntegrationTable"action to permanently delete the archived field. -
To delete a field linked to a tag, set the tag's
"sourceFieldName"property tonullor use the"deleteTag"action to delete the tag. This unlinks the tag from the field. You can then use the"alterIntegrationTable"action to permanently delete an unlinked field and its data. -
To unlink a field from a tag, set the tag's
"sourceFieldName"property tonullor use the"deleteTag"action to delete the tag. -
To link an existing field to a tag, assign a tag's
"sourceFieldName"to an target field, which must already exist in the integration table.- If another tag is already linked to the target field, the action returns the error
"Cannot link tag TTT to field FFF because tag XXX is already linked to it".- To overcome this error, first unlink the other tag from the field by setting its
"sourceFieldName"property tonull.
- To overcome this error, first unlink the other tag from the field by setting its
- If the target field's type, length, and scale are not identical to those specified in the tag, the action returns the error
"Cannot link tag TTT to field FFF because the field has a different type, length, or scale".- To overcome this error, unlink the tag from the target field by setting the tag's
"sourceFieldName"property tonull. Then, change the tag's"sourceFieldType","sourceFieldLength", and"sourceFieldScale"properties to match the field. Alternatively, use the"alterIntegrationTable"action to modify the target field's type, length, and scale to match the tag. Lastly, assign the tag's"sourceFieldName"to the target field.
- To overcome this error, unlink the tag from the target field by setting the tag's
- If another tag is already linked to the target field, the action returns the error
Request examples
Rename a tag using "id" to select the tag
{
"api": "hub",
"action": "alterTag",
"params": {
"id": 1,
"newTagName": "My New Tag Name"
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}
Rename a tag using "tagName" to select the tag
{
"api": "hub",
"action": "alterTag",
"params": {
"tagName": "Temperature Celsius",
"newTagName": "My New Tag Name"
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}
Change tag values
- You can use the
"id"property or"tagName"property to select the tag – but not both. - To change a property value, include the property and assign it to a new value.
- To leave a property value unchanged, omit it.
- The optional
"include…"properties return extra information in the response.
{
"api": "hub",
"action": "alterTag",
"params": {
"tagName": "Temperature Celsius",
"tableName": "temperature",
"ownerName": "admin",
"databaseName": "faircom",
"tagDataType": "number",
"sourceFieldName": "temperature_celsius",
"sourcePayloadPath": "temperature.celsius",
"sourcePayloadBinaryFormat": "hex",
"sourcePayloadDateFormat": "iso8601",
"sourcePayloadTimeFormat": "iso8601",
"sourcePayloadNumberRounding": "roundup",
"sourcePayloadVariantFormat": "json",
"onSyncConflict": "overwriteFieldWithoutError",
"status": "active",
"purpose": "Track Celsius Temperatures from devices",
"description": "My tag's description",
"labels": ["temperature", "celsius"],
"metadata": { "myProperty": "myValue" },
"includeInputConnectorProperties": ["id", "connectorName", "connectorId" ],
"includeOutputConnectorProperties": ["id", "connectorName", "connectorId" ],
"includeThingProperties": [],
"includeTopicProperties": ["id", "topic", "tableName"]
},
"responseOptions": {},
"authToken": "replaceWithAuthTokenFromCreateSession",
"requestId": "1",
"debug": "none"
}
Change list and object values
- When modifying a property with a list or object value, replace the entire value with a new one.
- To clear a list, set it to
[]. - To clear an object, set it to
{}. - The following example replaces the values assigned to the
"labels"and"metadata"properties.
{
"api": "hub",
"action": "alterTag",
"params": {
"tagName": "Temperature Celsius",
"labels": ["temperature", "celsius", "fahrenheit"],
"metadata": {},
},
"responseOptions": {},
"authToken": "replaceWithAuthTokenFromCreateSession",
"requestId": "1",
"debug": "none"
}
Response examples
Minimal
{
"authToken": "replaceWithAuthTokenFromCreateSession",
"result": {
"id": 1,
"tagName": "temperatureCelsius",
"tableName": "temperature",
"ownerName": "admin",
"databaseName": "faircom",
"tagDataType": "number",
"sourceFieldName": "temperature_celsius",
"sourceFieldType": "integer",
"sourceFieldLength": 4,
"sourceFieldScale": null,
"sourcePayloadPath": "temperature.celsius",
"sourcePayloadBinaryFormat": "hex",
"sourcePayloadDateFormat": "iso8601",
"sourcePayloadTimeFormat": "iso8601",
"sourcePayloadNumberRounding": "roundup",
"sourcePayloadVariantFormat": "json",
"onSyncConflict": "retainValues",
"status": "active",
"purpose": "Store temperature in Celsius",
"description": "My tag's description",
"labels": ["temperature", "celsius"],
"metadata": { "myProperty": "myValue" },
"createdTimestamp": "2026-01-03T12:13:04Z",
"updatedTimestamp": "2026-01-03T12:13:04Z"null,
"inactiveTimestamp": null
},
"errorCode": 0,
"errorMessage": ""
}Maximal
{
"authToken": "replaceWithAuthTokenFromCreateSession",
"result": {
"id": 1,
"tagName": "temperatureCelsius",
"tableName": "temperature",
"ownerName": "admin",
"databaseName": "faircom",
"tagDataType": "number",
"sourceFieldName": "temperature_celsius",
"sourceFieldType": "integer",
"sourceFieldLength": 4,
"sourceFieldScale": null,
"sourcePayloadPath": "temperature.celsius",
"sourcePayloadBinaryFormat": "hex",
"sourcePayloadDateFormat": "iso8601",
"sourcePayloadTimeFormat": "iso8601",
"sourcePayloadNumberRounding": "roundup",
"sourcePayloadVariantFormat": "json",
"onSyncConflict": "retainValues",
"status": "inactive",
"purpose": "Store temperature in Celsius",
"description": "My tag's description",
"labels": ["temperature", "celsius"],
"metadata": { "myProperty": "myValue" },
"createdTimestamp": "2026-01-03T12:13:04Z",
"updatedTimestamp": "2026-02-03T17:36:57Z",
"inactiveTimestamp": "2026-03-03T09:01:13Z",
"inputConnectors": [
{ "connectorId": 51, "connectorName": "INPUT: PLC 74 & Modbus", "lastCollectedTimestamp": "2025-08-28T10:47:13.041" }
],
"outputConnectors": [
{ "connectorId": 52, "connectorName": "OUTPUT: PLC 74 & Modbus","lastDeliveredTimestamp": "2025-08-28T10:47:13.041" },
{ "connectorId": 53, "connectorName": "OUTPUT: MES & REST", "lastDeliveredTimestamp": "2025-08-28T10:47:13.041" }
],
"things": [
{ "thingId": 1 }
],
"topics": [
{ "topicId": 1, "topic": "Temperature", "tableName": "temperature" },
{ "topicId": 1, "topic": "Temperature//Celsius", "tableName": "celsius" }
]
},
"errorCode": 0,
"errorMessage": ""
}
Properties
Request properties ("params")
| Property | Description | Default | Type | Limits (inclusive) |
|---|---|---|---|---|
databaseName |
The You specify this property when you want to use a different database instead of the default. This property is useful because objects, such as tables and code packages, can have the same name in multiple databases. This feature allows you to create multiple environments in the same server and reuse the same JSON actions in each environment. For example, you can create It is an error to set If no default database is specified during |
Defaults to the session's "defaultDatabaseName" property |
string | 1 to 64 bytes |
description |
The "description" property describes objects such as code packages, labels, or things. The server indexes this field with a full-text index so that you can search for any word or phrase. You cannot use this property for filtering in the Thing API. |
Optional with default of
|
string |
0 to 65,500 bytes 1 to 512 bytes for the Thing API |
id |
The
|
Automatically generated by the server | integer |
|
includeInputConnectorProperties |
The
For more details, see |
Optional with default of []
|
array of strings |
|
includeOutputConnectorProperties |
The
For more details, see |
Optional with default of []
|
array of strings |
|
includeThingProperties |
The "includeThingProperties" property causes the response to include a "things" list that contains all the devices and software related to the request. Each string is the name of a device property. For more details, see "includeThingProperties". |
Optional with default of []
|
array of strings |
|
includeTopicProperties |
The "includeTopicProperties" property causes the response to include a "topics" list that contains all the MQTT topics related to the request. Each string is the name of a topic property. For more info, see “includeTopicProperties”. |
Optional with default of []
|
array of strings | zero or more of the properties in the results example of the describeTopics action |
labels |
The The
When using tag actions, the optional
When you use the
You can use the
The Tag API implements the
|
Required - No default value
Defaults to
|
array of objects |
1 or more label objects
Values are managed in the Label API with the group of |
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 |
newTagName |
The "newTagName" property specifies the unique name of a tag that is created by a transform step. For more details, see "newTagName". |
Varies | string | 1 to 256 bytes |
onSyncConflict |
The "onSyncConflict" property specifies what happens when the automatic synchronization between a tag's property and field cannot be synchronized because both have different values. |
"retainValues" |
string enum |
"overwriteField""overwriteFieldWithoutError""overwriteProperty""overwritePropertyWithoutError""retainValues""retainValuesWithoutError" |
ownerName |
The You specify this property when you want to use a different account instead of the default. Your session's account must have the appropriate privileges to access the code package. This property is useful because objects, such as tables and code packages, can have the same name in the same database as long as different accounts own each object. This feature allows you to create duplicate objects for different users on the same server and reuse the same JSON actions on those objects. For example, an administrator can copy objects from a production environment to her account so she can troubleshoot an issue using the same JSON actions, JavaScript, and SQL code. It is an error to set If no default owner is specified during |
Optional with default of the session's "defaultOwnerName" property |
string | 1 to 64 bytes |
purpose |
The
In the Thing API, the
The Thing API uses the Label API to manage purposes.
|
Optional with default of
|
string | 1 to 64 bytes |
sourceFieldName |
The
|
Optional with default of ""
|
string | 1 to 64 bytes |
sourcePayloadBinaryFormat |
The
|
|
string |
|
sourcePayloadDateFormat |
The "sourcePayloadDateFormat" property specifies the "dateFormat" of data embedded in a string property in the source_payload field. |
"iso8601" |
string |
|
sourcePayloadNumberRounding |
The "sourcePayloadNumberRounding" property specifies the rounding option to use when reducing the scale of a number property in the source_payload field. |
"iso8601" |
string |
|
sourcePayloadPath |
The
|
Required by the "createTag" action. Otherwise, it is optional with default of "". |
string | 1 to 2048 bytes |
sourcePayloadTimeFormat |
The "sourcePayloadTimeFormat" property specifies how the server encodes and decodes a time value assigned to a tag. For more details, see "sourcePayloadTimeFormat". |
Optional with default of "iso8601"
|
string enum |
"hh.mm.ss.ttt""hh.mm.am/pm""hh.mm.ss.am/pm""hh.mm.ss""hh.mm""hhmm""iso8601""utc"
|
sourcePayloadVariantFormat |
The
|
Optional with default of "json"
|
string enum |
"json""variantObject""binary""string"
|
status |
The
When the
To create, alter, and list inactive items, set the |
Optional with default of "active"
|
string enum |
|
tableName |
The See table name in System limits for the table naming requirements and limitations.
"params": {
"tableName": "ctreeTable"
} |
Required - No default value | string | 1 to 64 bytes |
tagDataType |
The
|
Optional with default of "json"
|
string enum |
"string""number" "boolean" "date" "time" "timestamp" "json" "variant" "binary"
|
tagName |
The "tagName" property specifies the unique name of a tag. For more details, see "tagName". |
Required - No default value | string | 1 to 256 bytes |
Response properties ("result")
| Property | Description | Type | Limits (inclusive) |
|---|---|---|---|
createdTimestamp |
The "createdTimestamp" property is the date and time when something, such as a thing or key, was originally created in ISO 8601 format, such as "2025-08-28T10:47:13.041". It is never null. |
timestamp | An ISO 8601 timestamp |
databaseName |
The
|
string | 1 to 64 bytes |
description |
The Markdown is a good language for formatting description text. You must ensure the text is compatible with a JSON string. For example, you must escape a double quote character using the backslash character:
In the Thing API, It defaults to
|
string | 1 to 65,500 bytes |
id |
The |
integer |
|
inactiveTimestamp |
The "inactiveTimestamp" property is the date and time when the thing was last made inactive. It is null when the thing is active. It is returned in ISO 8601 format, such as "2025-08-28T10:47:13.041". |
timestamp | ISO 8601 timestamp |
inputConnectors |
The
|
array of objects |
zero or more objects containing zero or more of the following properties:
|
labels |
The The
When using tag actions, the optional
When you use the
You can use the
The Tag API implements the
|
array of objects |
1 or more label objects
Values are managed in the Label API with the group of |
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. |
object | 0 or more key/value pairs |
onSyncConflict |
The "onSyncConflict" property specifies what happens when the automatic synchronization between a tag's property and field cannot be synchronized because both have different values. |
string enum |
"overwriteField""overwriteFieldWithoutError""overwriteProperty""overwritePropertyWithoutError""retainValues""retainValuesWithoutError" |
outputConnectors |
The
|
array of objects |
Zero or more objects containing zero or more of the following properties:
|
ownerName |
The "ownerName" property identifies the user who owns an object (see Object owner). |
string | 0 to 64 bytes |
purpose |
The
In the Thing API, the
This API uses the Label API to manage purposes.
|
string | 1 to 64 bytes |
sourceFieldLength |
The "sourceFieldLength" property links a tag to a field in the tag's integration table. |
string | 1 to 64 bytes |
sourceFieldName |
The
|
string | 1 to 64 bytes |
sourceFieldScale |
The "sourceFieldScale" property contains the scale of the tag's field in the integration table. |
integer |
"money": 2 digits to the right of the decimal point allows 30 digits to the left."money": 4 digits to the right of the decimal point allows 28 digits to the left."number": 0 to 32 digits. It must be less than or equal to "sourceFieldLength" which defaults to 32. |
sourceFieldType |
The "sourceFieldType" property specifies the number of bytes of the tag's field in the integration table. |
integer |
"json", "varchar", and "varbinary": 1 to 65500 (Specifies the variable-length field's maximum number of bytes.)"char" and "binary": 1 to 65500 (Specifies the fixed-length field's length in bytes.)"number" and "money": 1 to 32 (Optionally specifies the field's maximum total number of numeric digits.) |
sourcePayloadBinaryFormat |
The
|
string |
|
sourcePayloadDateFormat |
The "sourcePayloadDateFormat" property specifies the "dateFormat" of data embedded in a string property in the source_payload field. |
string |
|
sourcePayloadNumberRounding |
The "sourcePayloadNumberRounding" property specifies the rounding option to use when reducing the scale of a number property in the source_payload field. |
string |
|
sourcePayloadPath |
The
|
string | 1 to 2048 bytes |
sourcePayloadTimeFormat |
The "sourcePayloadTimeFormat" property specifies how the server encodes and decodes a time value assigned to a tag. For more details, see "sourcePayloadTimeFormat". |
string enum |
"hh.mm.ss.ttt""hh.mm.am/pm""hh.mm.ss.am/pm""hh.mm.ss""hh.mm""hhmm""iso8601""utc"
|
sourcePayloadVariantFormat |
The
|
string enum |
"json""variantObject""binary""string"
|
status |
The
When the
To create, alter, and list inactive items, set the |
string enum |
|
tableName |
The See table name in System limits for the table naming requirements and limitations. |
string | 1 to 64 bytes |
tagDataType |
The
|
string enum |
"string""number" "boolean" "date" "time" "timestamp" "json" "variant" "binary"
|
tagName |
The
|
string | 1 to 256 bytes |
things |
The "things" property occurs in the response to Tag API actions when the "includeThingProperties" property is in the request. It is an array of objects that contains all devices and software related to a tag. Each object contains the requested device properties. See "includeThingProperties" for examples and additional information. |
array of objects | All devices and software related to a tag. |
topics |
The "topics" property occurs in the response to Tag API actions when the "includeTopicProperties" property is in the request. It is an array of objects that contains all topics related to a tag. Each object contains the requested topic properties. See "includeTopicProperties" for examples and additional information. |
array of objects | All topics related to a tag. |
updatedTimestamp |
The "updatedTimestamp" property is the date and time when the thing was last updated. It is the same as the "createdTimestamp" property when the thing has never been updated. It is returned in ISO 8601 format, such as "2025-08-28T10:47:13.041". |
timestamp | ISO 8601 timestamp |