Quickstart

Follow this guide to make your first AgentInbox API request and create a new email inbox.

Prerequisites

You need an AgentInbox account. Sign up at agentinbox.in and generate an API key from the dashboard. The API key starts with at_live_.

Step 1: Get Your API Key

Create an account and generate an API key from the dashboard. The API key starts with at_live_.

Environment Variable
export AgentInbox_API_KEY="at_live_..."

Step 2: Create an Inbox

Create a new inbox using the API. You can specify a TTL (time-to-live) in seconds.

bash
curl -X POST https://agentinbox.in/api/v1/inboxes \
-H "Authorization: Bearer $AgentInbox_API_KEY" \
-H "Content-Type: application/json" \
-d '{"ttlSeconds": 3600}'

Step 3: Use the Email

Use the generated email address in any signup form, password reset, or verification flow.

Example

Sign up for a service using the temporary email address. The verification email will be sent to the inbox.

Step 4: Wait for the Email

Use the wait API to block until the expected email arrives. This is the most common pattern for automation.

typescript
// Wait for OTP
const wait = await client.waits.create({
inboxId: inbox.id,
type: "otp",
timeoutSeconds: 120,
});
console.log(wait.result?.value); // "123456"

Step 5: Complete Workflow

Use the workflow API for everything in one call. This creates an inbox and waits for the email automatically.

typescript
// Complete workflow in one call
const workflow = await client.workflows.createInboxAndWait({
waitType: "otp",
timeoutSeconds: 120,
});
console.log(workflow.inbox.emailAddress);
console.log(workflow.wait.result?.value);

Next Steps