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. The maximum limit is 100.
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,
    "resource_url": stringURI which identifies this account,
  },
  ...
]

POST: Add a new account

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

Parameters

nametypedescription
optional:
emailstringThe primary email address of the account holder. Either email or migrate_account_id must be specified
migrate_account_idstringExisting user_id (from lite) you want to migrate to 2.0. Either migrate_account_id or email must be specified
first_namestringFirst name of the account holder
last_namestringLast name of the account holder

If you are handling OAuth authorization yourself and pass the refresh token to Context.IO there are some third party requirements (e.g. Google, Microsoft) to take note of, see OAuth provider scope.

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
  If your key uses 3-legged signatures, the following 2 properties are added
  "access_token": stringOAuth access token to sign all future requests on this newly created account,
  "access_token_secret": stringOAuth access token secret to sign all future requests on this newly created account
}

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
  }
  If your key uses 3-legged signatures, the following 2 properties are added
  "access_token": stringOAuth access token to sign all future requests on this newly created account,
  "access_token_secret": stringOAuth access token secret to sign all future requests on this newly created 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

Parameters

nametypedescription
optional:
include_nb_filesintegerSet to 1 to include the total number of files in all sources of this account.

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
}

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
}