Skip to main content

Overview

The Prompts API allows you to store prompts that users have submitted to AI providers and retrieve them for analysis. Prompts are the foundation of OneGlance’s brand tracking capabilities.

Endpoints

store

Store one or more prompts for a workspace. These prompts will be analyzed for brand mentions. Type: Mutation (Authorized Workspace) Rate Limit: 20 requests per minute
workspaceId
string
required
ID of the workspace to store prompts for
prompts
array
required
Array of prompt strings to store. Each prompt must be 1-500 characters. Minimum 1 prompt, maximum 100 prompts per request.
stored
number
Number of prompts successfully stored
prompts
array
Array of stored prompt objects
const result = await trpc.prompt.store.mutate({
  workspaceId: "ws_abc123",
  prompts: [
    "What is the best project management tool for startups?",
    "Compare Asana vs Monday for team collaboration",
    "How does Notion handle real-time collaboration?"
  ]
});

Validation Rules

  • Minimum 1 prompt per request
  • Maximum 100 prompts per request
  • Each prompt must be between 1-500 characters
  • All prompts must be non-empty strings

fetchPromptSources

Retrieve aggregated statistics about prompt sources for the workspace. Type: Query (Authorized Workspace)
workspaceId
string
required
ID of the workspace
sources
array
Array of prompt sources with counts and metadata
const sources = await trpc.prompt.fetchPromptSources.query({
  workspaceId: "ws_abc123"
});

fetchUserPrompts

Retrieve all user-submitted prompts for the workspace. Type: Query (Authorized Workspace)
workspaceId
string
required
ID of the workspace
prompts
array
Array of prompt objects submitted by users (excludes agent-collected prompts)
const prompts = await trpc.prompt.fetchUserPrompts.query({
  workspaceId: "ws_abc123"
});

Prompt Sources

Prompts in OneGlance can come from two sources:
  • user: Manually submitted by workspace members
  • agent: Automatically collected by OneGlance agents from AI provider responses

Use Cases

Manual Prompt Submission

Use the store endpoint when you want to track specific prompts that users have encountered:
// User submits a prompt they received from ChatGPT
await trpc.prompt.store.mutate({
  workspaceId: currentWorkspaceId,
  prompts: [
    "Best CRM software for small businesses in 2026"
  ]
});

Batch Import

Import multiple prompts at once (up to 100 per request):
const promptsToImport = [
  "What are the top email marketing platforms?",
  "Compare Mailchimp vs ConvertKit for creators",
  "How to set up automated email campaigns"
  // ... up to 100 prompts
];

await trpc.prompt.store.mutate({
  workspaceId: currentWorkspaceId,
  prompts: promptsToImport
});

Analyzing Stored Prompts

After storing prompts, use the Analysis API to extract brand mentions:
// Store prompts
await trpc.prompt.store.mutate({
  workspaceId: currentWorkspaceId,
  prompts: ["What's the best alternative to Salesforce?"]
});

// Analyze them
const analysis = await trpc.analysis.analyzeMetrics.mutate({
  workspaceId: currentWorkspaceId,
  analyzeAll: false // Only analyze new prompts
});

Analysis API

Analyze prompts for brand mentions

Agent API

Automate prompt collection

Workspace API

Manage workspace settings

Build docs developers (and LLMs) love