Version 2 of our API uses key-based access control.
The simplest way of creating an API key is through the Manage Admins area of your account, in much the same way that regular users are managed. API keys can be assigned the same permission levels as regular users. They can also be restricted by expiry date or IP address.
API keys can also be obtained using OAuth2 with either the Authorization Code grant type or the Resource Owner Password grant type. Although this is more complex, it provides a more seamless user experience when developing an application that integrates with Simplelists. Users are redirected from your application to Simplelists to log in and, once authenticated, are redirected back to your application with the required access token.
API keys are very powerful and should be protected in the same way as passwords.
Once a key is created, it is used by adding it to an HTTP
request in an Authorization header.
The header can be added either as
HTTP Basic Authentication
or as an OAuth2 Bearer token.
When using HTTP Basic Authentication, provide your API key as the basic auth username value. A password does not need to be provided.
Authorization: Bearer CAJgeo1bepNW2bpQWPDlrnhT8hwOAZCE
curl https://www.simplelists.com/api/2/contacts/ -u CAJgeo1bepNW2bpQWPDlrnhT8hwOAZCE:
curl https://www.simplelists.com/api/2/contacts/ -H 'Authorization: Bearer CAJgeo1bepNW2bpQWPDlrnhT8hwOAZCE'
The Authorization Code grant type should be used when you are creating a web application that may be deployed on a server that you or the user will not necessarily trust. By using this grant type, the application will have no knowledge of the Simplelists username and password; it will only have knowledge of an API access token.
It is beyond the scope of this document to describe the full authorization process. In short though, the following process is required:
You will need the following details to use the Authorization Code grant type:
| Authorization endpoint: | https://www.simplelists.com/api/2/oauth/authorize/ |
|---|---|
| Grant Type: | authorization_code |
| Client ID: | Please obtain from Simplelists Support |
| Client secret: | Please obtain from Simplelists Support |
| Token endpoint: | https://www.simplelists.com/api/2/oauth/token/ |
| Access token location: | Authorization header with Bearer prefix |
| Request URI: | As per standard API documentation |
The Resource Owner Password Grant Type allows an application to authenticate on behalf of an API user using the user’s username and password.
With this grant type, the application authenticates using its client credentials and the API user’s username and password. If the request is successful, the API returns an access token and a refresh token. The access token should be included in the Authorization header of all subsequent API requests using the Bearer scheme.
You will need the following details to use this grant type:
| Token endpoint: | https://www.simplelists.com/api/2/oauth/token/ |
|---|---|
| Grant type: | password |
| Client ID: | Please obtain from Simplelists Support |
| Client Secret: | Please obtain from Simplelists Support |
| Username: | A valid API username |
| Scope: | A space-separated list of requested scopes |
| Access token location: | Authorization: Bearer |
| Refresh endpoint: | https://www.simplelists.com/api/2/oauth/token/ |
| Request URI: | As per standard API documentation |
The request may be supplied using HTTP Basic Authentication
curl -X POST https://www.simplelists.com/api/2/oauth/token/ \
-d "grant_type=password" \
-d "client_id"=CLIENT_ID" \
-d "client_secret=CLIENT_SECRET" \
-d "username=USERNAME" \
-d "scope=contact membership list"
The Refresh Token grant type is not used on its own, but is instead used to obtain a new access token once the current one has expired. To use the Refresh Token grant type, you will need to submit a Refresh Token that was previously received when using one of the other methods.
You will need the following details to use the Refresh Token grant type:
| Token endpoint: | https://www.simplelists.com/api/2/oauth/refresh/ |
|---|