Skip to main content
GET
/
inbox_messages
JavaScript
import Moonbase from '@moonbaseai/sdk';

const client = new Moonbase({
  apiKey: process.env['MOONBASE_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const emailMessage of client.inboxMessages.list()) {
  console.log(emailMessage.id);
}
{
"type": "list",
"data": [
{
"id": "1CLJt2vJy3SZLhqYW8rQoN",
"type": "email_message",
"body": {
"markdown": "html"
},
"created_at": "2025-02-17T16:00:00.000Z",
"unread": false,
"bulk": false,
"spam": false,
"trash": false,
"draft": false,
"subject": "subject",
"summary": "Summary"
},
{
"id": "1CLJt2vA3GEGcxEhVY1EbS",
"type": "email_message",
"body": {
"markdown": "html"
},
"created_at": "2025-02-17T16:00:00.000Z",
"unread": false,
"bulk": false,
"spam": false,
"trash": false,
"draft": false,
"subject": "subject",
"summary": "Summary"
},
{
"id": "1CLJt2v17V1yuCdrUwA4PW",
"type": "email_message",
"body": {
"markdown": "html"
},
"created_at": "2025-02-17T16:00:00.000Z",
"unread": false,
"bulk": false,
"spam": false,
"trash": false,
"draft": false,
"subject": "subject",
"summary": "Summary"
}
],
"meta": {
"cursors": {}
}
}

Authorizations

Authorization
string
header
required

Your Moonbase API key.

Query Parameters

before
string

When specified, returns results starting immediately before the item identified by this cursor. Use the cursor value from the response's metadata to fetch the previous page of results.

after
string

When specified, returns results starting immediately after the item identified by this cursor. Use the cursor value from the previous response's metadata to fetch the next page of results.

limit
integer
default:20

Maximum number of items to return per page. Must be between 1 and 100. Defaults to 20 if not specified.

Required range: 1 <= x <= 100
include[]
enum<string>[]

Specifies which related objects to include in the response. Valid options are addresses, attachments, and conversation.

Available options:
addresses,
attachments,
conversation
filter
object

Response

Successful response.

A set of results using cursor-based pagination.

type
string
required
Allowed value: "list"
data
EmailMessage · object[]
required

An array of EmailMessage items.

meta
object
required

Metadata about the pagination, including the cursors pointing to the previous and next pages.