Skip to main content
POST
/
api
/
investigate
/
stream
event: delta
data: {"text": "Credit card delinquency rates have "}

event: delta
data: {"text": "risen to 3.12% in Q1 2025..."}

event: done
data: {"synthesis": "Credit card delinquency rates have risen to 3.12% in Q1 2025...", "implication": "...", "question": "What is the current state of US consumer credit risk?", "geo": "US", "sources": ["Consumer Credit Indicators", "Macro Data"]}

Authentication

Requires a valid JWT token in the Authorization header.
Authorization: Bearer <your-jwt-token>

Rate Limits

10 requests per 60-second window per authenticated user.

Request Body

The request body is identical to the Investigate endpoint.
question
string
required
The research question to investigate. Maximum 500 characters.
geo
string
Geographic scope. One of US or UK.
weeks
number
default:"12"
Lookback window in weeks. Range: 1104.
cpix_score
number
Optional CPIX composite score to provide additional context.
drivers
array
Array of driver objects to seed the analysis.
signals
array
Array of signal objects to incorporate.
clientProfile
string
Optional client context for tailored analysis. Maximum 500 characters.

Response

The response uses text/event-stream content type. Each event follows the SSE protocol.

Event Types

EventDescription
deltaPartial text chunk of the synthesis.
doneFinal event indicating the stream is complete. Contains the full response payload.
errorError event with a message describing the failure.
cURL
curl -X POST "https://api.consumersignals.io/api/investigate/stream" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "question": "What is the current state of US consumer credit risk?",
    "geo": "US",
    "weeks": 24
  }'
Python
import requests

response = requests.post(
    "https://api.consumersignals.io/api/investigate/stream",
    headers={
        "Authorization": "Bearer YOUR_JWT_TOKEN",
        "Content-Type": "application/json"
    },
    json={
        "question": "What is the current state of US consumer credit risk?",
        "geo": "US",
        "weeks": 24
    },
    stream=True
)

for line in response.iter_lines():
    if line:
        print(line.decode("utf-8"))
TypeScript
const response = await fetch(
  "https://api.consumersignals.io/api/investigate/stream",
  {
    method: "POST",
    headers: {
      Authorization: "Bearer YOUR_JWT_TOKEN",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      question: "What is the current state of US consumer credit risk?",
      geo: "US",
      weeks: 24,
    }),
  }
);

const reader = response.body!.getReader();
const decoder = new TextDecoder();

while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  console.log(decoder.decode(value));
}
event: delta
data: {"text": "Credit card delinquency rates have "}

event: delta
data: {"text": "risen to 3.12% in Q1 2025..."}

event: done
data: {"synthesis": "Credit card delinquency rates have risen to 3.12% in Q1 2025...", "implication": "...", "question": "What is the current state of US consumer credit risk?", "geo": "US", "sources": ["Consumer Credit Indicators", "Macro Data"]}