Skip to content

User API

The User API is a JSON-over-HTTP RPC API for settings that belong to a single signed-in user. Every operation is a POST request with a JSON body. JSON field names are lowerCamelCase, as in the Admin API.

A user’s preferences come in two parts:

  • Shared preferences are one typed set of fields that every client application of the user honours.
  • Client settings are one free-form JSON object per client application, such as the webmail or a mobile app. Only that client reads and writes it; the server stores the object as given and never interprets it.

The User API is served at https://api.<your mail domain>/user, on the same host as the Admin API, which is served under /admin. The adminApiUrl stack output holds the host; append /user.

Hosted zone / subdomainNamespaceUser API endpoint
example.com, namespace left emptyhttps://api.example.com/user
example.com, namespace mailboxhttps://api.mailbox.example.com/user

Requests carry a Bearer JWT in the Authorization header. The User API accepts the tokens that authorize the JMAP API, so any user who can sign in to webmail can call it. No admin permission is needed.

The caller is always the user the token identifies. No request names whose preferences are read or written, and a user can reach only their own.

PathPurpose
POST /user/preferences/GetPreferencesReturns the shared preferences and the settings of the named client
POST /user/preferences/UpdateSharedPreferencesSets the shared preferences present in the request
POST /user/preferences/UpdateClientSettingsReplaces the settings of the named client

Writes are last-write-wins: an update replaces the part it names without checking any earlier read. An update changes only the part it names. Updating shared preferences never changes any client’s settings, and updating client settings never changes the shared preferences or another client’s settings.

GetPreferences and UpdateClientSettings take a clientName: the fixed name a client application uses for itself, for example webmail. It must match ^[a-z][a-z0-9-]{0,15}$. Each client reads and writes only the settings under the name it gives, and other clients’ settings are never returned.

Terminal window
curl -s -X POST "https://api.mail.example.com/user/preferences/GetPreferences" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"clientName": "webmail"}'
{
"shared": { "language": "nl-NL" },
"settings": { "theme": "dark" }
}

shared holds the stored shared preferences; a field with no stored value means the user has not chosen one, and each client applies its own default. settings holds the named client’s object. A client name that has stored no settings returns an empty object.

FieldValues
languageA BCP 47 language tag such as en or nl-NL, at most 35 characters. Only the shape of the tag is checked, not whether a client supports the language.

Every field is optional. In an update, a field that is present is set, a field that is left out keeps its stored value, and an empty language clears the stored language.

Terminal window
curl -s -X POST "https://api.mail.example.com/user/preferences/UpdateSharedPreferences" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"shared": {"language": "nl-NL"}}'

The response returns the shared preferences as stored after the write:

{
"shared": { "language": "nl-NL" }
}

The shared object is required.

UpdateClientSettings replaces the named client’s settings with the object you send, so a setting you leave out is removed. Send back the settings that stay. An empty object {} clears the client’s settings.

Terminal window
curl -s -X POST "https://api.mail.example.com/user/preferences/UpdateClientSettings" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"clientName": "webmail", "settings": {"theme": "dark"}}'

The response returns the settings as stored after the write, empty when they were cleared:

{
"settings": { "theme": "dark" }
}

The settings object is required; a request without it is rejected rather than treated as a clear.

LimitValue
Client nameMatches ^[a-z][a-z0-9-]{0,15}$
Size of one client’s settingsAt most 4096 bytes serialized as JSON
Clients with settings per userAt most 16
Language tagAt most 35 characters

A request that breaks a rule above is rejected with HTTP 400:

  • GetPreferences: clientName is missing or malformed.
  • UpdateSharedPreferences: shared is absent or a field is malformed.
  • UpdateClientSettings: clientName is missing or malformed, settings is absent, settings exceeds 4096 bytes, or the write would add a client beyond the limit of 16.