Authentication

API key (your own team)

Send your team's API key as a Bearer token. This is the recommended form:

# expect 200
curl -sS https://api.mailshake.com/2017-04-01/me \
  -H "Authorization: Bearer $MAILSHAKE_API_KEY"

An API key acts as the team's first enabled admin and has every scope.

These older forms still work but are deprecated:

An invalid key answers 401 invalid_api_key. The key is never repeated back.

OAuth 2 (apps used by other teams)

Apps that act for other Mailshake teams use OAuth 2 with the authorization-code grant:

  1. Send the user to https://app.mailshake.com/oauth/ with response_type=code, your client_id, redirect_uri, scope and state.
  2. Exchange the code at POST https://api.mailshake.com/2017-04-01/token (form-encoded, grant_type=authorization_code).
  3. Call the API with Authorization: Bearer <access token>. Refresh with grant_type=refresh_token.

Request only the scopes you need. The access token only reaches the team that approved it.

The same header for both

Authorization: Bearer <value> takes either an API key or an OAuth access token. A value that is not an API key is checked as an OAuth access token.