Skip to content

Reference

Cluster Hosts

REST API reference for Cluster Hosts: manage the cluster hosts of an instance, their settings, logs and restarts. 9 operations.

Reference7 min read

For the base URL, authentication and errors, see the REST API overview.

GET /v1/hosts ​

  • Request: GET /v1/hosts
  • Operation: ListHosts
  • Operation ID: Host_List
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Example request

bash
curl 'https://YOUR_SERVER/v1/hosts' \
  -H 'Authorization: Bearer YOUR_TOKEN'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

POST /v1/hosts ​

  • Request: POST /v1/hosts
  • Operation: CreateHost
  • Operation ID: Host_Create
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Request body (application/json, required)

FieldTypeRequiredConstraintsDescription
descriptionstringno
hoststringyesPattern: ^([a-zA-Z0-9-_]+\.)*[a-zA-Z0-9][a-zA-Z0-9-_]+(?:\.[a-zA-Z]{2,11})?$Hostname of the server. Hosts register themselves when they start.

Example request (skeleton generated from the schema: required fields only, neutral values)

bash
curl -X POST 'https://YOUR_SERVER/v1/hosts' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "host": ""
}'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

GET /v1/hosts/{host} ​

  • Request: GET /v1/hosts/
  • Operation: ReadHostConfig
  • Operation ID: Host_ReadConfig
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
hostpathstringyes

Example request

bash
curl 'https://YOUR_SERVER/v1/hosts/YOUR_HOST' \
  -H 'Authorization: Bearer YOUR_TOKEN'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

PUT /v1/hosts/{host} ​

  • Request: PUT /v1/hosts/
  • Operation: UpdateHost
  • Operation ID: Host_Update
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
hostpathstringyes

Request body (application/json, required)

FieldTypeRequiredConstraintsDescription
descriptionstringno

Example request: Describe the host

bash
curl -X PUT 'https://YOUR_SERVER/v1/hosts/YOUR_HOST' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "description": "Primary server, eu-west-1"
}'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

DELETE /v1/hosts/{host} ​

  • Request: DELETE /v1/hosts/
  • Operation: DeleteHost
  • Operation ID: Host_Delete
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
hostpathstringyes

Example request

bash
curl -X DELETE 'https://YOUR_SERVER/v1/hosts/YOUR_HOST' \
  -H 'Authorization: Bearer YOUR_TOKEN'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

GET /v1/hosts/{host}/logs ​

  • Request: GET /v1/hosts/{host}/logs
  • Operation: ReadHostLogs
  • Operation ID: Host_ReadLogs
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Server output (stdout and stderr) of the host. A websocket upgrade streams new lines live; a plain GET returns the last lines as text/plain. Reads the logs of the Docker container the server runs in (deployment.container_name, default "thinger"); other cluster hosts are proxied.

Parameters

NameInTypeRequiredDescription
hostpathstringyes
linesqueryintegernoPlain GET: number of last lines (1-5000, default 200).
timestampsquerybooleannoPlain GET: prefix each line with its timestamp.
sincequeryintegernoPlain GET: only lines after this unix timestamp, or this many seconds ago when below 31536000.

Example request

bash
curl 'https://YOUR_SERVER/v1/hosts/YOUR_HOST/logs' \
  -H 'Authorization: Bearer YOUR_TOKEN'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

POST /v1/hosts/{host}/restart ​

  • Request: POST /v1/hosts/{host}/restart
  • Operation: UpdateHostState
  • Operation ID: Host_UpdateStateRestart
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
hostpathstringyes

Request body (application/json, required)

A JSON object.

Example request (skeleton generated from the schema: required fields only, neutral values)

bash
curl -X POST 'https://YOUR_SERVER/v1/hosts/YOUR_HOST/restart' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{}'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

GET /v1/hosts/{host}/settings ​

  • Request: GET /v1/hosts/{host}/settings
  • Operation: ReadHostSettings
  • Operation ID: Host_ReadSettings
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
hostpathstringyes

Example request

bash
curl 'https://YOUR_SERVER/v1/hosts/YOUR_HOST/settings' \
  -H 'Authorization: Bearer YOUR_TOKEN'

Responses

StatusDescription
200ok
401unauthorized
403forbidden

PUT /v1/hosts/{host}/settings ​

  • Request: PUT /v1/hosts/{host}/settings
  • Operation: UpdateHostSettings
  • Operation ID: Host_UpdateSettings
  • Authentication: access token, Authorization: Bearer YOUR_TOKEN

Parameters

NameInTypeRequiredDescription
hostpathstringyes

Request body (application/json, required)

Merged (RFC 7386 merge patch: null removes a key) into the host custom settings, on top of the provider settings. Changes apply after POST /v1/hosts/{host}/restart. Ports are strings: numbers are ignored by the server. On cloud instances (configured by a subscription), database, plugins, rate_limiter, http_server.hosts, accounts.limits.{accounts,brands,domains,members} and deployment.container_name belong to the plan: sending them returns 403, and stored ones are ignored.

