API version:
  • 1.0
  • 1.1
  • 2.0

This API version isn't the latest one.

It is advisable to use the latest API version which contains the latest Context.IO enhancements.

GET contactmessages.json

This call returns list of email messages for one or more contacts.

You can use the email parameter to get the latest email messages exchanged with one or more email addresses. By "exchanged with contact X" we mean any email received from contact X, sent to contact X or sent by anyone to both contact X and the mailbox owner.

Alternatively, you can get more precise results using a combination of the to, from and cc parameters.

GET https://api.context.io/1.1/contactmessages.json

Parameters

Each of the email, to, from, cc and bcc parameters can be set to a comma-separated list of email addresses. These multiple addresses are treated as an OR combination.

You can set more than one parameter when doing this call. Multiple parameters are treated as an AND combination.

email

Email address of the contact for whom you want the latest emails exchanged with. By "exchanged with contact X" we mean any email received from contact X, sent to contact X or sent by anyone to both contact X and the mailbox owner.

to

Email address of a contact messages have been sent to.

from

Email address of a contact messages have been received from.

cc

Email address of a contact CC'ed on the messages.

bcc

Email address of a contact BCC'ed on the messages.

limit

Integer representing the maximum number of results to return. Its default value (if not specified) is 25.

account

The email address of the account you want to get data from. This parameter must be set if your API key has access to more than one email account (see imap/addaccount).

Examples

Getting a summary of email communication with Jim Davis at ACME which happens to use jim@acme.com and jim.davis@acme.com as email addresses:

GET https://api.context.io/1.1/contactmessages.json?email=jim%40acme.com,jim.davis%40acme.com

Getting messages sent to either jim@acme.com and bob@widgets.com:

GET https://api.context.io/1.1/contactmessages.json?to=jim%40acme.com,bob%40widgets.com

Getting messages received from jim@acme.com on which bob@widgets.com was CCed:

GET https://api.context.io/1.1/contactmessages.json?from=jim%40acme.com&cc=bob%40widgets.com

Response

The response is a list of emails:

{
  ...
  data: [
    {
      emailMessageId: (string) Value of Message-ID header of the message,
      date: (integer) Sent time of the message (unix timestamp),
      subject: (string) Subject of the message ,
      gmailMessageId: (string) Only applicable for Gmail/Google Apps mailboxes,
      gmailThreadId: (string) Only applicable for Gmail/Google Apps mailboxes,
      addresses: (object) Information about the sender and recipient(s) of the message, see details below,
      personInfo: (object) Information about the sender and recipient(s) of the message, see details below,
      files: [
        {
          fileId: (string) Unique ID assigned to that file,
          fileName: (string) Name of the file,
          fileNameStructure: (array) Name of the file broken down into its semantic parts, see details below,
          size: (integer) Size of the file in bytes,
          supportsPreview: (boolean) If TRUE, you can show a preview of that file, see details below,
          type: (string) MIME type of the file as specified in header of the message body part containing the attachment,
        },
        ...
      ]
    },
    ...
  ]
}

addresses

Indicates information about the sender and recipient(s) of the message. See message addresses information for more information.

personInfo

Indicates information about the sender and recipient(s) of the message. See message person information for more information.

files[i].fileNameStructure

This property is an array representing the file name broken down in its semantic parts. It can be used to assign styles to highlight these different parts of the file name. See Breaking down file names for more information.

files[i].supportsPreview

Our API offers web based file previews for many common file types, see here for more information. This property indicates whether it can be used for this particular occurrence.

files[i].type

MIME types are returned as they are specified in the message source except for cases where the specified type is application/octet-stream. In that case, we check the file extension and override the MIME type with a more precise one if possible.