import Moonbase from '@moonbaseai/sdk';
const client = new Moonbase({
apiKey: process.env['MOONBASE_API_KEY'], // This is the default and can be omitted
});
const inboxMessage = await client.inboxMessages.update('id', {
message: { lock_version: 0, type: 'email_message' },
});
console.log(inboxMessage);require "moonbase"
moonbase = Moonbase::Client.new(api_key: "My API Key")
inbox_message = moonbase.inbox_messages.update("id", message: {lock_version: 0, type: :email_message})
puts(inbox_message)import os
from moonbase import Moonbase
client = Moonbase(
api_key=os.environ.get("MOONBASE_API_KEY"), # This is the default and can be omitted
)
inbox_message = client.inbox_messages.update(
id="id",
message={
"lock_version": 0,
"type": "email_message",
},
)
print(inbox_message)package main
import (
"context"
"fmt"
"github.com/moonbaseai/moonbase-sdk-go"
"github.com/moonbaseai/moonbase-sdk-go/option"
)
func main() {
client := moonbase.NewClient(
option.WithAPIKey("My API Key"),
)
inboxMessage, err := client.InboxMessages.Update(
context.TODO(),
"id",
moonbase.InboxMessageUpdateParams{
OfEmailMessageUpdates: &moonbase.InboxMessageUpdateParamsMessageEmailMessageUpdateParams{
LockVersion: 0,
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", inboxMessage)
}
curl --request PATCH \
--url https://api.moonbase.ai/v0/inbox_messages/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "email_message",
"subject": "Test Subject",
"body": {
"markdown": "This is the body of the message. It supports [markdown](https://en.wikipedia.org/wiki/Markdown)."
},
"to": [
{
"email": "bob@example.com",
"name": "Bob"
},
{
"email": "jack@example.com"
}
],
"cc": [
{
"email": "joe@example.com",
"name": "Joe"
}
],
"bcc": [
{
"email": "steve@example.com",
"name": "Steve"
}
],
"lock_version": 0
}
'{
"id": "1CLJt2v5aNd8G5SGzEaeVU",
"type": "email_message",
"body": {
"markdown": "This is the body of the message. It supports [markdown](https://en.wikipedia.org/wiki/Markdown)."
},
"addresses": [
{
"id": "1CLJt2v7opRhSWqVEtHwYT",
"type": "email_message_address",
"email": "person-366@example-366.com",
"role": "from"
},
{
"id": "1CLJt2vEzvEeoG1qPRazvx",
"type": "email_message_address",
"email": "bob@example.com",
"role": "to",
"person": {
"id": "1CLJt2vGyyqc4yvgwnDhsA",
"type": "item",
"collection": {
"id": "1CLJt2ubZ7zAZFBxUxeBHo",
"type": "collection",
"ref": "people"
}
},
"organization": {
"id": "1CLJt2vFzT38S7yGAbuMQ4",
"type": "item",
"collection": {
"id": "1CLJt2uco2zG6pdjxS37sg",
"type": "collection",
"ref": "organizations"
}
}
},
{
"id": "1CLJt2vFFJSGhyWC5ifb3j",
"type": "email_message_address",
"email": "jack@example.com",
"role": "to",
"person": {
"id": "1CLJt2vLCxSetHHKycFMPF",
"type": "item",
"collection": {
"id": "1CLJt2ubZ7zAZFBxUxeBHo",
"type": "collection",
"ref": "people"
}
},
"organization": {
"id": "1CLJt2vFzT38S7yGAbuMQ4",
"type": "item",
"collection": {
"id": "1CLJt2uco2zG6pdjxS37sg",
"type": "collection",
"ref": "organizations"
}
}
},
{
"id": "1CLJt2vFVgdtcgzYn1kBAW",
"type": "email_message_address",
"email": "joe@example.com",
"role": "cc",
"person": {
"id": "1CLJt2vNSQFE4igYEFxeSE",
"type": "item",
"collection": {
"id": "1CLJt2ubZ7zAZFBxUxeBHo",
"type": "collection",
"ref": "people"
}
},
"organization": {
"id": "1CLJt2vFzT38S7yGAbuMQ4",
"type": "item",
"collection": {
"id": "1CLJt2uco2zG6pdjxS37sg",
"type": "collection",
"ref": "organizations"
}
}
},
{
"id": "1CLJt2vFk4qWXQUuUJpmHH",
"type": "email_message_address",
"email": "steve@example.com",
"role": "bcc",
"person": {
"id": "1CLJt2vQvEFR9sa7BCkXbz",
"type": "item",
"collection": {
"id": "1CLJt2ubZ7zAZFBxUxeBHo",
"type": "collection",
"ref": "people"
}
},
"organization": {
"id": "1CLJt2vFzT38S7yGAbuMQ4",
"type": "item",
"collection": {
"id": "1CLJt2uco2zG6pdjxS37sg",
"type": "collection",
"ref": "organizations"
}
}
}
],
"conversation": {
"id": "1CLJt2v6592N5WQzNpjpj2",
"type": "inbox_conversation",
"created_at": "2025-02-17T16:00:00.000Z",
"updated_at": "2025-02-17T16:00:00.000Z",
"tags": [],
"subject": "Test Subject",
"last_message_at": "2025-02-17T16:00:00.000Z",
"state": "unassigned",
"follow_up": false,
"unread": true,
"bulk": false,
"spam": false,
"trash": false,
"draft": true
},
"lock_version": 1,
"created_at": "2025-02-17T16:00:00.000Z",
"unread": true,
"bulk": false,
"spam": false,
"trash": false,
"draft": true,
"subject": "Test Subject"
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "400",
"title": "Bad Request",
"detail": "The request could not be understood due to malformed syntax or invalid parameters."
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "401",
"title": "Unauthorized",
"detail": "Invalid or missing API key or JWT. You should provide your Moonbase API Key or JWT in the authorization header, in the format: \"Authorization: Bearer MOONBASE_API_KEY\""
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "403",
"title": "Forbidden"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "404",
"title": "Not Found"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "409",
"title": "Conflict",
"detail": "Resource was modified since your last read.",
"meta": {
"current_lock_version": 0
}
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "422",
"title": "Unprocessable Entity",
"detail": "Only draft messages can be updated"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "429",
"title": "Too Many Requests"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "500",
"title": "Internal Server Error"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "503",
"title": "Service Unavailable",
"detail": "The service is temporarily unavailable, please try again later."
}
]
}Update a Draft
Updates an existing message draft.
import Moonbase from '@moonbaseai/sdk';
const client = new Moonbase({
apiKey: process.env['MOONBASE_API_KEY'], // This is the default and can be omitted
});
const inboxMessage = await client.inboxMessages.update('id', {
message: { lock_version: 0, type: 'email_message' },
});
console.log(inboxMessage);require "moonbase"
moonbase = Moonbase::Client.new(api_key: "My API Key")
inbox_message = moonbase.inbox_messages.update("id", message: {lock_version: 0, type: :email_message})
puts(inbox_message)import os
from moonbase import Moonbase
client = Moonbase(
api_key=os.environ.get("MOONBASE_API_KEY"), # This is the default and can be omitted
)
inbox_message = client.inbox_messages.update(
id="id",
message={
"lock_version": 0,
"type": "email_message",
},
)
print(inbox_message)package main
import (
"context"
"fmt"
"github.com/moonbaseai/moonbase-sdk-go"
"github.com/moonbaseai/moonbase-sdk-go/option"
)
func main() {
client := moonbase.NewClient(
option.WithAPIKey("My API Key"),
)
inboxMessage, err := client.InboxMessages.Update(
context.TODO(),
"id",
moonbase.InboxMessageUpdateParams{
OfEmailMessageUpdates: &moonbase.InboxMessageUpdateParamsMessageEmailMessageUpdateParams{
LockVersion: 0,
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", inboxMessage)
}
curl --request PATCH \
--url https://api.moonbase.ai/v0/inbox_messages/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "email_message",
"subject": "Test Subject",
"body": {
"markdown": "This is the body of the message. It supports [markdown](https://en.wikipedia.org/wiki/Markdown)."
},
"to": [
{
"email": "bob@example.com",
"name": "Bob"
},
{
"email": "jack@example.com"
}
],
"cc": [
{
"email": "joe@example.com",
"name": "Joe"
}
],
"bcc": [
{
"email": "steve@example.com",
"name": "Steve"
}
],
"lock_version": 0
}
'{
"id": "1CLJt2v5aNd8G5SGzEaeVU",
"type": "email_message",
"body": {
"markdown": "This is the body of the message. It supports [markdown](https://en.wikipedia.org/wiki/Markdown)."
},
"addresses": [
{
"id": "1CLJt2v7opRhSWqVEtHwYT",
"type": "email_message_address",
"email": "person-366@example-366.com",
"role": "from"
},
{
"id": "1CLJt2vEzvEeoG1qPRazvx",
"type": "email_message_address",
"email": "bob@example.com",
"role": "to",
"person": {
"id": "1CLJt2vGyyqc4yvgwnDhsA",
"type": "item",
"collection": {
"id": "1CLJt2ubZ7zAZFBxUxeBHo",
"type": "collection",
"ref": "people"
}
},
"organization": {
"id": "1CLJt2vFzT38S7yGAbuMQ4",
"type": "item",
"collection": {
"id": "1CLJt2uco2zG6pdjxS37sg",
"type": "collection",
"ref": "organizations"
}
}
},
{
"id": "1CLJt2vFFJSGhyWC5ifb3j",
"type": "email_message_address",
"email": "jack@example.com",
"role": "to",
"person": {
"id": "1CLJt2vLCxSetHHKycFMPF",
"type": "item",
"collection": {
"id": "1CLJt2ubZ7zAZFBxUxeBHo",
"type": "collection",
"ref": "people"
}
},
"organization": {
"id": "1CLJt2vFzT38S7yGAbuMQ4",
"type": "item",
"collection": {
"id": "1CLJt2uco2zG6pdjxS37sg",
"type": "collection",
"ref": "organizations"
}
}
},
{
"id": "1CLJt2vFVgdtcgzYn1kBAW",
"type": "email_message_address",
"email": "joe@example.com",
"role": "cc",
"person": {
"id": "1CLJt2vNSQFE4igYEFxeSE",
"type": "item",
"collection": {
"id": "1CLJt2ubZ7zAZFBxUxeBHo",
"type": "collection",
"ref": "people"
}
},
"organization": {
"id": "1CLJt2vFzT38S7yGAbuMQ4",
"type": "item",
"collection": {
"id": "1CLJt2uco2zG6pdjxS37sg",
"type": "collection",
"ref": "organizations"
}
}
},
{
"id": "1CLJt2vFk4qWXQUuUJpmHH",
"type": "email_message_address",
"email": "steve@example.com",
"role": "bcc",
"person": {
"id": "1CLJt2vQvEFR9sa7BCkXbz",
"type": "item",
"collection": {
"id": "1CLJt2ubZ7zAZFBxUxeBHo",
"type": "collection",
"ref": "people"
}
},
"organization": {
"id": "1CLJt2vFzT38S7yGAbuMQ4",
"type": "item",
"collection": {
"id": "1CLJt2uco2zG6pdjxS37sg",
"type": "collection",
"ref": "organizations"
}
}
}
],
"conversation": {
"id": "1CLJt2v6592N5WQzNpjpj2",
"type": "inbox_conversation",
"created_at": "2025-02-17T16:00:00.000Z",
"updated_at": "2025-02-17T16:00:00.000Z",
"tags": [],
"subject": "Test Subject",
"last_message_at": "2025-02-17T16:00:00.000Z",
"state": "unassigned",
"follow_up": false,
"unread": true,
"bulk": false,
"spam": false,
"trash": false,
"draft": true
},
"lock_version": 1,
"created_at": "2025-02-17T16:00:00.000Z",
"unread": true,
"bulk": false,
"spam": false,
"trash": false,
"draft": true,
"subject": "Test Subject"
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "400",
"title": "Bad Request",
"detail": "The request could not be understood due to malformed syntax or invalid parameters."
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "401",
"title": "Unauthorized",
"detail": "Invalid or missing API key or JWT. You should provide your Moonbase API Key or JWT in the authorization header, in the format: \"Authorization: Bearer MOONBASE_API_KEY\""
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "403",
"title": "Forbidden"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "404",
"title": "Not Found"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "409",
"title": "Conflict",
"detail": "Resource was modified since your last read.",
"meta": {
"current_lock_version": 0
}
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "422",
"title": "Unprocessable Entity",
"detail": "Only draft messages can be updated"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "429",
"title": "Too Many Requests"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "500",
"title": "Internal Server Error"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "503",
"title": "Service Unavailable",
"detail": "The service is temporarily unavailable, please try again later."
}
]
}Authorizations
Your Moonbase API key.
Path Parameters
The ID of the message to update.
Body
The Message values to update.
- EmailMessageUpdateParams
- SlackMessageUpdateParams
Parameters for updating a draft message in an existing conversation.
"email_message"The current lock version of the draft for optimistic concurrency control.
The subject line of the email.
The email body.
Show child attributes
Show child attributes
A list of the recipients.
Show child attributes
Show child attributes
A list of the CC recipients.
Show child attributes
Show child attributes
A list of the BCC recipients.
Show child attributes
Show child attributes
Response
Update succeeded.
- EmailMessage
- SlackMessage
The Email Message object represents a single email within a Conversation.
String representing the object’s type. Always email_message for this object.
"email_message"Unique identifier for the object.
The current lock version of the message for optimistic concurrency control.
The time the message was received, as an ISO 8601 timestamp in UTC.
true if the message has not been read.
true if the message appears to be part of a bulk mailing.
true if the message is classified as spam.
true if the message is in the trash.
true if the message is a draft that has not been sent.
The subject line of the email.
Structured content that can be rendered in multiple formats, currently supporting Markdown.
Show child attributes
Show child attributes
A concise, system-generated summary of the email content.
A list of Address objects associated with the message (sender and recipients).
Note: Only present when requested using the include query parameter.
Show child attributes
Show child attributes
A list of Attachment objects on the message.
Note: Only present when requested using the include query parameter.
Show child attributes
Show child attributes
The Conversation thread this message is part of.
Note: Only present when requested using the include query parameter.
Show child attributes
Show child attributes

