ApiKey
ApiKey
Section titled “ApiKey”API key credential for programmatic access.
This object can be configured from the WebUI under Account › Credentials › API Keys
Fields
Section titled “Fields”description
Section titled “description”Type:
String· requiredDescription of the credential
secret
Section titled “secret”Type:
String· read-only · server-set · secretSecret value of the credential
createdAt
Section titled “createdAt”Type:
UTCDateTime· read-only · server-setCreation date of the credential
expiresAt
Section titled “expiresAt”Type:
UTCDateTime?Expiration date of the credential
permissions
Section titled “permissions”Type:
CredentialPermissions· requiredList of permissions assigned to this credential
allowedIps
Section titled “allowedIps”Type:
IpMask[]List of allowed IP addresses or CIDR ranges for this credential
JMAP API
Section titled “JMAP API”The ApiKey object is available via the urn:stalwart:jmap capability.
x:ApiKey/get
Section titled “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
Section titled “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
Section titled “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", "permissions": { "@type": "Inherit" } } } }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'Update
Section titled “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
Section titled “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
Section titled “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 |
stalwart-cli wraps the same JMAP calls. See the CLI reference for installation, authentication, and general usage.
stalwart-cli get ApiKey id1Create
Section titled “Create”stalwart-cli create ApiKey \ --field description=Example \ --field 'permissions={"@type":"Inherit"}' \ --field 'allowedIps={}'stalwart-cli query ApiKeystalwart-cli query ApiKey --where expiresAt=2026-01-01T00:00:00ZUpdate
Section titled “Update”stalwart-cli update ApiKey id1 --field description='updated value'Delete
Section titled “Delete”stalwart-cli delete ApiKey --ids id1Nested types
Section titled “Nested types”CredentialPermissions
Section titled “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
Section titled “CredentialPermissionsList”List of permissions to assign to a credential.
permissions
Section titled “permissions”Type:
Permission[]List of permissions to assign.