Eranio
Color theme

Server config

Base: /api/serverconfig

Here you read and change the config.json of the Hytale server itself, not the settings of the mod. It holds, for example, server name, MOTD, password, player limit and view distance as well as the modules of the server. Typical uses are a panel that changes the server name or the player limit, or a script that backs up the configuration. Keep in mind that in most cases changes only take effect after the server has been restarted.

Handler: ServerConfigHandler
GET /api/serverconfig

Get server config

Returns the entire content of config.json as a JSON object, including nested sections.

Response Example

{
  "MaxPlayers": 20,
  "ServerName": "My Server",
  "SkipModValidationForVersion": "abc123"
}

cURL

curl -X GET 'http://localhost:5550/api/serverconfig' \
  -H 'X-Admin-Token: YOUR_TOKEN'
The response contains all keys unchanged, including a set password (Password) in plain text. So never pass it on unfiltered to visitors. The mod reads the file at startup and delivers that state. If you changed the file by hand, you only see it after a call to reload. If the file is missing or unreadable, you get an empty object or the default values of the mod.

Internal Behavior

Returns the content of config.json in the server root folder as held in the mod. Nothing is read from disk again, the reload endpoint exists for that.
POST /api/serverconfig

Change server config

Changes one or more keys of config.json. You send a JSON object whose keys are the top-level keys of the file. Texts, numbers and booleans are taken over directly, objects and lists replace the previous value of the key. The response contains success: true and updated_keys. Most changes need a restart.

Request Body

Field Type Required Description
<key> any No Any config.json keys with new values

Response Example

{
  "success": true,
  "updated_keys": [
    "MaxPlayers",
    "ServerName"
  ]
}

cURL

curl -X POST 'http://localhost:5550/api/serverconfig' \
  -H 'X-Admin-Token: YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"MaxPlayers": 50, "MOTD": "Welcome"}'
Only top-level keys are set. If you send an object such as Defaults, it replaces the whole previous object and is not merged with it, so send all sub-values along. The mod checks neither key names nor values, so a typo simply creates a new key. It is saved immediately. Whether and when the Hytale server applies the change is up to the server. If you changed the file by hand beforehand, call reload first, otherwise saving overwrites your change with the older state in memory. Back up the file before larger changes.

Internal Behavior

Merges the values and writes config.json.
POST /api/serverconfig/reload

Reload server config

Reads config.json from disk into the memory of the mod again and answers with success: true and action: reload. Use it when you edited the file by hand and want the query to show the new content. The running Hytale server is not reconfigured by it.

Response Example

{
  "success": true,
  "action": "reload"
}

cURL

curl -X POST 'http://localhost:5550/api/serverconfig/reload' \
  -H 'X-Admin-Token: YOUR_TOKEN'

Internal Behavior

Reloads the file into the mod.