users/email_accounts/folders/messages

Supported methods

List methods:GET

Instance methods:GETPUT

Sub-resources

attachments body flags headers raw read webhook_info

Messages list

GET: Listings of email messages for a user

GET https://api.context.io/lite
/users/id/email_accounts/label/folders/folder/messagestest it
idUnique id of a user accessible through your API key
labelThe label property of the email account instance. You can use 0 as an alias for the first email account of a user.
folderThe full folder path using / as the path hierarchy delimiter.

Parameters

nametypedescription
optional:
delimiterstringIf / isn't fancy enough as a hierarchy delimiter when specifying the folder you want to obtain, you're free to use what you want, just make sure you set this delimiter parameter to tell us what you're using.
include_bodyintegerSet to 1 to include message bodies in the result.
body_typestringUsed when include_body is set to get only body parts of a given MIME-type (for example text/html)
include_headersmixedCan be set to 0 (default), 1 or raw. If set to 1, complete message headers, parsed into an array, are included in the results. If set to raw, the headers are included as a raw unparsed string.
include_flagsintegerSet to 1 to include flags for this message in the result.
limitintegerThe maximum number of results to return. The maximum limit is 100.
offsetintegerStart the list at this offset (zero-based).

Response body

[
  {
    "sent_at": numberUnix timestamp of message's DATE header. Since this is set by the sender, it might be wrong.,
    "received_at": numberUnix timestamp of the message's most recent RECEIVED header. Since this is set by the user's email server, it is usually more accurate than sent_at. (Not implemented),
    "addresses": objectEmail addresses and names of sender and recipients (more details),
    "person_info": objectAdditional info about contacts on this message (more details),
    "email_message_id": stringValue of RFC-822 Message-ID header,
    "attachments": [
      {
        "size": numberSize of file in bytes.,
        "type": stringMIME type as specified in message source,
        "file_name": stringName of file,
        "body_section": stringMIME section this file can be found in (useful only if you're parsing raw source),
        "content_disposition": stringValue of the Content-Disposition header of the MIME part containing this file, if specified. Typically 'inline' or 'attachment',
        "email_message_id": stringValue of RFC-822 Message-ID header this file is attached to,
        "x_attachment_id": stringValue of the X-Attachment-Id header of the MIME part containing this file, if specified. A random unique string which differentiates this attachment from others.,
        "attachment_id": numberThe index of the attachment. Used for retrieving the actual file
      },
      ...
    ],
    "subject": stringSubject of the message,
    "folders": arrayList of folders (or Gmail labels) this message is found in,
    "message_id": stringThe Message ID - use this value to construct message instance URL's,
    "list_headers": arrayHeaders starting with List-,
    "in_reply_to": stringThe 'In-Reply-To' header value.,
    "references": arrayThe 'References' header value.,
    "received_headers": arrayThe 'Received' header values,
    "resource_url": stringThe URL of the message list resource,
  },
  ...
]

Message instance

GET: File, contact and other information about a given email message

GET https://api.context.io/lite
/users/id/email_accounts/label/folders/folder/messages/message_idtest it
idUnique id of a user accessible through your API key
labelThe label property of the email account instance. You can use 0 as an alias for the first email account of a user.
folderThe full folder path using / as the path hierarchy delimiter.
message_idUnique id of a message. This must be a email_message_id of an existing message in the thread.

The < and > at the beginning and end of the Message-ID are part of the value and should be included if you're putting an email_message_id in the url.

Parameters

nametypedescription
optional:
delimiterstringIf / isn't fancy enough as a hierarchy delimiter when specifying the folder you want to obtain, you're free to use what you want, just make sure you set this delimiter parameter to tell us what you're using.
include_bodyintegerSet to 1 to include the message body in the result.
include_headersmixedCan be set to 0 (default), 1 or raw. If set to 1, complete message headers, parsed into an array, are included in the results. If set to raw, the headers are included as a raw unparsed string.
include_flagsintegerSet to 1 to include flags for this message in the result.
body_typestringUsed when include_body is set to get only body parts of a given MIME-type (for example text/html)

Response body

{
  "sent_at": numberUnix timestamp of message's DATE header. Since this is set by the sender, it might be wrong.,
  "received_at": numberUnix timestamp of the message's most recent RECEIVED header. Since this is set by the user's email server, it is usually more accurate than sent_at. (Not implemented),
  "addresses": objectEmail addresses and names of sender and recipients (more details),
  "person_info": objectAdditional info about contacts on this message (more details),
  "email_message_id": stringValue of RFC-822 Message-ID header,
  "attachments": [
    {
      "size": numberSize of file in bytes.,
      "type": stringMIME type as specified in message source,
      "file_name": stringName of file,
      "body_section": stringMIME section this file can be found in (useful only if you're parsing raw source),
      "content_disposition": stringValue of the Content-Disposition header of the MIME part containing this file, if specified. Typically 'inline' or 'attachment',
      "email_message_id": stringValue of RFC-822 Message-ID header this file is attached to,
      "x_attachment_id": stringValue of the X-Attachment-Id header of the MIME part containing this file, if specified. A random unique string which differentiates this attachment from others.,
      "attachment_id": numberThe index of the attachment. Used for retrieving the actual file
    },
    ...
  ],
  "subject": stringSubject of the message,
  "folders": arrayList of folders (or Gmail labels) this message is found in,
  "message_id": stringThe Message ID - use this value to construct message instance URL's,
  "list_headers": arrayHeaders starting with List-,
  "in_reply_to": stringThe 'In-Reply-To' header value.,
  "references": arrayThe 'References' header value.,
  "received_headers": arrayThe 'Received' header values,
  "resource_url": stringThe URL of the message list resource,
}

PUT: Move a message

This call allows you to move a message to a different folder.

PUT https://api.context.io/lite
/users/id/email_accounts/label/folders/folder/messages/message_idtest it
idUnique id of a user accessible through your API key
labelThe label property of the email account instance. You can use 0 as an alias for the first email account of a user.
folderThe full folder path using / as the path hierarchy delimiter.
message_idUnique id of a message. This must be a email_message_id of an existing message in the thread.

Parameters

nametypedescription
required:
new_folder_idstringSpecifies the destination folder for the message move.
optional:
delimiterstringIf / isn't fancy enough as a hierarchy delimiter when specifying the folder you want to obtain, you're free to use what you want, just make sure you set this delimiter parameter to tell us what you're using.

Response body

{
  "success": booleantrue if message has been moved successfully (HTTP status 200), false on error
}