Themes

Create a theme

Back to top

Creates a new survey theme and applies it to a survey.

POST
/v1/theme

Examples

curl https://api.surveyplanet.com/v1/theme 
--request POST 
--header "Content-Type: application/json" 
--header "Authorization: Bearer <ACCESS_TOKEN>"
--data '{"title":"My new theme title.", <...>}'
// For Node.js considering using the 'node-fetch' library: npm info node-fetch
fetch(`https://api.surveyplanet.com/v1/theme`, {
  method: "POST"
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer <ACCESS_TOKEN>",
  }
  body: JSON.stringify({"title":"My new theme title.", <...>})
})
  .then( response => response.json() )
  .then( res => console.log(res.data) )
  .catch( err => console.error(err) );
# This code sample uses the 'requests' library: pip show requests
import requests
response = requests.post(
  'https://api.surveyplanet.com/v1/theme',
  headers = {
    "Content-Type": "application/json"
    "Authorization": "Bearer <ACCESS_TOKEN>"
  }
  data = {"title":"My new theme title.", <...>}
)
print(response.text)

Success response example

Success response example - Response

{
  "status": 200,
  "type": "ok",
  "message": "Request worked as expected."
  "data": {
    "_id": "62b9db151489dd913aeaa22f",
    "categories": [
      "My Themes"
    ],
    "pro": true,
    "title": "My favorite theme",
    "created": "2021-04-28T20:16:46.458Z",
    "updated": "2021-07-26T19:55:04.475Z",
    "user": "62bb4e5aafac21b873847d82",
    "styles": {
      "surveyTitle": {
        "color": {
          "r": 255,
          "g": 255,
          "b": 255,
          "a": 1
        },
        "font": "Marck Script",
        "size": 31
      },
      "questionTitle": {
        "color": {
          "r": 56,
          "g": 63,
          "b": 80,
          "a": 1
        },
        "font": "Marck Script",
        "size": 24
      },
      "questionSubtitle": {
        "color": {
          "r": 151,
          "g": 162,
          "b": 184,
          "a": 1
        },
        "font": "Lato",
        "size": 20
      },
      "formLabels": {
        "color": {
          "r": 56,
          "g": 63,
          "b": 80,
          "a": 1
        },
        "font": "Marck Script",
        "size": 18
      },
      "buttonLabels": {
        "color": {
          "r": 255,
          "g": 255,
          "b": 255,
          "a": 1
        },
        "font": "Marck Script",
        "size": 21
      },
      "background": {
        "color": {
          "r": 243,
          "g": 245,
          "b": 249,
          "a": 1
        },
        "image": {
          "url": "https://media.surveyplanet.com/5bede5cde8dd7e5d5df79aa9/6089c19a8ce7701e4da02fe4.jpeg",
          "cover": true
        }
      },
      "header": {
        "color": {
          "r": 81,
          "g": 129,
          "b": 142,
          "a": 1
        },
        "image": {
          "url": "https://media.surveyplanet.com/5bede5cde8dd7e5d5df79aa9/6089c1a8b22aa16117476e5a.png",
          "opacity": 8
        }
      },
      "questions": {
        "color": {
          "r": 255,
          "g": 255,
          "b": 255,
          "a": 0.89
        },
        "image": {
          "cover": true
        }
      },
      "inputs": {
        "color": {
          "r": 255,
          "g": 255,
          "b": 255,
          "a": 1
        }
      },
      "buttons": {
        "color": {
          "r": 81,
          "g": 129,
          "b": 142,
          "a": 1
        }
      },
      "accents": {
        "color": {
          "r": 249,
          "g": 49,
          "b": 40,
          "a": 1
        }
      },
      "lines": {
        "color": {
          "r": 221,
          "g": 232,
          "b": 235,
          "a": 1
        }
      }
    }
  }
}

Delete a theme

Back to top

Delete a single theme.

DELETE
/v1/theme/:id

Parameters - Parameter

NameTypeDescription
idString

The unique id of the theme to delete.

Examples

