Skip to main content

Overview

The Workspace API allows you to create and manage workspaces, configure organizations, manage team members, and control workspace settings like scheduling and enabled AI providers.

Endpoints

create

Create a new workspace with a new organization. Type: Mutation (Protected) Rate Limit: 3 requests per hour
organizationName
string
Name of the organization (2-80 characters). Defaults to workspace name if not provided.
name
string
required
Name of the workspace (2-50 characters)
slug
string
required
URL-friendly slug for the workspace (2-50 characters)
domain
string
required
Domain to track (2-50 characters)
workspace
object
The created workspace object
org
object
The created organization object
isFirstWorkspace
boolean
Whether this is the user’s first workspace
const result = await trpc.workspace.create.mutate({
  name: "Acme Corp Tracking",
  slug: "acme-corp",
  domain: "acme.com",
  organizationName: "Acme Corporation"
});

createInOrg

Create a new workspace within an existing organization. Type: Mutation (Protected)
name
string
required
Name of the workspace (2-50 characters)
slug
string
required
URL-friendly slug for the workspace (2-50 characters)
domain
string
required
Domain to track (2-256 characters)
tenantId
string
required
ID of the existing organization
workspace
object
The created workspace object
isFirstWorkspace
boolean
Whether this is the user’s first workspace
const result = await trpc.workspace.createInOrg.mutate({
  name: "Marketing Analytics",
  slug: "marketing-analytics",
  domain: "marketing.acme.com",
  tenantId: "org_xyz789"
});

listByOrg

List all workspaces for a specific organization. Type: Query (Protected)
tenantId
string
required
Organization ID to list workspaces for
workspaces
array
Array of workspace objects belonging to the organization
const workspaces = await trpc.workspace.listByOrg.query({
  tenantId: "org_xyz789"
});

listAllForUser

List all workspaces the authenticated user has access to. Type: Query (Protected) Input: None
workspaces
array
Array of all workspace objects the user can access
const workspaces = await trpc.workspace.listAllForUser.query();

getById

Get detailed information about a specific workspace. Type: Query (Authorized Workspace)
workspaceId
string
required
ID of the workspace to retrieve
workspace
object
Complete workspace object with all details
const workspace = await trpc.workspace.getById.query({
  workspaceId: "ws_abc123"
});

updateDetails

Update workspace name and domain. Requires owner role. Type: Mutation (Authorized Workspace) Authorization: Owner only
workspaceId
string
required
ID of the workspace to update
name
string
required
New workspace name (2-80 characters)
domain
string
required
New domain to track (2-256 characters)
workspace
object
Updated workspace object
const updated = await trpc.workspace.updateDetails.mutate({
  workspaceId: "ws_abc123",
  name: "Acme Corporation Tracking",
  domain: "acme.com"
});

updateOrganizationName

Update the organization name. Requires owner role. Type: Mutation (Authorized Workspace) Authorization: Owner only
workspaceId
string
required
ID of the workspace
organizationName
string
required
New organization name (2-80 characters)
organization
object
Updated organization object
const updated = await trpc.workspace.updateOrganizationName.mutate({
  workspaceId: "ws_abc123",
  organizationName: "Acme International"
});

listMembers

List all members of a workspace with their user details. Type: Query (Authorized Workspace)
workspaceId
string
required
ID of the workspace
members
array
Array of workspace members with user information
const members = await trpc.workspace.listMembers.query({
  workspaceId: "ws_abc123"
});

addMember

Invite a new member to the workspace by email. Type: Mutation (Authorized Workspace)
workspaceId
string
required
ID of the workspace
email
string
required
Email address of the user to invite
role
string
Role to assign: “owner” or “member”. Defaults to “member”
membership
object
Created workspace membership
const membership = await trpc.workspace.addMember.mutate({
  workspaceId: "ws_abc123",
  email: "[email protected]",
  role: "member"
});

removeMember

Remove a member from the workspace. Requires owner role. Type: Mutation (Authorized Workspace) Authorization: Owner only
workspaceId
string
required
ID of the workspace
userId
string
required
ID of the user to remove
role
string
required
Role of the user being removed
success
boolean
Whether the member was successfully removed
const result = await trpc.workspace.removeMember.mutate({
  workspaceId: "ws_abc123",
  userId: "user_456",
  role: "member"
});

joinByCode

Join a workspace using an invite code. Type: Mutation (Protected) Rate Limit: 5 requests per 15 minutes
code
string
required
Workspace invite code
workspace
object
The joined workspace
membership
object
The created membership
const result = await trpc.workspace.joinByCode.mutate({
  code: "ABC123XYZ"
});

getJoinInfo

Get workspace join information including invite code. Type: Query (Authorized Workspace)
workspaceId
string
required
ID of the workspace
code
string
Invite code for the workspace
expiresAt
Date
Expiration date for the invite code, if any
const joinInfo = await trpc.workspace.getJoinInfo.query({
  workspaceId: "ws_abc123"
});

getEnabledProviders

Get the list of enabled AI providers for the workspace. Type: Query (Authorized Workspace)
workspaceId
string
required
ID of the workspace
enabledProviders
array
Array of enabled provider names
const result = await trpc.workspace.getEnabledProviders.query({
  workspaceId: "ws_abc123"
});

setEnabledProviders

Configure which AI providers to track for this workspace. Type: Mutation (Authorized Workspace)
workspaceId
string
required
ID of the workspace
providers
array
required
Array of provider names to enable. Must include at least one provider.Valid providers: “openai”, “anthropic”, “google”, “perplexity”, “mistral”, “cohere”
workspace
object
Updated workspace object
const result = await trpc.workspace.setEnabledProviders.mutate({
  workspaceId: "ws_abc123",
  providers: ["openai", "anthropic"]
});

getSchedule

Get the current cron schedule for automated prompt collection. Type: Query (Authorized Workspace)
workspaceId
string
required
ID of the workspace
schedule
string | null
Cron expression for the schedule, or null if not scheduled
const result = await trpc.workspace.getSchedule.query({
  workspaceId: "ws_abc123"
});

setSchedule

Set or update the cron schedule for automated prompt collection. When a schedule is set, an immediate agent run is triggered. Type: Mutation (Authorized Workspace)
workspaceId
string
required
ID of the workspace
schedule
string | null
required
Cron expression for the schedule (e.g., “0 0 * * *” for daily at midnight), or null to disable
workspace
object
Updated workspace object
immediateRun
object
Status of the immediate agent run that was triggered
  • status: "queued" - Run was successfully queued with jobId
  • status: "empty" - No prompts to analyze
  • status: "failed" - Run failed with error
  • status: "not-requested" - Schedule was set to null (disabled)
const result = await trpc.workspace.setSchedule.mutate({
  workspaceId: "ws_abc123",
  schedule: "0 0 * * *" // Daily at midnight
});

getCronTiming

Get timing information for the workspace schedule including next run time and last run time. Type: Query (Authorized Workspace)
workspaceId
string
required
ID of the workspace
nextRun
string | null
ISO 8601 timestamp of the next scheduled run, or null if not scheduled
lastPromptRun
string | null
ISO 8601 timestamp of the last prompt collection run, or null if never run
const timing = await trpc.workspace.getCronTiming.query({
  workspaceId: "ws_abc123"
});

deleteAccount

Permanently delete the authenticated user’s account and all associated data. Type: Mutation (Protected) Input: None Warning: This action is irreversible.
await trpc.workspace.deleteAccount.mutate();

Prompts API

Store prompts for your workspace

Agent API

Run automated prompt collection

Build docs developers (and LLMs) love