API requests using basic authentication with your email address and an API token.

If your Surveypal organization is created before 31.08.2022 then you can use also API key for authentication. But we recommend basic authentication even that you are able to use API token.

Basic Authentication

Basic authentication user name is your Surveypal user name, for example
[email protected]

Basic authentication password

  • Select your name from the bottom left corner on the Surveypal front page
  • Select 'Your account'.
  • Select tab 'API keys'
  • Create your first token by clicking 'Create key'
  • Give your API key a name and click 'Create'
  • Combine text "token-" and your API key

For example if API key is "AA_HvXX0A1Y1X11113ZV3v11cXX" then Basic authentication password is "token-AA_HvXX0A1Y1X11113ZV3v11cXX"

Combine your user name and password to generate the authorization header. This combination needs to be a Base-64 encoded string.

Authorization header format:
Authorization: Basic <email_address/token-api_key>

For example
[email protected]:token-AA_HvXX0A1Y1X11113ZV3v11cXX

Encode this with Base64. You can use text editor like Notepad++ or some service like https://www.base64encode.org/

Above username and password Base64 encoded: dGVzdC5hY2NvdW50QHN1cnZleXBhbC5jb206dG9rZW4tQUFfSHZYWDBBMVkxWDExMTEzWlYzdjExY1hY

Use this in your request header:
Authorization: Basic dGVzdC5hY2NvdW50QHN1cnZleXBhbC5jb206dG9rZW4tQUFfSHZYWDBBMVkxWDExMTEzWlYzdjExY1hY

Example request:

curl -i -X GET \
   -H "Authorization: Basic dGVzdC5hY2NvdW50QHN1cnZleXBhbC5jb206dG9rZW4tQUFfSHZYWDBBMVkxWDExMTEzWlYzdjExY1hY" \
   -H "Accept:application/json" \
 'https://my.surveypal.com/api/rest/surveys'

API token

You can use API token only if your Surveypal organization is created before 31.08.2022.
We recommend basic authentication even that you are able to use API token.

Create API token:

  • Select your name from the bottom left corner on the Surveypal front page
  • Select 'Your account'.
  • Select tab 'API keys'
  • Create your first token by clicking 'Create key'
  • Give your API key a name and click 'Create'

For example if API key is "AA_HvXX0A1Y1X11113ZV3v11cXX" then header look like this:
X-Auth-Token:AA_HvXX0A1Y1X11113ZV3v11cXX

Example request:

curl -i -X GET \
   -H "X-Auth-Token:AA_HvXX0A1Y1X11113ZV3v11cXX" \
   -H "Accept:application/json" \
 'https://my.surveypal.com/api/rest/surveys'