curl https://api.surveyplanet.com/v1/theme/62b9db151489dd913aeaa22f 
--request DELETE 
--header "Content-Type: application/json" 
--header "Authorization: Bearer <ACCESS_TOKEN>"
// For Node.js considering using the 'node-fetch' library: npm info node-fetch
fetch(`https://api.surveyplanet.com/v1/theme/62b9db151489dd913aeaa22f`, {
  method: "DELETE"
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer <ACCESS_TOKEN>",
  }
})
  .then( response => response.json() )
  .then( res => console.log(res.data) )
  .catch( err => console.error(err) );
# This code sample uses the 'requests' library: pip show requests
import requests
response = requests.delete(
  'https://api.surveyplanet.com/v1/theme/62b9db151489dd913aeaa22f',
  headers = {
    "Content-Type": "application/json"
    "Authorization": "Bearer <ACCESS_TOKEN>"
  }
)
print(response.text)

Success response example

Success response example - Response

{
  "status": 200,
  "type": "ok",
  "message": "Request worked as expected."
  "data": {
    "_id": "62b9db151489dd913aeaa22f",
    "categories": [
      "My Themes"
    ],
    "pro": true,
    "title": "My favorite theme",
    "created": "2021-04-28T20:16:46.458Z",
    "updated": "2021-07-26T19:55:04.475Z",
    "user": "62bb4e5aafac21b873847d82",
    "styles": {
      "surveyTitle": {
        "color": {
          "r": 255,
          "g": 255,
          "b": 255,
          "a": 1
        },
        "font": "Marck Script",
        "size": 31
      },
      "questionTitle": {
        "color": {
          "r": 56,
          "g": 63,
          "b": 80,
          "a": 1
        },
        "font": "Marck Script",
        "size": 24
      },
      "questionSubtitle": {
        "color": {
          "r": 151,
          "g": 162,
          "b": 184,
          "a": 1
        },
        "font": "Lato",
        "size": 20
      },
      "formLabels": {
        "color": {
          "r": 56,
          "g": 63,
          "b": 80,
          "a": 1
        },
        "font": "Marck Script",
        "size": 18
      },
      "buttonLabels": {
        "color": {
          "r": 255,
          "g": 255,
          "b": 255,
          "a": 1
        },
        "font": "Marck Script",
        "size": 21
      },
      "background": {
        "color": {
          "r": 243,
          "g": 245,
          "b": 249,
          "a": 1
        },
        "image": {
          "url": "https://media.surveyplanet.com/5bede5cde8dd7e5d5df79aa9/6089c19a8ce7701e4da02fe4.jpeg",
          "cover": true
        }
      },
      "header": {
        "color": {
          "r": 81,
          "g": 129,
          "b": 142,
          "a": 1
        },
        "image": {
          "url": "https://media.surveyplanet.com/5bede5cde8dd7e5d5df79aa9/6089c1a8b22aa16117476e5a.png",
          "opacity": 8
        }
      },
      "questions": {
        "color": {
          "r": 255,
          "g": 255,
          "b": 255,
          "a": 0.89
        },
        "image": {
          "cover": true
        }
      },
      "inputs": {
        "color": {
          "r": 255,
          "g": 255,
          "b": 255,
          "a": 1
        }
      },
      "buttons": {
        "color": {
          "r": 81,
          "g": 129,
          "b": 142,
          "a": 1
        }
      },
      "accents": {
        "color": {
          "r": 249,
          "g": 49,
          "b": 40,
          "a": 1
        }
      },
      "lines": {
        "color": {
          "r": 221,
          "g": 232,
          "b": 235,
          "a": 1
        }
      }
    }
  }
}

Get a theme

Back to top

Retrieves a survey theme by its unique id.

GET
/v1/theme/:id

Parameters - Parameter

NameTypeDescription
idString

Unique theme id.

Examples

curl https://api.surveyplanet.com/v1/theme/62b9db151489dd913aeaa22f 
--header "Authorization: Bearer <ACCESS_TOKEN>"
// For Node.js considering using the 'node-fetch' library: npm info node-fetch
fetch(`https://api.surveyplanet.com/v1/theme/62b9db151489dd913aeaa22f`, {
	headers: { Authorization: 'Bearer <ACCESS_TOKEN>' },
})
	.then((response) => response.json())
	.then((res) => console.log(res.data))
	.catch((err) => console.error(err));
