How do I set `disabledPermissions` using `x:Account/set`?

Your question

I am using Stalwart’s JMAP management API to manage user accounts.

Updating quota works correctly:

json
{
“update”: {
“y”: {
“quotas/maxDiskQuota”: 20000
}
}
}

I would like to temporarily put an unpaid account on hold while still allowing the user to read existing email, calendars, and files.

My goal is to disable only the emailSend permission.

x:Account/get currently returns the account permissions as:

json
{
“permissions”: {
@type”: “Inherit”
}
}

I tried updating the complete permissions object:

json
{
“update”: {
“y”: {
“permissions”: {
@type”: “Merge”,
“disabledPermissions”: [
“emailSend”
]
}
}
}
}

This returns:

json
{
“type”: “invalidPatch”,
“description”: “Invalid value for object property”,
“properties”: [
“permissions/disabledPermissions”
]
}

I also tried the permission as email-send, with the same result.

Using an indexed object:

json
{
“permissions”: {
@type”: “Merge”,
“disabledPermissions”: {
“0”: “emailSend”
}
}
}

returns:

json
{
“type”: “invalidPatch”,
“description”: “Invalid key for object property”,
“properties”: [
“permissions/disabledPermissions”
]
}

What is the correct x:Account/set JSON structure for changing an account from:

json
{
“permissions”: {
@type”: “Inherit”
}
}

to a merged permission set with emailSend disabled?

Also, what is the correct request for restoring the account to inherited permissions afterward?

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

The disabledPermissions (and enabledPermissions) fields are represented as JSON objects mapping permission name to true, not as an array of strings and not as an object with numeric-string keys. Your invalid-patch errors came from the shape of the collection, not the permission name itself (emailSend is correct).

To disable email sending while merging with inherited permissions:

{
  "update": {
    "y": {
      "permissions": {
        "@type": "Merge",
        "disabledPermissions": {
          "emailSend": true
        }
      }
    }
  }
}

To restore the account to fully inherited permissions afterward:

{
  "update": {
    "y": {
      "permissions": {
        "@type": "Inherit"
      }
    }
  }
}

You can add more disabled permissions by including additional keys ("otherPermission": true) in the same object, and remove one specific entry later with a JSON-pointer patch like "permissions/disabledPermissions/emailSend": null.

Reference: Account | Stalwart (Permissions / PermissionsList fields) and Permissions | Stalwart for the full permission list.

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.