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:
Authorization: Basic <base64 of "key:">(curl:-u "$MAILSHAKE_API_KEY:");apiKeyas a query-string or body parameter. Avoid it: query strings end up in logs.
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:
- Send the user to
https://app.mailshake.com/oauth/withresponse_type=code, yourclient_id,redirect_uri,scopeandstate. - Exchange the code at
POST https://api.mailshake.com/2017-04-01/token(form-encoded,grant_type=authorization_code). - Call the API with
Authorization: Bearer <access token>. Refresh withgrant_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.