Inbox API Documentation
Email receiving and processing API for automation workflows.
https://api.ainoflow.ioAuthorization: Bearer your_api_key_hereCore Concepts
- • All routes below use the prefix
/api/v1/inbox - • List endpoints accept
aggregate(default false): when false, the body is only the items array and pagination is inX-Total-Count,X-Page,X-Limit,X-Total-Pages - • Responses use camelCase JSON property names
- • Globally unique email address per inbox
- • Generated server-side with embedded HMAC signature
- • Example:
habcd1234-x7z8wq3m5n2kabcd@ainobox.com - • API operations use inbox GUID, not hook address
- • Data scoped to tenant (
scopeId) and project (projectId) - • Inboxes and messages only visible within the authenticated scope/project
- • Storage paths under
inbox/{scopeId}/{projectId}/...
- • Optional
allowedFromEmailsfield - • Comma or semicolon delimited, normalized on save
- • Case-insensitive, exact match only
- •
null= accept all senders
- • Received - email arrives, parsed, stored
- • Handled - consumer calls
/handle - • Expired - TTL reached, auto-deleted with files
- • Deleted - manual removal via DELETE
- • ttlDays: Default 30 days, configurable per inbox
- • Automatic cleanup: Messages + attachments deleted on expiry
- • Deduplication: SHA-256 hash of raw email content
- • isHandled: Processing flag, not retention flag
- • Multiple sources: Attach multiple IMAP configs per inbox
- • Auto-polling: Configurable interval (1-1440 min)
- • After-fetch actions: Leave untouched, mark read, or delete on server
- • Same pipeline: Deduplication, whitelisting, webhooks all apply
Main Endpoints
/api/v1/inboxRequest Body:
id name allowedFromEmails webhookUrl ttlDays maxMessageSizeBytes maxAttachments enabled Response (201 Created):
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"scopeId": "1fa85f64-5717-4562-b3fc-2c963f66afa6",
"projectId": "2fa85f64-5717-4562-b3fc-2c963f66afa6",
"hookAddress": "habcd1234-x7z8wq3m5n2kabcd@ainobox.com",
"name": "Invoice intake",
"allowedFromEmails": "partner@corp.com, alerts@service.com",
"webhookUrl": "https://myapp.com/webhook/inbox",
"ttlDays": 30,
"maxMessageSizeBytes": 10485760,
"maxAttachments": 10,
"enabled": true,
"createdAt": "2026-02-20T10:30:00Z",
"createdBy": "api-key-name"
}/api/v1/inboxaggregate.Query Parameters:
page limit offset sortBy sortOrder aggregate Response (200 OK):
List items include messageCount, unhandledCount, imapSourceCount.
/api/v1/inbox/{id}Path Parameters:
id /api/v1/inbox/{id}Request Body:
name allowedFromEmails webhookUrl ttlDays maxMessageSizeBytes maxAttachments enabled Response (200 OK):
Partial summary: id, hookAddress, updatedAt.
/api/v1/inbox/{id}?force=true to delete even if unhandled messages exist.Query Parameters:
force Response (200 OK):
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"hookAddress": "habcd1234-x7z8wq3m5n2kabcd@ainobox.com"
}/api/v1/inbox/{id}/messagesbodyHtml is not included in list items; use Get Message or Handle for HTML body.Query Parameters:
page limit offset isHandled sortBy sortOrder receivedAfter receivedBefore fromAddress aggregate Response (200 OK):
{
"items": [{
"id": "7fa85f64-...",
"fromAddress": "sender@example.com",
"subject": "Invoice #12345",
"bodyText": "Please find attached...",
"isHandled": false,
"hasAttachments": true,
"attachments": [{
"id": "9fa85f64-...",
"fileName": "invoice.pdf",
"downloadUrl": "https://..."
}]
}],
"totalCount": 42
}/api/v1/inbox/{id}/messages/{messageId}bodyHtml and attachment download URLs. Read-only — does not mark the message as handled.Path Parameters:
id messageId /api/v1/inbox/{id}/messages/{messageId}/handlePath Parameters:
id messageId Response (200 OK):
Full message with body, attachments, and download URLs. isHandled: true.
/api/v1/inbox/{id}/messages/handleRequest Body:
messageIds limit Response (200 OK):
{ items, handledCount } — full message objects in items.
/api/v1/inbox/{id}/messages/{messageId}Response (200 OK):
{
"id": "7fa85f64-5717-4562-b3fc-2c963f66afa6"
}/api/v1/inbox/{id}/messages/{messageId}/attachments/{attachmentId}Location set to a pre-signed S3 URL. Use curl -L or a browser; use the /url endpoint if redirects are not followed.Path Parameters:
id messageId attachmentId /api/v1/inbox/{id}/messages/{messageId}/attachments/{attachmentId}/urlQuery Parameters:
expirySeconds Response (200 OK):
{
"downloadUrl": "https://storage.example.com/inbox/...?signature=...",
"downloadUrlExpiresAt": "2026-02-20T11:30:00Z"
}Webhook Notifications
When webhookUrl is set, the service POSTs after a new message is stored. Delivery is non-blocking (retries with backoff). Webhook URLs must use http/https and resolve to a public host (private/loopback/metadata IPs are blocked at create/update and at delivery). Use the message id from the payload to fetch full content. Payload is camelCase; outer shape matches the Convert API webhook style.
result holds summary fields; fetch full message via GET or POST handle.{
"result": {
"id": "7fa85f64-5717-4562-b3fc-2c963f66afa6",
"inboxId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"inboxHookAddress": "habcd1234-x7z8wq3m5n2kabcd@ainobox.com",
"fromAddress": "sender@example.com",
"subject": "Invoice #12345",
"sizeBytes": 245760,
"receivedAt": "2026-02-20T10:30:00Z",
"isHandled": false,
"hasAttachments": true,
"attachmentCount": 2
}
}IMAP Sources
IMAP sources allow an inbox to automatically pull emails from external mailboxes. Each inbox can have multiple IMAP sources. Fetched emails go through the same pipeline as Cloudflare-delivered emails — same deduplication, attachments, TTL, and webhook notifications.
/api/v1/inbox/{id}/imapRequest Body:
id host username password port useSsl folder fetchIntervalMinutes afterFetchAction Response (201 Created):
{
"id": "4fa85f64-5717-4562-b3fc-2c963f66afa6",
"inboxId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"host": "imap.gmail.com",
"port": 993,
"useSsl": true,
"username": "invoices@mycompany.com",
"folder": "INBOX",
"fetchIntervalMinutes": 5,
"afterFetchAction": "none"
}/api/v1/inbox/{id}/imap/api/v1/inbox/{id}/imap/{imapId}/api/v1/inbox/{id}/imap/{imapId}/api/v1/inbox/{id}/imap/fetchResponse (200 OK):
{
"results": [{
"imapConfigId": "4fa85f64-...",
"success": true,
"fetchedCount": 3,
"ingestedCount": 2,
"errorMessage": null
}]
}/api/v1/inbox/{id}/imap/{imapId}/fetchresults contains one entry. 403 if inbox disabled; 404 if inbox or IMAP config missing.Example Usage
Create inbox
curl -X POST "https://api.ainoflow.io/api/v1/inbox" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Invoice intake", "ttlDays": 30}'List inboxes
curl "https://api.ainoflow.io/api/v1/inbox?page=1&limit=50&sortBy=CreatedAt&sortOrder=Desc" \ -H "Authorization: Bearer YOUR_API_KEY"
Poll for unhandled messages
curl "https://api.ainoflow.io/api/v1/inbox/{id}/messages?isHandled=false&limit=10" \
-H "Authorization: Bearer YOUR_API_KEY"Get message (read-only)
curl "https://api.ainoflow.io/api/v1/inbox/{id}/messages/{messageId}" \
-H "Authorization: Bearer YOUR_API_KEY"Handle a message
curl -X POST "https://api.ainoflow.io/api/v1/inbox/{id}/messages/{messageId}/handle" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Batch handle unhandled messages
curl -X POST "https://api.ainoflow.io/api/v1/inbox/{id}/messages/handle" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"limit": 10}'Delete inbox
curl -X DELETE "https://api.ainoflow.io/api/v1/inbox/{id}" \
-H "Authorization: Bearer YOUR_API_KEY"n8n / Make.com Integration
1. Schedule Trigger (every 5 min):
→ Start polling cycle
2. HTTP Request Node:
GET /api/v1/inbox/{id}/messages?isHandled=false&limit=10
→ Returns unhandled messages with full content
3. Loop / Split In Batches:
→ Process each message
4. For each message:
→ Extract body text, attachments
→ Download attachments via downloadUrl
→ Run business logic (OCR, routing, etc.)
5. HTTP Request Node (after processing):
POST /api/v1/inbox/{id}/messages/{messageId}/handle
→ Mark as handledHTTP Status Codes
Best Practices
Polling Strategy
- • Poll every 1-5 minutes for most use cases
- • Use
isHandled=falsefilter - • Handle messages after processing
Webhook Usage
- • Use webhooks for real-time processing
- • Fetch full content via API after webhook
- • Webhook delivery is non-blocking
Attachment Handling
- • Download URLs included in list/handle responses
- • URLs expire in 1 hour by default
- • Use
/urlendpoint for fresh URLs
Sender Whitelisting
- • Restrict senders for production inboxes
- • Non-whitelisted emails silently rejected
- • Set to null to accept all senders
Ready to Get Started?
Create your free account and start receiving emails in your workflows in minutes.