API version:
  • 1.0
  • 1.1
  • 2.0

accounts/messages/flags

Supported methods

GETPOST

The Flags resource allows you set to retrieve and set flags that indicate, among others, if the message has been read.

You can find detailed explanation about each IMAP message flags here: http://tools.ietf.org/html/rfc3501#section-2.3.2.

GET: Message flags

GET https://api.context.io/2.0/accounts/id/messages/message_id/flagstest it
idUnique id of an account accessible through your API key
message_idUnique id of a message. This can be the message_id or email_message_id property of the message. The gmail_message_id (prefixed with gm-) can also be used.
On-demand data retrieval

To ensure up-to-date values, flags are not cached by Context.IO. This call triggers a connection to the IMAP server to fetch the current message flags before it returns.

Response body

{
  "seen": booleanwhether or not a message has been viewed,
  "answered": booleanwhether or not a message has been replied to,
  "flagged": booleanwhether or not a message has been flagged,
  "deleted": booleanwhether or not a message has been deleted,
  "draft": booleanwhether or not a message is in draft mode,
  "nonjunk": booleanwhether or not a message has been flagged as "junk" mail,
}

If you want to fetch headers, body and flags for a given message, you can use the related include_* GET parameters on the message instance to get them all in a single call.

POST: Set message flags for a given email

POST https://api.context.io/2.0/accounts/id/messages/message_id/flagstest it
idUnique id of an account accessible through your API key
message_idUnique id of a message. This can be the message_id or email_message_id property of the message. The gmail_message_id (prefixed with gm-) can also be used.

Parameters

nametypedescription
optional:
seenintegerMessage has been read. Set this parameter to 1 to set the flag, 0 to unset it.
answeredintegerMessage has been answered. Set this parameter to 1 to set the flag, 0 to unset it.
flaggedintegerMessage is "flagged" for urgent/special attention. Set this parameter to 1 to set the flag, 0 to unset it.
deletedintegerMessage is "deleted" for later removal. An alternative way of deleting messages is to move it to the Trash folder. Set this parameter to 1 to set the flag, 0 to unset it.
draftintegerMessage has not completed composition (marked as a draft). Set this parameter to 1 to set the flag, 0 to unset it.

Response body

{
  "success":  booleanwhether or not a flag was succesfully set,
  "flags": objectNew state of all IMAP flags, see GET above for details
}