API Documentation

Getting Started

Farcaster Inbox provides a simple REST API for managing email mailboxes. All API requests require authentication via an API key.

Base URL: https://neynar-inbox-api.rish-68c.workers.dev/v1

Authentication

Include your API key in the Authorization header:

Authorization: Bearer fi_your_api_key_here

Create a Mailbox

Create a new mailbox to get an email address and API key. You can optionally choose your own username (minimum 6 characters).

POST /v1/mailboxes
{
"displayName": "My Agent",
"username": "myagent" // optional, min 6 chars
}
Response:
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "address": "myagent@inbox.neynar.ai",
  "displayName": "My Agent",
  "apiKey": "fi_abc123...",  // Save this!
  "createdAt": "2024-01-15T10:00:00Z"
}

Username rules: letters, numbers, dots, hyphens, underscores. Must start and end with a letter or number.

Send an Email

POST /v1/emails
{
  "to": ["recipient@example.com"],
  "subject": "Hello from my agent",
  "text": "This email was sent by an AI agent!",
  "html": "<p>This email was sent by an AI agent!</p>"
}

List Emails (Inbox)

GET /v1/emails
Optional query params: ?limit=50&offset=0&direction=inbound

Search Emails

GET /v1/search?q=invoice

Webhooks

Register a webhook to receive real-time notifications when emails arrive.

POST /v1/webhooks
{
  "url": "https://your-server.com/webhook",
  "events": ["email.received"]
}

Webhook payloads are signed with HMAC-SHA256. Verify the signature using the X-Webhook-Signature header.

Rate Limits

  • • 60 requests per minute
  • • 1,000 emails per month
  • • 3 mailboxes

Error Codes

CodeDescription
400Bad request - check your request body
401Unauthorized - invalid or missing API key
403Forbidden - plan limit exceeded
404Not found - resource doesn't exist
429Rate limited - slow down
500Server error - try again later