Skip to content

Update a message

PATCH
/v1/messages/{id}
curl --request PATCH \
--url https://api.inboxcnx.com/v1/messages/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "keywords": { "$seen": true }, "labels": { "add": [ "archive", "Label_12" ] } }'

Changes a message’s read state, flags, archive and labels in the end user’s mailbox, to act on mail from your application. Runs against the mailbox at the provider, never only on the stored copy. The answer and a GET right after show the new state. message.updated follows for every grant on the mailbox once the provider reports the change.

keywords sets or clears $seen, $flagged, $important. labels.add / labels.remove take the roles inbox and archive and the mailbox’s custom label ids. Trash and spam have their own endpoints. sent, drafts, trash, junk and $junk are refused.

Requires the modify:messages scope.

id
required
string format: uuid
Media typeapplication/json
object
keywords
object
key
additional properties
boolean
labels
object
add
Array<string>
<= 100 items
remove
Array<string>
<= 100 items

Example

{
"keywords": {
"$seen": true
},
"labels": {
"add": [
"archive",
"Label_12"
]
}
}

The message’s new state

Media typeapplication/json
object
id
required
string
keywords
required
object
key
additional properties
boolean
labels
required
object
system
required
Array<string>
Allowed values: inbox archive drafts sent trash junk all flagged important
custom
required
Array<string>
stateAt
required
string | null

Example

{
"labels": {
"system": [
"inbox"
]
}
}

Invalid body. unknown_labels: the mailbox has no label with these ids

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

The credential lacks the modify:messages scope

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

message_not_found: no such message. provider_message_not_found: the provider no longer has it

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

message_deleted: the mail is deleted at the provider. connection_unreadable: the mailbox cannot be reached and may need a reconnect. connection_scope_missing: the end user did not grant the scope the action needs, named in scope. A reconnect grants it

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

provider_unavailable: the provider is down or rate-limits the mailbox. Retry after Retry-After seconds

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}