Skip to main content

Authentication

All view endpoints require an alert token in the X-Alert-Token header. Obtain a token via the Get Alert Token endpoint.
X-Alert-Token: <your-alert-token>

List Views

Retrieve all saved views for the authenticated user.

Response

Returns an array of view objects.
id
string
Unique view identifier.
name
string
View name.
geography
string
Geographic scope (US or UK).
driver_ids
string[]
Array of selected driver identifiers.
question
string
Saved investigation question.
cURL
curl "https://api.consumersignals.io/api/views" \
  -H "X-Alert-Token: YOUR_ALERT_TOKEN"
Python
import requests

response = requests.get(
    "https://api.consumersignals.io/api/views",
    headers={"X-Alert-Token": "YOUR_ALERT_TOKEN"}
)
views = response.json()
TypeScript
const response = await fetch(
  "https://api.consumersignals.io/api/views",
  {
    headers: {
      "X-Alert-Token": "YOUR_ALERT_TOKEN",
    },
  }
);
const views = await response.json();
[
  {
    "id": "view_xyz789",
    "name": "US Energy Impact",
    "geography": "US",
    "driver_ids": ["gas_price", "cpi_energy"],
    "question": "How are energy costs affecting consumer spending?"
  }
]

Create View

Create a new saved view.

Request Body

name
string
required
Name for the view.
geography
string
required
Geographic scope. One of US or UK.
driver_ids
string[]
required
Array of driver identifiers to include in the view.
question
string
required
Investigation question to associate with the view.
cURL
curl -X POST "https://api.consumersignals.io/api/views" \
  -H "X-Alert-Token: YOUR_ALERT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "US Energy Impact",
    "geography": "US",
    "driver_ids": ["gas_price", "cpi_energy"],
    "question": "How are energy costs affecting consumer spending?"
  }'
Python
import requests

response = requests.post(
    "https://api.consumersignals.io/api/views",
    headers={
        "X-Alert-Token": "YOUR_ALERT_TOKEN",
        "Content-Type": "application/json"
    },
    json={
        "name": "US Energy Impact",
        "geography": "US",
        "driver_ids": ["gas_price", "cpi_energy"],
        "question": "How are energy costs affecting consumer spending?"
    }
)
view = response.json()
TypeScript
const response = await fetch(
  "https://api.consumersignals.io/api/views",
  {
    method: "POST",
    headers: {
      "X-Alert-Token": "YOUR_ALERT_TOKEN",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      name: "US Energy Impact",
      geography: "US",
      driver_ids: ["gas_price", "cpi_energy"],
      question: "How are energy costs affecting consumer spending?",
    }),
  }
);
const view = await response.json();
{
  "id": "view_xyz789",
  "name": "US Energy Impact",
  "geography": "US",
  "driver_ids": ["gas_price", "cpi_energy"],
  "question": "How are energy costs affecting consumer spending?"
}

Delete View

Delete a saved view by its ID.

Path Parameters

id
string
required
The unique identifier of the view to delete.

Response

Returns 204 No Content on successful deletion.
cURL
curl -X DELETE "https://api.consumersignals.io/api/views/view_xyz789" \
  -H "X-Alert-Token: YOUR_ALERT_TOKEN"
Python
import requests

response = requests.delete(
    "https://api.consumersignals.io/api/views/view_xyz789",
    headers={"X-Alert-Token": "YOUR_ALERT_TOKEN"}
)
# 204 No Content on success
TypeScript
const response = await fetch(
  "https://api.consumersignals.io/api/views/view_xyz789",
  {
    method: "DELETE",
    headers: {
      "X-Alert-Token": "YOUR_ALERT_TOKEN",
    },
  }
);
// 204 No Content on success