FieldTypeRequiredConstraintsDescription
accountsobject or nullnoAccounts and limits. Brands can override the sign-up and login keys per domain.
accounts.admin_emailsanynoEmail addresses whose accounts become admins.
accounts.allow_passwordboolean or nullno
accounts.allow_passwordlessboolean or nullno
accounts.federated_loginboolean or nullno
accounts.identity_providersanynoIdentity provider ids offered on login; empty offers every enabled one.
accounts.invalid_email_domainsanynoEmail domains rejected on sign-up.
accounts.invalid_usernamesanynoUsernames that cannot be registered.
accounts.limitsobject or nullnoPer collection: {"<collection>": {"max_count": n}} with -1 = unlimited and 0 = disabled. Collections: access_tokens, buckets, dashboards, devices, endpoints, plugins, projects, projects_members, storages, alarms_rules, alarms_instances, syncs, types, groups, products, proxies, oauth_clients, identity_providers (default 0: set it to enable them). Also buckets.retention {period, unit} and buckets / endpoints min_interval. Accounts can override them with their own limits.
accounts.max_password_lengthinteger or string or nullnoDefault 48.
accounts.min_password_lengthinteger or string or nullnoDefault 8.
accounts.public_sign_upboolean or nullno
accounts.public_sign_up_rolestring or nullnouser or member.
accounts.require_2faboolean or nullno
accounts.require_email_verificationboolean or nullno
accounts.required_email_domainsanynoOnly these email domains can sign up.
bucketsobject or nullno
buckets.exportobject or nullnoWhere bucket exports are written: type filesystem ({filesystem: {export_path}}) or s3 ({s3: {bucket_id, aws_access_key_id, aws_secret_access_key, aws_region}}).
buckets.export.typestring or nullnofilesystem or s3.
buckets.storageobject or nullnoWhere bucket data is stored: default is mongodb, influxdb or dynamodb, each with its own connection settings (mongodb {connection_string, max_retention, default_retention}, influxdb {host, port, username, password}, dynamodb {table_name, aws_access_key_id, aws_secret_access_key, aws_region}).
buckets.storage.defaultstring or nullnomongodb, influxdb or dynamodb.
deploymentobject or nullno
deployment.contact_emailstring or nullnoThe account registered with this email becomes admin; also {{admin}} in email templates.
deployment.content_security_policystring or nullno
deployment.disable_swaggerboolean or nullno
deployment.x_frame_optionsstring or nullnoDefault SAMEORIGIN.
emailobject or nullnoServer mail settings, used when a brand has no custom email.
email.fromstring or nullnoSender address.
email.from_namestring or nullno
email.sesobject or nullno
email.ses.aws_access_key_idstring or nullno
email.ses.aws_regionstring or nullno
email.ses.aws_secret_access_keystring or nullno
email.smtpobject or nullno
email.smtp.hoststring or nullno
email.smtp.passwordstring or nullno
email.smtp.portstring or integer or nullnoPattern: ^[0-9]{1,5}$As a string, e.g. "587".
email.smtp.secureboolean or nullnotrue: implicit TLS (465); false: STARTTLS (587).
email.smtp.usernamestring or nullno
email.typestring or nullnosmtp or ses.
http_serverobject or nullnoHTTP API and console.
http_server.addressstring or nullnoListening address, e.g. 0.0.0.0.
http_server.enabledboolean or nullno
http_server.portstring or integer or nullnoPattern: ^[0-9]{1,5}$e.g. "80".
http_server.ssl_portstring or integer or nullnoPattern: ^[0-9]{1,5}$e.g. "443".
mqtt_serverobject or nullnoMQTT broker for devices.
mqtt_server.addressstring or nullno
mqtt_server.enabledboolean or nullno
mqtt_server.portstring or integer or nullnoPattern: ^[0-9]{1,5}$e.g. "1883".
mqtt_server.ssl_portstring or integer or nullnoPattern: ^[0-9]{1,5}$e.g. "8883".
proxiesobject or nullno
proxies.dynamic_port_range_endinteger or nullnoLast one (default 51000).
proxies.dynamic_port_range_startinteger or nullnoFirst port given to proxies without a fixed port (default 50000).
scripting_engineobject or nullno{"nodejs": {"enabled": true}}: JavaScript for product scripts.
sslobject or nullno
ssl.client_ca_certsstring or nullnoPEM certificates to accept as client certificates.
ssl.ssl_ciphersstring or nullnoOpenSSL cipher list.
ssl.ssl_enable_legacy_protocolsboolean or nullno
ssl.ssl_prefer_server_ciphersboolean or nullno
thing_serverobject or nullnoIOTMP server for devices.
thing_server.addressstring or nullno
thing_server.enabledboolean or nullno
thing_server.portstring or integer or nullnoPattern: ^[0-9]{1,5}$e.g. "25200".
thing_server.port_v2string or integer or nullnoPattern: ^[0-9]{1,5}$IOTMP v2, default "25204".
thing_server.ssl_portstring or integer or nullnoPattern: ^[0-9]{1,5}$e.g. "25202".
thing_server.ssl_port_v2string or integer or nullnoPattern: ^[0-9]{1,5}$IOTMP v2 over TLS, default "25206".

Example request: Change the MQTT ports

bash
curl -X PUT 'https://YOUR_SERVER/v1/hosts/YOUR_HOST/settings' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "mqtt_server": {
    "port": "1884",
    "ssl_port": "8884"
  }
}'

Example body: Enable projects, members and identity providers

json
{
  "accounts": {
    "limits": {
      "identity_providers": {
        "max_count": 5
      },
      "projects": {
        "max_count": -1
      },
      "projects_members": {
        "max_count": -1
      }
    }
  }
}

Example body: Remove a custom setting (back to the provider value)

json
{
  "deployment": {
    "x_frame_options": null
  }
}

Example body: Send server emails with SMTP

json
{
  "email": {
    "from": "noreply@example.com",
    "from_name": "Example IoT",
    "smtp": {
      "host": "smtp.example.com",
      "password": "app-password",
      "port": "587",
      "secure": false,
      "username": "noreply@example.com"
    },
    "type": "smtp"
  }
}

Responses

StatusDescription
200ok
401unauthorized
403forbidden