# This code sample uses the 'requests' library: pip show requests
import requests
response = requests.get(
  "https://api.surveyplanet.com/v1/theme/62b9db151489dd913aeaa22f",
  headers={"Authorization": "Bearer <ACCESS_TOKEN>"}
)
print(response.text)

Success response example

Success response example - Response

{
  "status": 200,
  "type": "ok",
  "message": "Request worked as expected."
  "data": {
    "_id": "62b9db151489dd913aeaa22f",
    "categories": [
      "My Themes"
    ],
    "pro": true,
    "title": "My favorite theme",
    "created": "2021-04-28T20:16:46.458Z",
    "updated": "2021-07-26T19:55:04.475Z",
    "user": "62bb4e5aafac21b873847d82",
    "styles": {
      "surveyTitle": {
        "color": {
          "r": 255,
          "g": 255,
          "b": 255,
          "a": 1
        },
        "font": "Marck Script",
        "size": 31
      },
      "questionTitle": {
        "color": {
          "r": 56,
          "g": 63,
          "b": 80,
          "a": 1
        },
        "font": "Marck Script",
        "size": 24
      },
      "questionSubtitle": {
        "color": {
          "r": 151,
          "g": 162,
          "b": 184,
          "a": 1
        },
        "font": "Lato",
        "size": 20
      },
      "formLabels": {
        "color": {
          "r": 56,
          "g": 63,
          "b": 80,
          "a": 1
        },
        "font": "Marck Script",
        "size": 18
      },
      "buttonLabels": {
        "color": {
          "r": 255,
          "g": 255,
          "b": 255,
          "a": 1
        },
        "font": "Marck Script",
        "size": 21
      },
      "background": {
        "color": {
          "r": 243,
          "g": 245,
          "b": 249,
          "a": 1
        },
        "image": {
          "url": "https://media.surveyplanet.com/5bede5cde8dd7e5d5df79aa9/6089c19a8ce7701e4da02fe4.jpeg",
          "cover": true
        }
      },
      "header": {
        "color": {
          "r": 81,
          "g": 129,
          "b": 142,
          "a": 1
        },
        "image": {
          "url": "https://media.surveyplanet.com/5bede5cde8dd7e5d5df79aa9/6089c1a8b22aa16117476e5a.png",
          "opacity": 8
        }
      },
      "questions": {
        "color": {
          "r": 255,
          "g": 255,
          "b": 255,
          "a": 0.89
        },
        "image": {
          "cover": true
        }
      },
      "inputs": {
        "color": {
          "r": 255,
          "g": 255,
          "b": 255,
          "a": 1
        }
      },
      "buttons": {
        "color": {
          "r": 81,
          "g": 129,
          "b": 142,
          "a": 1
        }
      },
      "accents": {
        "color": {
          "r": 249,
          "g": 49,
          "b": 40,
          "a": 1
        }
      },
      "lines": {
        "color": {
          "r": 221,
          "g": 232,
          "b": 235,
          "a": 1
        }
      }
    }
  }
}

List all themes

Back to top

Retrieves a list of all available themes including template themes and user generated themes.

GET
/v1/themes

Query Parameters

NameTypeDescription
noTemplatesBooleanoptional

Only return themes created by the user—no template themes.

Default value: false
reverseBooleanoptional

Sort list in reverse chronological order

afterStringoptional

The unique id which defines a cursor for paginating. When defined only retrieve list after this id.

beforeStringoptional

The unique id which defines a cursor for paginating. When defined only retrieve list before this id.

selectStringoptional

A URL encoded string of properties to include. If not specified all fields are returned. Use a - to exclude a specific field e.g:-title.

Examples

curl https://api.surveyplanet.com/v1/themes 
--header "Authorization: Bearer <ACCESS_TOKEN>"
// For Node.js considering using the 'node-fetch' library: npm info node-fetch
fetch(`https://api.surveyplanet.com/v1/themes`, {
	headers: { Authorization: 'Bearer <ACCESS_TOKEN>' },
})
	.then((response) => response.json())
	.then((res) => console.log(res.data))
	.catch((err) => console.error(err));
# This code sample uses the 'requests' library: pip show requests
import requests
response = requests.get(
  "https://api.surveyplanet.com/v1/themes",
  headers={"Authorization": "Bearer <ACCESS_TOKEN>"}
)
print(response.text)

Success response example

Success response example - Response

