Skip to main content
Programmatically access and search your Raindrop data. Build dashboards, create eval sets, export data, or integrate Raindrop into your workflows.

Installation

npm install @raindrop-ai/query

Quick Start

import { RaindropQuery } from "@raindrop-ai/query";

const client = new RaindropQuery({
  apiKey: process.env.RAINDROP_QUERY_API_KEY,
});

// Semantic search user inputs for frustration
const results = await client.events.search({
  query: "frustration about load times",
  mode: "semantic",
  searchIn: "user_input,assistant_output",
});
Get your Query API key here (this is different from the write key used for ingestion).

Common Patterns

List Signals

const response = await client.signals.list({ limit: 10 });

// Returns: { data: [...], meta: { cursor, has_more } }
const signals = response.data;

Get Events for a Signal

const signal = signals[0];

// Get count
const count = await client.events.count({ signal: signal.id });

// Get the actual events
const events = await client.events.list({
  signal: signal.id,
  limit: 100,
});

Event Counts Over Time

const timeseries = await client.events.timeseries({
  signal: signal.id,
  timestamp: { gte: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString() },
  interval: "day",
});

Error Handling

import { RaindropQuery, SDKValidationError } from "@raindrop-ai/query";

try {
  const events = await client.events.list();
} catch (error) {
  if (error instanceof SDKValidationError) {
    console.error("Invalid request:", error.message);
  }
}