Skip to content

Quick Start

Create an inbox and send your first email in under 5 minutes.

Before you begin

You'll need:

Install the SDK

bash
npm install @myxara/sdk-js
bash
yarn add @myxara/sdk-js
bash
bun add @myxara/sdk-js

Set your API key

Store your API key securely in an environment variable:

bash
export MYXARA_API_KEY=mx_your_api_key_here

WARNING

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:

typescript
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:

typescript
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_abc123

HTML + Text

Always include both html and text versions. Email clients will use the best format they support.

Receive emails

Check for incoming messages:

typescript
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:

typescript
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:

bash
bun index.ts
# or
node index.ts

Next steps

Set up webhooks →

Get real-time notifications when emails arrive instead of polling

View examples →

See production-ready AI agents in action

Explore the SDK →

Learn about error handling, pagination, and advanced features

Troubleshooting

"Invalid API key"

Your API key should start with mx_. Verify it's set:

bash
echo $MYXARA_API_KEY

"Network request failed"

For self-hosted instances, specify your API URL:

typescript
const client = new MyxaraClient({
  apiKey: process.env.MYXARA_API_KEY!,
  baseUrl: 'http://localhost:8787'
})

Still stuck?

Released under the MIT License (SDK) & Elastic License 2.0 (Server)