Capability authentication
Mailbox creation returns an API key once. Send it as Authorization: Bearer YOUR_KEY. The key grants access only to its mailbox and can be rotated or revoked.
curl -X POST https://leonex.cloud/api/mailboxes \
+ -H "Content-Type: application/json" \
+ -d '{"alias":"demo","lifetimeId":"10m"}'Typed JavaScript and TypeScript client
import { LeonexClient } from '@leonex/sdk';
const leonex = new LeonexClient();
const { token, mailbox } = await leonex.createMailbox({ alias: 'demo' });
const inbox = await leonex.mailbox();Terminal workflows
leonex create --alias demo
LEONEX_API_KEY=... leonex inbox
LEONEX_API_KEY=... leonex webhooks add --url https://example.com/hooks/mailDownload a message
const response = await fetch(
leonex.messageExportUrl(messageId, 'eml'),
{ headers: { Authorization: `Bearer ${token}` } },
);
const eml = await response.blob();Predictable limits
Rate-limited responses use HTTP 429 with Retry-After and rate-limit headers. SDK errors expose the retry delay.
Signed message notifications
Register an HTTPS endpoint to receive message.received. Each request includes X-Leonex-Delivery, X-Leonex-Event, and an HMAC-SHA256 X-Leonex-Signature. The signing secret is returned only when the subscription is created.
const expected = 'v1=' + createHmac('sha256', secret)
.update(rawRequestBody)
.digest('hex');Scoped keys
Every capability key is limited to one temporary mailbox.
Signed delivery
Verify the raw request body before processing webhook events.
Observable limits
HTTP status and headers make throttling explicit.