curl -X POST --location "https://api.globalwebindex.com/v1/spark-api/generic" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -d '{
          "prompt" : "How does social media usage differ between boomers and eco-conscious millennials?",
          "chat_id": "bad0ca6c-5e53-44ad-960d-1f5e7f294d2a"
        }'
{
  "message": "Based on your input, here are some interesting Insights:",
  "insights": [
    "11% of environmentally conscious individuals use Pinterest daily, which is more than double the rate of Baby Boomers at 5.2%.",
    "Baby Boomers are 423% more likely to visit or use Nextdoor more than once a day compared to environmentally conscious individuals.",
    "52% of environmentally conscious individuals use Instagram more than once a day, compared to only 13% of Baby Boomers.",
    "Environmentally conscious individuals are 167% more likely to visit Quora daily compared to Baby Boomers.",
    "45% of Baby Boomers use Facebook more than once a day, slightly higher than the 42% of environmentally conscious individuals who do the same."
  ],
  "chat_id": "bad0ca6c-5e53-44ad-960d-1f5e7f294d2a",
  "sources": {
    "topics": [
      "social media platforms"
    ],
    "audiences": [
      {
        "id": "3f552047-abdd-4c1a-ad96-4f1b52ea2fe0",
        "name": "Attitudes: Eco Activists ",
        "description": "This audience consists of individuals who prioritize helping the environment, are willing to pay more for eco-friendly products, and have an interest in environmental issues."
      }
    ],
    "datasets": [
      {
        "code": "ds-core",
        "name": "GWI Core"
      }
    ],
    "locations": [
      {
        "code": "s2_44",
        "name": "UK"
      }
    ],
    "waves": [
      {
        "code": "q1_2024",
        "name": "Q1 2024"
      },
      {
        "code": "q2_2024",
        "name": "Q2 2024"
      },
      {
        "code": "q3_2024",
        "name": "Q3 2024"
      },
      {
        "code": "q4_2024",
        "name": "Q4 2024"
      }
    ]
  }
}

The Spark API allows you to maintain context across multiple queries by including a Chat History ID in your request. This feature is particularly useful when you’re iterating on a query or refining insights based on previous interactions.

Why Use Chat History?

  • Seamless Conversations: Ensures continuity by linking your current query with previous ones.
  • Refinement: Allows the system to provide more relevant and contextualized insights based on the prior questions and responses.
  • Efficiency: Avoids the need to restate context in each new query.

Lets use the chat ID to ask how eco-conscious millennials social media usage differs from that of eco conscious boomers

curl -X POST --location "https://api.globalwebindex.com/v1/spark-api/generic" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -d '{
          "prompt" : "How does social media usage differ between boomers and eco-conscious millennials?",
          "chat_id": "bad0ca6c-5e53-44ad-960d-1f5e7f294d2a"
        }'
{
  "message": "Based on your input, here are some interesting Insights:",
  "insights": [
    "11% of environmentally conscious individuals use Pinterest daily, which is more than double the rate of Baby Boomers at 5.2%.",
    "Baby Boomers are 423% more likely to visit or use Nextdoor more than once a day compared to environmentally conscious individuals.",
    "52% of environmentally conscious individuals use Instagram more than once a day, compared to only 13% of Baby Boomers.",
    "Environmentally conscious individuals are 167% more likely to visit Quora daily compared to Baby Boomers.",
    "45% of Baby Boomers use Facebook more than once a day, slightly higher than the 42% of environmentally conscious individuals who do the same."
  ],
  "chat_id": "bad0ca6c-5e53-44ad-960d-1f5e7f294d2a",
  "sources": {
    "topics": [
      "social media platforms"
    ],
    "audiences": [
      {
        "id": "3f552047-abdd-4c1a-ad96-4f1b52ea2fe0",
        "name": "Attitudes: Eco Activists ",
        "description": "This audience consists of individuals who prioritize helping the environment, are willing to pay more for eco-friendly products, and have an interest in environmental issues."
      }
    ],
    "datasets": [
      {
        "code": "ds-core",
        "name": "GWI Core"
      }
    ],
    "locations": [
      {
        "code": "s2_44",
        "name": "UK"
      }
    ],
    "waves": [
      {
        "code": "q1_2024",
        "name": "Q1 2024"
      },
      {
        "code": "q2_2024",
        "name": "Q2 2024"
      },
      {
        "code": "q3_2024",
        "name": "Q3 2024"
      },
      {
        "code": "q4_2024",
        "name": "Q4 2024"
      }
    ]
  }
}