Quick Start
Create an inbox and send your first email in under 5 minutes.
Before you begin
You'll need:
- Node.js 18+ or Bun installed
- A Myxara API key - Get one free →
Install the SDK
npm install @myxara/sdk-jsyarn add @myxara/sdk-jsbun add @myxara/sdk-jsSet your API key
Store your API key securely in an environment variable:
export MYXARA_API_KEY=mx_your_api_key_hereWARNING
Never commit API keys to version control. Use environment variables or a secrets manager.
Create your first inbox
Every AI agent needs an email address. Let's create one:
import { MyxaraClient } from '@myxara/sdk-js'
const client = new MyxaraClient({
apiKey: process.env.MYXARA_API_KEY!
})
const inbox = await client.inboxes.create({
local_part: 'support',
name: 'AI Support Agent'
})
console.log(inbox.address)
// → [email protected]What just happened?
You created a real, working email address that can send and receive emails immediately. No DNS configuration needed!
Send an email
Now let's send an email from your new inbox:
const message = await client.inboxes.messages(inbox.id).send({
to: '[email protected]',
subject: 'Welcome to Myxara!',
html: '<h1>Hello!</h1><p>Your AI agent is ready.</p>',
text: 'Hello! Your AI agent is ready.'
})
console.log(message.id)
// → msg_abc123HTML + Text
Always include both html and text versions. Email clients will use the best format they support.
Receive emails
Check for incoming messages:
const messages = await client.inboxes.messages(inbox.id).list({
direction: 'in',
limit: 10
})
for (const msg of messages.data) {
console.log(`From: ${msg.from}`)
console.log(`Subject: ${msg.subject}`)
console.log(`Body: ${msg.text}`)
}Real-time notifications
For instant notifications when emails arrive, set up webhooks instead of polling.
Complete example
Here's everything together:
import { MyxaraClient } from '@myxara/sdk-js'
const client = new MyxaraClient({
apiKey: process.env.MYXARA_API_KEY!
})
async function main() {
// Create inbox
const inbox = await client.inboxes.create({
local_part: 'support',
name: 'AI Support Agent'
})
console.log(`Inbox: ${inbox.address}`)
// Send email
await client.inboxes.messages(inbox.id).send({
to: '[email protected]',
subject: 'Welcome!',
html: '<h1>Hello!</h1><p>Your AI agent is ready.</p>',
text: 'Hello! Your AI agent is ready.'
})
console.log('Email sent!')
// Check messages
const messages = await client.inboxes.messages(inbox.id).list({
direction: 'in'
})
console.log(`${messages.data.length} messages received`)
}
main().catch(console.error)Save as index.ts and run:
bun index.ts
# or
node index.tsNext steps
Troubleshooting
"Invalid API key"
Your API key should start with mx_. Verify it's set:
echo $MYXARA_API_KEY"Network request failed"
For self-hosted instances, specify your API URL:
const client = new MyxaraClient({
apiKey: process.env.MYXARA_API_KEY!,
baseUrl: 'http://localhost:8787'
})Still stuck?
- SDK Reference - Complete API documentation
- GitHub Issues - Report bugs
- Discussions - Get help