Configuration & preferences

Change runtime settings such as password policies, verification channels and rate limits with the config module, and bucket languages with preferences.

Most of Spica is configured with startup options. Settings that you may want to change while the instance runs live in two modules: config and preferences.

The configuration page in the panel with User and Identity modules

Config module

Each config module has a JSON schema. List them with GET /config/schema:

ModuleSettings
userPassword policy, verification channels, password reset, passwordless login, verification attempts and rate limits.
identityPassword policy.

Read and update

EndpointActionPurpose
GET /configconfig:indexEvery stored module configuration.
GET /config/schemaSchemas of all modules.
GET /config/:moduleconfig:showOne module. Returns 404 until it has been set once.
PUT /config/:moduleconfig:updateReplace the module's settings.

The body of PUT is the settings object itself, and it replaces what was stored before:

Terminal
curl -X PUT https://api.example.com/api/config/user \
  -H "Authorization: IDENTITY <token>" -H "Content-Type: application/json" \
  -d '{
    "password": {"minLength": 10, "minNumber": 1},
    "providerVerificationConfig": [{"provider": "email", "strategy": "Otp"}],
    "resetPasswordProvider": [{"provider": "email", "strategy": "Otp"}],
    "passwordlessLogin": {"passwordlessLoginProvider": [{"provider": "email", "strategy": "MagicLink"}]},
    "verificationProcessMaxAttempt": 5,
    "rateLimits": {"login": {"limit": 10, "ttl": 60}}
  }'
JSON
{"_id": "6b0b1ad7988a814684c8fec6", "module": "user", "options": {"password": {"minLength": 10, "minNumber": 1}}}

user settings

SettingDescription
passwordminLength, minLowercase, minUppercase, minNumber, minSpecialCharacter.
providerVerificationConfigChannels users can verify: [{provider: "email" or "phone", strategy: "Otp" or "MagicLink"}].
resetPasswordProviderChannels allowed for password reset.
passwordlessLogin.passwordlessLoginProviderChannels allowed for passwordless login.
verificationProcessMaxAttemptAttempts allowed for a verification process.
rateLimitslogin, providerVerification, forgotPassword, refreshToken, createUser, each {limit, ttl} with ttl in seconds.

See Users and Password & login security for how these are used.

Preferences

Preferences are smaller, scoped settings. The bucket scope holds the languages of translated properties:

Terminal
curl https://api.example.com/api/preference/bucket -H "Authorization: IDENTITY <token>"
JSON
{"scope": "bucket", "language": {"available": {"tr_TR": "Turkish", "en_US": "English"}, "default": "en_US"}}

Change them with PUT /preference/bucket. The actions are preference:show and preference:update, with the scope as the resource.

Terminal
curl -X PUT https://api.example.com/api/preference/bucket \
  -H "Authorization: IDENTITY <token>" -H "Content-Type: application/json" \
  -d '{"scope": "bucket", "language": {"available": {"en_US": "English", "de_DE": "German"}, "default": "en_US"}}'