PublicKey
Defines a public key for email encryption (OpenPGP or S/MIME).
This object can be configured from the WebUI under Account › Public Keys
Fields
accountId
Type:
Id<Account>· read-onlyIdentifier for the account this public key belongs to
key
Type:
Text· requiredOpenPGP or S/MIME public key data
description
Type:
String· requiredDescription of the public key
createdAt
Type:
UTCDateTime· server-setCreation date of the public key
expiresAt
Type:
UTCDateTime?Expiration date of the public key
emailAddresses
Type:
EmailAddress[]Email addresses associated with the public key
JMAP API
The PublicKey object is available via the urn:stalwart:jmap capability.
x:PublicKey/get
This is a standard Foo/get method as defined in RFC 8620, Section 5.1.
This method requires the sysPublicKeyGet permission.
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:PublicKey/get",
{
"ids": [
"id1"
]
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'
x:PublicKey/set
This is a standard Foo/set method as defined in RFC 8620, Section 5.3.
Supports create, update, and destroy operations in a single call.
Create
This operation requires the sysPublicKeyCreate permission.
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:PublicKey/set",
{
"create": {
"new1": {
"description": "Example",
"emailAddresses": [],
"expiresAt": "2026-01-01T00:00:00Z",
"key": "Example"
}
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'
Update
This operation requires the sysPublicKeyUpdate permission.
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:PublicKey/set",
{
"update": {
"id1": {
"key": "updated value"
}
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'
Destroy
This operation requires the sysPublicKeyDestroy permission.
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:PublicKey/set",
{
"destroy": [
"id1"
]
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'
x:PublicKey/query
This is a standard Foo/query method as defined in RFC 8620, Section 5.5.
This method requires the sysPublicKeyQuery permission.
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:PublicKey/query",
{
"filter": {
"accountId": "id1"
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'
The x:PublicKey/query filter argument accepts the following conditions (combinable with AnyOf / AllOf / Not per RFC 8620):
| Condition | Kind |
|---|---|
accountId | id of Account |
CLI
stalwart-cli wraps the same JMAP calls. See the CLI reference for installation, authentication, and general usage.
Fetch
stalwart-cli get public-key id1
Create
stalwart-cli create public-key \
--field key=Example \
--field description=Example \
--field expiresAt=2026-01-01T00:00:00Z \
--field 'emailAddresses=[]'
Query
stalwart-cli query public-key
stalwart-cli query public-key --where accountId=id1
Update
stalwart-cli update public-key id1 --field description='Updated'
Delete
stalwart-cli delete public-key --ids id1