{
  "status": 200,
  "data": [
    { "_id": "62b9e7467854aef07faa746a",...},
    { "_id": "55d8aa7f2c5105f22fea7cbf",...},
    [...],
  ],
 "more": true,
 "type": "ok",
 "message": "Request worked as expected."
}

Update a theme

Back to top

Updates a single theme.

PUT
/v1/theme/:id

Parameters - Parameter

NameTypeDescription
idString

The unique id of the theme to update.

Examples

curl https://api.surveyplanet.com/v1/theme/62b9db151489dd913aeaa22f 
--request PUT 
--header "Content-Type: application/json" 
--header "Authorization: Bearer <ACCESS_TOKEN>"
--data '{"title":"My new theme title."}'
// For Node.js considering using the 'node-fetch' library: npm info node-fetch
fetch(`https://api.surveyplanet.com/v1/theme/62b9db151489dd913aeaa22f`, {
  method: "PUT"
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer <ACCESS_TOKEN>",
  }
  body: JSON.stringify({"title":"My new theme title."})
})
  .then( response => response.json() )
  .then( res => console.log(res.data) )
  .catch( err => console.error(err) );
# This code sample uses the 'requests' library: pip show requests
import requests
response = requests.put(
  'https://api.surveyplanet.com/v1/theme/62b9db151489dd913aeaa22f',
  headers = {
    "Content-Type": "application/json"
    "Authorization": "Bearer <ACCESS_TOKEN>"
  }
  data = {"title":"My new theme title."}
)
print(response.text)

Success response example

Success response example - Response

{
  "status": 200,
  "type": "ok",
  "message": "Request worked as expected."
  "data": {
    "_id": "62b9db151489dd913aeaa22f",
    "categories": [
      "My Themes"
    ],
    "pro": true,
    "title": "My favorite theme",
    "created": "2021-04-28T20:16:46.458Z",
    "updated": "2021-07-26T19:55:04.475Z",
    "user": "62bb4e5aafac21b873847d82",
    "styles": {
      "surveyTitle": {
        "color": {
          "r": 255,
          "g": 255,
          "b": 255,
          "a": 1
        },
        "font": "Marck Script",
        "size": 31
      },
      "questionTitle": {
        "color": {
          "r": 56,
          "g": 63,
          "b": 80,
          "a": 1
        },
        "font": "Marck Script",
        "size": 24
      },
      "questionSubtitle": {
        "color": {
          "r": 151,
          "g": 162,
          "b": 184,
          "a": 1
        },
        "font": "Lato",
        "size": 20
      },
      "formLabels": {
        "color": {
          "r": 56,
          "g": 63,
          "b": 80,
          "a": 1
        },
        "font": "Marck Script",
        "size": 18
      },
      "buttonLabels": {
        "color": {
          "r": 255,
          "g": 255,
          "b": 255,
          "a": 1
        },
        "font": "Marck Script",
        "size": 21
      },
      "background": {
        "color": {
          "r": 243,
          "g": 245,
          "b": 249,
          "a": 1
        },
        "image": {
          "url": "https://media.surveyplanet.com/5bede5cde8dd7e5d5df79aa9/6089c19a8ce7701e4da02fe4.jpeg",
          "cover": true
        }
      },
      "header": {
        "color": {
          "r": 81,
          "g": 129,
          "b": 142,
          "a": 1
        },
        "image": {
          "url": "https://media.surveyplanet.com/5bede5cde8dd7e5d5df79aa9/6089c1a8b22aa16117476e5a.png",
          "opacity": 8
        }
      },
      "questions": {
        "color": {
          "r": 255,
          "g": 255,
          "b": 255,
          "a": 0.89
        },
        "image": {
          "cover": true
        }
      },
      "inputs": {
        "color": {
          "r": 255,
          "g": 255,
          "b": 255,
          "a": 1
        }
      },
      "buttons": {
        "color": {
          "r": 81,
          "g": 129,
          "b": 142,
          "a": 1
        }
      },
      "accents": {
        "color": {
          "r": 249,
          "g": 49,
          "b": 40,
          "a": 1
        }
      },
      "lines": {
        "color": {
          "r": 221,
          "g": 232,
          "b": 235,
          "a": 1
        }
      }
    }
  }
}