@inbix/sdk
v0.2.0
Published
Official TypeScript SDK for Inbix — Open Source Cloudflare-native Email API Platform
Maintainers
Readme
@inbix/sdk
Official TypeScript SDK for Inbix — Open Source Cloudflare-native Email API Platform.
Install
npm install @inbix/sdk
# or
pnpm add @inbix/sdk
# or
yarn add @inbix/sdkQuick Start
import { InbixClient } from "@inbix/sdk";
const client = new InbixClient({
baseUrl: "https://inbix.xyz",
apiKey: "inbix_your_api_key", // optional, needed for authed endpoints
});
// Create a disposable inbox
const inbox = await client.createInbox();
console.log(inbox.emailAddress); // e.g. [email protected]
// List messages
const { data: messages } = await client.listMessages(inbox.id);
// Get a message
const message = await client.getMessage(messages[0].id);
// Delete the inbox
await client.deleteInbox(inbox.id);Authentication
The SDK supports two authentication methods:
API Key (for automation/CI)
const client = new InbixClient({
baseUrl: "https://inbix.xyz",
apiKey: "inbix_...",
});Clerk Session Token (for dashboard integrations)
const client = new InbixClient({
baseUrl: "https://inbix.xyz",
token: clerkSessionToken,
});API Reference
Inboxes
createInbox(options?)— Create a new disposable inboxgetInbox(id)— Get inbox detailslistInboxes(page?, pageSize?)— List inboxes (paginated)deleteInbox(id)— Delete an inboxsubscribeToInbox(inboxId, onMessage, onError?)— SSE subscription for real-time messages
Messages
listMessages(inboxId, page?, pageSize?)— List messages in an inboxgetMessage(id)— Get message detailsgetMessageHtml(id)— Get sanitized HTML contentdeleteMessage(id)— Delete a message
Attachments
listAttachments(messageId)— List attachments for a messagedownloadAttachment(messageId, attachmentId)— Download attachment as Blob
Domains
listDomains()— List available domains
API Keys (requires Clerk session token)
createApiKey(name)— Create a new API keylistApiKeys()— List your API keysrevokeApiKey(id)— Revoke an API key
Webhooks
createWebhook(url, events)— Create a webhooklistWebhooks()— List your webhooksgetWebhook(id)— Get webhook detailsdeleteWebhook(id)— Delete a webhooklistWebhookDeliveries(webhookId, page?, pageSize?)— List delivery historytestWebhook(id)— Send a test delivery
Logs
listApiLogs(page?, pageSize?)— List API request logs
OpenAPI
getOpenApiSpec()— Get the OpenAPI 3.0 spec
Webhook Events
inbox.created— New inbox createdinbox.deleted— Inbox deletedmessage.received— New message receivedmessage.deleted— Message deleted
Error Handling
import { InbixClient, InbixError } from "@inbix/sdk";
try {
const inbox = await client.createInbox();
} catch (err) {
if (err instanceof InbixError) {
console.error(err.status, err.message);
}
}License
MIT
