Skip to content

Inbox not immediately available for send after create — 404 on fresh inbox #14

@lenhsherr

Description

@lenhsherr

Summary

Calling inboxes.messages.send() immediately after inboxes.create() returns a 404 "Inbox not found" error. The inbox exists (confirmed via inboxes.list()), but the send endpoint rejects it for the first ~1-2 seconds after creation.

Repro

import { AgentMailClient } from "agentmail";

const client = new AgentMailClient({ apiKey: "am_..." });

const inbox = await client.inboxes.create({
  username: "test-inbox",
  clientId: "test-v1",
});
console.log(inbox.inboxId); // "test-inbox@agentmail.to" ✅

// This 404s:
await client.inboxes.messages.send(inbox.inboxId, {
  to: ["recipient@example.com"],
  subject: "Hello",
  text: "Hello!",
});
// NotFoundError: Inbox not found

Expected

send() should succeed immediately after create() returns — or create() should not resolve until the inbox is fully propagated.

Workaround

Adding a ~2 second delay between create() and send() resolves the issue.

Environment

  • agentmail npm v0.4.13
  • Bun v1.3.11 / macOS arm64
  • Also reproduced via raw curl against the REST API

Notes

  • inboxes.list() shows the inbox immediately after creation — it is the /inboxes/{inbox_id}/messages/send endpoint specifically that returns 404.
  • The @ URL-encoding (%40) is not the issue — both encoded and raw @ succeed once the inbox has propagated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions