Skip to content

SetSetting

Creates or replaces one custom setting for an account. Boolean values are supported and are returned as JSON booleans by GetSettings.

The TCP request envelope contains command, extID, and data. The setting fields go inside data.

Request Fields

Name Type Required Description
command string Yes Must be SetSetting.
extID string Yes Request identifier echoed in the response.
data.login integer Yes Account login. Required even when a user session writes to its authenticated login.
data.key string Yes Setting key.
data.value string, number, boolean, object, or array Yes JSON value to save. null is not supported.
__token string For an authenticated session JWT session token, supplied at the request-envelope level.

For a user session, the server saves to the login in the authenticated session. Customer and staff sessions use data.login. Staff sessions require access_backoffice and set_accounts; a SuperAdmin bypasses these staff scope and permission checks.

Request Example

{
  "command": "SetSetting",
  "extID": "setting-1",
  "__token": "<JWT_TOKEN>",
  "data": {
    "login": 7777864,
    "key": "themeEnabled",
    "value": true
  }
}

false is also a valid value:

{
  "command": "SetSetting",
  "extID": "setting-2",
  "__token": "<JWT_TOKEN>",
  "data": {
    "login": 7777864,
    "key": "soundNotify",
    "value": false
  }
}

Success Response

The response envelope echoes extID, includes the HTTP-like command status, and places the command result in data.

{
  "extID": "setting-1",
  "status": 200,
  "data": {
    "data": "OK"
  }
}

Error Response Example

{
  "extID": "setting-1",
  "status": 500,
  "data": {
    "error": "INVALID_SET_SETTING",
    "message": "Common error"
  }
}