accounts/threads

Supported methods

List methods:GET

Instance methods:GETDELETE

Threads list

GET: List of threads on an account

GET https://api.context.io/2.0/accounts/id/threadstest it
idUnique id of an account accessible through your API key

List filters

nametypedescription
optional:
subjectstringGet threads with messages whose subject matches this search string. To use regular expressions instead of simple string matching, make sure the string starts and ends with /.
emailstringEmail address of the contact for whom you want the latest threads. This value is interpreted as received from email X, sent to email X or sent by anyone to both email X and the source owner.
tostringGet threads with at least one message sent to this email address.
fromstringGet threads with at least one message sent from this email address.
ccstringGet threads with at least one message having this email address CC'ed.
bccstringGet threads with at least one message having this email address BCC'ed.
folderstringFilter threads by the folder (or Gmail label). This parameter can be the complete folder name with the appropriate hierarchy delimiter for the mail server being queried (eg. Inbox/My folder) or the "symbolic name" of the folder (eg. \Starred). The symbolic name refers to attributes used to refer to special use folders in a language-independent way. See RFC-6154.
indexed_beforeinteger
(Unix timestamp)
Get threads with at least one message indexed before this timestamp. This is not the same as the date of the email, it is the time Context.IO indexed this message.
indexed_afterinteger
(Unix timestamp)
Get threads with at least one message indexed after this timestamp. This is not the same as the date of the email, it is the time Context.IO indexed this message.
active_beforeinteger
(Unix timestamp)
Get threads with at least one message dated before this timestamp. The value this filter is applied to is the Date: header of the message which refers to the time the message is sent from the origin.
active_afterinteger
(Unix timestamp)
Get threads with at least one message dated after this timestamp. The value this filter is applied to is the Date: header of the message which refers to the time the message is sent from the origin.
started_beforeinteger
(Unix timestamp)
Get threads whose first message is dated before this timestamp. The value this filter is applied to is the Date: header of the message which refers to the time the message is sent from the origin.
started_afterinteger
(Unix timestamp)
Get threads whose first message is dated after this timestamp. The value this filter is applied to is the Date: header of the message which refers to the time the message is sent from the origin.
limitintegerThe maximum number of results to return. The maximum limit is 100.
offsetintegerStart the list at this offset (zero-based).

Response body

[
  stringComplete URL of a thread this contact is in,
  ...
]

Thread instance

GET: Returns files, contacts and messages on a given thread

The purpose of this call is to allow Gmail extensions to easily retrieve data when users's load a conversation in the Gmail UI. Hence, threads are identified by the value of their Gmail thread prefixed with "gm-".

GET https://api.context.io/2.0/accounts/id/threads/thread_idtest it
idUnique id of an account accessible through your API key
thread_idA gmail_thread_id prefixed with gm-

For example, if the URL of a conversation in the Gmail UI is https://mail.google.com/mail/u/0/#mbox/13119ab37f00b826, you would obtain the details about this thread by calling:

GET https://api.context.io/2.0/accounts/<accountId>/threads/gm-13119ab37f00b826

Parameters

nametypedescription
optional:
include_bodyintegerSet to 1 to include message bodies in the result. Since message bodies must be retrieved from the IMAP server, expect a performance hit when setting this parameter.
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 also included but as a raw unparsed string. Since full original headers bodies must be retrieved from the IMAP server, expect a performance hit when setting this parameter.
include_flagsintegerSet to 1 to include IMAP flags of messages in the result. Since message flags must be retrieved from the IMAP server, expect a performance hit when setting this parameter.
body_typestringUsed when include_body is set to get only body parts of a given MIME-type (for example text/html)
include_sourceintegerSet to 1 to include message sources in the result. Since message sources must be retrieved from the IMAP server, expect a performance hit when setting this parameter.
limitintegerThe maximum number of messages to include in the messages property of the response. The maximum limit is 100.
offsetintegerStart the list of messages at this offset (zero-based).

What about threads on non-Gmail mailboxes?

You can retrieve thread information for any message using the Thread resource of that message.

Response body

{
  "gmail_thread_id": stringThread id assigned by Gmail (only present if source is a Gmail account),
  "email_message_ids": arrayList of email_message_ids forming the thread,
  "person_info": objectAdditional info about contacts on this message (more details),
  "messages": [
    {
      "date": numberUnix timestamp of message date,
      "date_indexed": numberTime this message was first seen by Context.IO (Unix timestamp),
      "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,
      "message_id": stringUnique and persistent id assigned by Context.IO to the message,
      "gmail_message_id": stringMessage id assigned by Gmail (only present if source is a Gmail account),
      "gmail_thread_id": stringThread id assigned by Gmail (only present if source is a Gmail account),
      "files": [
        {
          "size": numberSize of the attachment in bytes,
          "type": stringValue of Content-type header for the attachment,
          "file_name": stringFull name of the file attached,
          "file_name_structure": arrayName of the file broken down in semantic parts (more details),
          "body_section": stringIdentifies MIME body part the attachment can be found in,
          "file_id": stringUnique and persistent id assigned by Context.IO to the file,
          "is_embedded": booleanIndicates whether this file is an object embedded in the message or not,
          "content_disposition": stringValue of the Content-Disposition header of the MIME part containing this file, if specified. Typically 'inline' or 'attachment',
          "content_id": stringIf this file is an embedded object, this is the value of the Content-Id header of the MIME part containing this file
        },
        ...
      ],
      "subject": stringSubject of the message,
      "folders": arrayList of folders (or Gmail labels) this message is found in,
      "sources": [
        {
          "label": stringLabel of the source containing this message,
          "resource_url": stringComplete URL of the source
        },
        ...
      ]
    },
    ...
  ]
}

DELETE: Delete a thread

DELETE https://api.context.io/2.0/accounts/id/threads/thread_idtest it
idUnique id of an account accessible through your API key
thread_idA gmail_thread_id prefixed with gm-