ApiKey
API key credential for programmatic access.
This object can be configured from the WebUI under Account › Credentials › API Keys
Fields
description
Type:
String· requiredDescription of the credential
secret
Type:
String· read-only · server-set · secretSecret value of the credential
createdAt
Type:
UTCDateTime· read-only · server-setCreation date of the credential
expiresAt
Type:
UTCDateTime?Expiration date of the credential
permissions
Type:
CredentialPermissions· requiredList of permissions assigned to this credential
allowedIps
Type:
IpMask[]List of allowed IP addresses or CIDR ranges for this credential
JMAP API
The ApiKey object is available via the urn:stalwart:jmap capability.
x:ApiKey/get
This is a standard Foo/get method as defined in RFC 8620, Section 5.1.
This method requires the sysApiKeyGet permission.
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:ApiKey/get",
{
"ids": [
"id1"
]
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'
x:ApiKey/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 sysApiKeyCreate permission.
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:ApiKey/set",
{
"create": {
"new1": {
"allowedIps": [],
"description": "Example",
"expiresAt": "2026-01-01T00:00:00Z",
"permissions": {
"@type": "Inherit"
}
}
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'
Update
This operation requires the sysApiKeyUpdate permission.
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:ApiKey/set",
{
"update": {
"id1": {
"description": "updated value"
}
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'
Destroy
This operation requires the sysApiKeyDestroy permission.
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:ApiKey/set",
{
"destroy": [
"id1"
]
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'
x:ApiKey/query
This is a standard Foo/query method as defined in RFC 8620, Section 5.5.
This method requires the sysApiKeyQuery permission.
curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:ApiKey/query",
{
"filter": {
"expiresAt": "2026-01-01T00:00:00Z"
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'
The x:ApiKey/query filter argument accepts the following conditions (combinable with AnyOf / AllOf / Not per RFC 8620):
| Condition | Kind |
|---|---|
expiresAt | date |
CLI
stalwart-cli wraps the same JMAP calls. See the CLI reference for installation, authentication, and general usage.
Fetch
stalwart-cli get api-key id1
Create
stalwart-cli create api-key \
--field description=Example \
--field expiresAt=2026-01-01T00:00:00Z \
--field 'permissions={"@type":"Inherit"}' \
--field 'allowedIps=[]'
Query
stalwart-cli query api-key
stalwart-cli query api-key --where expiresAt=2026-01-01T00:00:00Z
Update
stalwart-cli update api-key id1 --field description='Updated'
Delete
stalwart-cli delete api-key --ids id1
Nested types
CredentialPermissions
Permission assignment mode for a credential.
Inherit: Same permissions as account. No additional fields.Disable: Disable some permissions. Carries the fields ofCredentialPermissionsList.Replace: Replace all permissions. Carries the fields ofCredentialPermissionsList.
CredentialPermissionsList
List of permissions to assign to a credential.
permissions
Type:
Permission[]List of permissions to assign.