API version:
  • 1.0
  • 1.1
  • 2.0

accounts

Supported methods

List methods:GETPOST

Instance methods:GETDELETEPOST

Sub-resources

connect_tokens contacts email_addresses files messages sources sync threads webhooks

Accounts list

GET: List of accounts

GET https://api.context.io/2.0/accountstest it

List filters

nametypedescription
optional:
emailstringOnly return account associated to this email address
statusstringOnly return accounts with sources whose status is of a specific value. If an account has many sources, only those matching the given value will be included in the response. Possible statuses are: INVALID_CREDENTIALS, CONNECTION_IMPOSSIBLE, NO_ACCESS_TO_ALL_MAIL, OK, TEMP_DISABLED and DISABLED
status_okintegerSet to 0 to get all accounts with sources that are not working correctly. Set to 1 for the opposite. As for the status filter above, only sources matching the specific value are included in the response.
limitintegerThe maximum number of results to return.
offsetintegerStart the list at this offset (zero-based).

Response body

[
  {
    "id": stringId of the account,
    "username": stringUsername assigned to the account,
    "created": numberUnix timestamp of account creation time,
    "suspended": numberUnix timestamp of account suspension time 0 means not suspended,
    "email_addresses": arrayArray of email addresses for this account,
    "first_name": stringFirst name of account holder,
    "last_name": stringLast name of account holder,
    "password_expired": numberUnix timestamp of user's password expiration. 0 means still valid,
    "sources": arrayList of email accounts where this account gets data from. See sources for details,
    "nb_messages": numberTotal number of messages in all sources of this account,
    "nb_files": numberTotal number of files in all sources of this account
  },
  ...
]

POST: Add a new account

POST https://api.context.io/2.0/accountstest it

Parameters

nametypedescription
required:
emailstringThe primary email address of the account holder.
optional:
first_namestringFirst name of the account holder
last_namestringLast name of the account holder

Response body

{
  "success": booleantrue if account has been created (HTTP status 201), false on error,
  "id": stringId of the account that has been created,
  "resource_url": stringFull URI of resource created
}

Creating an account and a source in a single call

The POST call to create an account also accepts all parameters used to create a source.

Beyond the convenience of doing both operation in a single call, this has the advantage of making error handling easier. If the source parameters aren't valid or don't map to an existing and accessible mailbox, the account isn't created and this call fails.

Response body when creating a source in the same call
{
  "success": booleantrue if account has been created (HTTP status 201), false on error,
  "id": stringId of the account that has been created,
  "resource_url": stringFull URI of resource created,
  "source": {
    "label":stringLabel of the source that has been created,
    "resource_url":stringFull URI of the source created for the account
  }
}

Account instance

GET: Details about a given account

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

Response body

{
  "id": stringId of the account,
  "username": stringUsername assigned to the account,
  "created": numberUnix timestamp of account creation time,
  "suspended": numberUnix timestamp of account suspension time 0 means not suspended,
  "email_addresses": arrayArray of email addresses for this account,
  "first_name": stringFirst name of account holder,
  "last_name": stringLast name of account holder,
  "password_expired": numberUnix timestamp of user's password expiration. 0 means still valid,
  "sources": arrayList of email accounts where this account gets data from. See sources for details,
  "nb_messages": numberTotal number of messages in all sources of this account,
  "nb_files": numberTotal number of files in all sources of this account
}

DELETE: Remove a given account

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

POST/PUT: Modify a given account

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

Parameters

nametypedescription
optional:
first_namestringFirst name of the account holder
last_namestringLast name of the account holder

Response body

{
  "success": booleantrue if account has been updated (HTTP status 200), false on error
}