Lantern API

Lantern API

Last updated on: 01/29/24

The API path is https://apilantern.com/api

Available endpoints:

  • https://apilantern.com/api/validate_key
  • https://apilantern.com/api/quizzes

To make requests to any endpoint, a valid API key is required, which merchants can find in the app, under Integrations > API Key

Endpoints Documentation

  • /validate_key - validate API key
    • returns status code 200 if the key is valid
    • returns status code 400 if the key is not valid
    • example request with valid response
      GET https://apilantern.com/api/validate_key?store=test.myshopify.com&key=cafd80757f955fcb
      
      200
      {
      	"message": "API key is valid"
      }
    • example request with invalid response
      GET https://apilantern.com/api/validate_key?store=test.myshopify.com&key=WrongKey
      
      400
      {
      	"error": "Invalid API key"
      }
  • /quizzes - get a list of all quizzes
    • returns an array of quizzes that are active in the store
    • for each quiz object the following properties are returned
      • name
        • this is the name (or title) of the quiz - it can be used as a label in a dropdown
      • url
        • this is the quiz URL and can be used as follows:
          • standalone page - in a link, button, menu item to open the quiz as a standalone page (non-embedded)
          • embedded quiz - set as the iframe source to embed the quiz
          • popup - calling the global function window.lantern_popup(url) will open the Lantern quiz popup with the target quiz
    • example request and response
      GET https://apilantern.com/api/quizzes?store=siestasloth.myshopify.com&key=validkey
      
      200
      [
      	{
      		"name": "Find Your Perfect Pillow",
      		"https://siestasloth.com/tools/perfect-product-finder/pillow-recommender"
      	},
      	{
      		"name": "Sleeper Quiz",
      		"https://siestasloth.com/tools/perfect-product-finder/what-kind-of-sleeper-are-you"
      	}
      ]