Files
sim/apps/docs/openapi.json
Siddharth Ganesan 5b9f0d73c2 feat(mothership): mothership (#3411)
* Fix lint

* improvement(sidebar): loading

* fix(sidebar): use client-generated UUIDs for stable optimistic updates (#3439)

* fix(sidebar): use client-generated UUIDs for stable optimistic updates

* fix(folders): use zod schema validation for folder create API

Replace inline UUID regex with zod schema validation for consistency
with other API routes. Update test expectations accordingly.

* fix(sidebar): add client UUID to single workflow duplicate hook

The useDuplicateWorkflow hook was missing newId: crypto.randomUUID(),
causing the same temp-ID-swap issue for single workflow duplication
from the context menu.

* fix(folders): avoid unnecessary Set re-creation in replaceOptimisticEntry

Only create new expandedFolders/selectedFolders Sets when tempId
differs from data.id. In the common happy path (client-generated UUIDs),
this avoids unnecessary Zustand state reference changes and re-renders.

* Mothership block logs

* Fix mothership block logs

* improvement(knowledge): make connector-synced document chunks readonly (#3440)

* improvement(knowledge): make connector-synced document chunks readonly

* fix(knowledge): enforce connector chunk readonly on server side

* fix(knowledge): disable toggle and delete actions for connector-synced chunks

* Job exeuction logs

* Job logs

* fix(connectors): remove unverifiable requiredScopes for Linear connector

* fix(connectors): remove legacy requiredScopes from Jira and Confluence connectors

Jira and Confluence OAuth tokens don't return legacy scope names like
read:jira-work or read:confluence-content.all, causing the 'Update access'
banner to always appear. Set requiredScopes to empty array like Linear.

* feat(tasks): add rename to task context menu (#3442)

* Revert "fix(connectors): remove legacy requiredScopes from Jira and Confluence connectors"

This reverts commit a0be3ff414.

* fix(connectors): restore Linear connector requiredScopes

Linear OAuth does return scopes in the token response. The previous
fix of emptying requiredScopes was based on an incorrect assumption.
Restoring requiredScopes: ['read'] as it should work correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(knowledge): pass workspaceId to useOAuthCredentials in connector card

The ConnectorCard was calling useOAuthCredentials(providerId) without
a workspaceId, causing the credentials API to return an empty array.
This meant the credential lookup always failed, getMissingRequiredScopes
received undefined, and the "Update access" banner always appeared.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix oauth link callback from mothership task

* feat(connectors): add Fireflies connector and API key auth support (#3448)

* feat(connectors): add Fireflies connector and API key auth support

Extend the connector system to support both OAuth and API key authentication
via a discriminated union (`ConnectorAuthConfig`). Add Fireflies as the first
API key connector, syncing meeting transcripts via the Fireflies GraphQL API.

Schema changes:
- Make `credentialId` nullable (null for API key connectors)
- Add `encryptedApiKey` column (AES-256-GCM encrypted, null for OAuth)

This eliminates the `'_apikey_'` sentinel and inline `sourceConfig._encryptedApiKey`
patterns, giving each auth mode its own clean column.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(fireflies): allow 0 for maxTranscripts (means unlimited)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Add context

* fix(fireflies): correct types from live API validation (#3450)

* fix(fireflies): correct types from live API validation

- speakers.id is number, not string (API returns 0, 1, 2...)
- summary.action_items is a single string, not string[]
- Update formatTranscriptContent to handle action_items as string

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(fireflies): correct tool types from live API validation

- FirefliesSpeaker.id: string -> number
- FirefliesSentence.speaker_id: string -> number
- FirefliesSpeakerAnalytics.speaker_id: string -> number
- FirefliesSummary.action_items: string[] -> string
- FirefliesSummary.outline: string[] -> string
- FirefliesSummary.shorthand_bullet: string[] -> string
- FirefliesSummary.bullet_gist: string[] -> string
- FirefliesSummary.topics_discussed: string[] -> string

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* feat(knowledge): add connector tools and expand document metadata (#3452)

* feat(knowledge): add connector tools and expand document metadata

* fix(knowledge): address PR review feedback on new tools

* fix(knowledge): remove unused params from get_document transform

* refactor, improvement

* fix: correct knowledge block canonical pair pattern and subblock migration

- Rename manualDocumentId to documentId (advanced subblock ID should match
  canonicalParamId, consistent with airtable/gmail patterns)
- Fix documentSelector.dependsOn to reference knowledgeBaseSelector (basic
  depends on basic, not advanced)
- Remove unnecessary documentId migration (ID unchanged from main)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* lint

* fix: resolve post-merge test and lint failures

- airtable: sync tableSelector condition with tableId (add getSchema)
- backfillCanonicalModes test: add documentId mode to prevent false backfill
- schedule PUT test: use invalid action string now that disable is valid
- schedule execute tests: add ne mock, sourceType field, use
  mockReturnValueOnce for two db.update calls
- knowledge tools: fix biome formatting (single-line arrow functions)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fixes

* Fixes

* Clean vfs

* Fix

* Fix lint

* fix(connectors): add rate limiting, concurrency controls, and bug fixes (#3457)

* fix(connectors): add rate limiting, concurrency controls, and bug fixes across knowledge connectors

- Add Retry-After header support to fetchWithRetry for all 18 connectors
- Batch concurrent API calls (concurrency 5) in Dropbox, Google Docs, Google Drive, OneDrive, SharePoint
- Batch concurrent API calls (concurrency 3) in Notion to match 3 req/s limit
- Cache GitHub tree in syncContext to avoid re-fetching on every pagination page
- Batch GitHub blob fetches with concurrency 5
- Fix GitHub base64 decoding: atob() → Buffer.from() for UTF-8 safety
- Fix HubSpot OAuth scope: 'tickets' → 'crm.objects.tickets.read' (v3 API)
- Fix HubSpot syncContext key: totalFetched → totalDocsFetched for consistency
- Add jitter to nextSyncAt (10% of interval, capped at 5min) to prevent thundering herd
- Fix Date consistency in connector DELETE route

* fix(connectors): address PR review feedback on retry and SharePoint batching

- Remove 120s cap on Retry-After — pass all values through to retry loop
- Add maxDelayMs guard: if Retry-After exceeds maxDelayMs, throw immediately
  instead of hammering with shorter intervals (addresses validate timeout concern)
- Add early exit in SharePoint batch loop when maxFiles limit is reached
  to avoid unnecessary API calls

* fix(connectors): cap Retry-After at maxDelayMs instead of aborting

Match Google Cloud SDK behavior: when Retry-After exceeds maxDelayMs,
cap the wait to maxDelayMs and log a warning, rather than throwing
immediately. This ensures retries are bounded in duration while still
respecting server guidance within the configured limit.

* fix(connectors): add early-exit guard to Dropbox, Google Docs, OneDrive batch loops

Match the SharePoint fix — skip remaining batches once maxFiles limit
is reached to avoid unnecessary API calls.

* improvement(turbo): align turborepo config with best practices (#3458)

* improvement(turbo): align turborepo config with best practices

* fix(turbo): address PR review feedback

* fix(turbo): add lint:check task for read-only lint+format CI checks

lint:check previously delegated to format:check which only checked
formatting. Now it runs biome check (no --write) which enforces both
lint rules and formatting without mutating files.

* upgrade turbo

* improvement(perf): apply react and js performance optimizations across codebase (#3459)

* improvement(perf): apply react and js performance optimizations across codebase

- Parallelize independent DB queries with Promise.all in API routes
- Defer PostHog and OneDollarStats via dynamic import() to reduce bundle size
- Use functional setState in countdown timers to prevent stale closures
- Replace O(n*m) .filter().find() with Set-based O(n) lookups in undo-redo
- Use .toSorted() instead of .sort() for immutable state operations
- Use lazy initializers for useState(new Set()) across 20 components
- Remove useMemo wrapping trivially cheap expressions (typeof, ternary, template strings)
- Add passive: true to scroll event listener

* fix(perf): address PR review feedback

- Extract IIFE Set patterns to named consts for readability in use-undo-redo
- Hoist Set construction above loops in BATCH_UPDATE_PARENT cases
- Add .catch() error handler to PostHog dynamic import
- Convert session-provider posthog import to dynamic import() to complete bundle split

* fix(analytics): add .catch() to onedollarstats dynamic import

* improvement(resource): tables, files

* improvement(resources): all outer page structure complete

* refactor(queries): comprehensive TanStack Query best practices audit (#3460)

* refactor: comprehensive TanStack Query best practices audit and migration

- Add AbortSignal forwarding to all 41 queryFn implementations for proper request cancellation
- Migrate manual fetch patterns to useMutation hooks (useResetPassword, useRedeemReferralCode, usePurchaseCredits, useImportWorkflow, useOpenBillingPortal, useAllowedMcpDomains)
- Migrate standalone hooks to TanStack Query (use-next-available-slot, use-mcp-server-test, use-webhook-management, use-referral-attribution)
- Fix query key factories: add missing `all` keys, replace inline keys with factory methods
- Fix optimistic mutations: use onSettled instead of onSuccess for cache reconciliation
- Replace overly broad cache invalidations with targeted key invalidation
- Remove keepPreviousData from static-key queries where it provides no benefit
- Add staleTime to queries missing explicit cache duration
- Fix `any` type in UpdateSettingParams with proper GeneralSettings typing
- Remove dead code: loadingWebhooks/checkedWebhooks from subblock store, unused helper functions
- Update settings components (general, debug, referral-code, credit-balance, subscription, mcp) to use mutation state instead of manual useState for loading/error/success

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: remove unstable mutation object from useCallback deps

openBillingPortal mutation object is not referentially stable,
but .mutate() is stable in TanStack Query v5. Remove from deps
to prevent unnecessary handleBadgeClick recreations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: add missing byWorkflows invalidation to useUpdateTemplate

The onSettled handler was missing the byWorkflows() invalidation
that was dropped during the onSuccess→onSettled migration. Without
this, the deploy modal (useTemplateByWorkflow) would show stale data
after a template update.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add TanStack Query best practices to CLAUDE.md and cursor rules

Add comprehensive React Query best practices covering:
- Hierarchical query key factories with intermediate plural keys
- AbortSignal forwarding in all queryFn implementations
- Targeted cache invalidation over broad .all invalidation
- onSettled for optimistic mutation cache reconciliation
- keepPreviousData only on variable-key queries
- No manual fetch in components rule
- Stable mutation references in useCallback deps

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: address PR review feedback

- Fix syncedRef regression in use-webhook-management: only set
  syncedRef.current=true when webhook is found, so re-sync works
  after webhook creation (e.g., post-deploy)
- Remove redundant detail(id) invalidation from useUpdateTemplate
  onSettled since onSuccess already populates cache via setQueryData

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: address second round of PR review feedback

- Reset syncedRef when blockId changes in use-webhook-management so
  component reuse with a different block syncs the new webhook
- Add response.ok check in postAttribution so non-2xx responses
  throw and trigger TanStack Query retry logic

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: use lists() prefix invalidation in useCreateWorkspaceCredential

Use workspaceCredentialKeys.lists() instead of .list(workspaceId) so
filtered list queries are also invalidated on credential creation,
matching the pattern used by update and delete mutations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: address third round of PR review feedback

- Add nullish coalescing fallback for bonusAmount in referral-code
  to prevent rendering "undefined" when server omits the field
- Reset syncedRef when queryEnabled becomes false so webhook data
  re-syncs when the query is re-enabled without component remount

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: address fourth round of PR review feedback

- Add AbortSignal to testMcpServerConnection for consistency
- Wrap handleTestConnection in try/catch for mutateAsync error handling
- Replace broad subscriptionKeys.all with targeted users()/usage() invalidation
- Add intermediate users() key to subscription key factory for prefix matching
- Add comment documenting syncedRef null-webhook behavior
- Fix api-keys.ts silent error swallowing on non-ok responses
- Move deployments.ts cache invalidation from onSuccess to onSettled

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: achieve full TanStack Query best practices compliance

- Add intermediate plural keys to api-keys, deployments, and schedules
  key factories for prefix-based invalidation support
- Change copilot-keys from refetchQueries to invalidateQueries
- Add signal parameter to organization.ts fetch functions (better-auth
  client does not support AbortSignal, documented accordingly)
- Move useCreateMcpServer invalidation from onSuccess to onSettled

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* ran lint

* Fix tables row count

* Update mothership to match copilot in logs

* improvement(resource): layout

* fix(knowledge): compute KB tokenCount from documents instead of stale column (#3463)

The knowledge_base.token_count column was initialized to 0 and never
updated. Replace with COALESCE(SUM(document.token_count), 0) in all
read queries, which already JOIN on documents with GROUP BY.

* improvement(resources): layout and items

* feat(knowledge): add v1 knowledge base API, Obsidian/Evernote connectors, and docs (#3465)

* feat(knowledge): add v1 knowledge base API, Obsidian/Evernote connectors, and docs

- Add v1 REST API for knowledge bases (CRUD, document management, vector search)
- Add Obsidian and Evernote knowledge base connectors
- Add file type validation to v1 file and document upload endpoints
- Update OpenAPI spec with knowledge base endpoints and schemas
- Add connectors documentation page
- Apply query hook formatting improvements

* fix(knowledge): address PR review feedback

- Remove validateFileType from v1/files route (general file upload, not document-only)
- Reject tag filters when searching multiple KBs (tag defs are KB-specific)
- Cache tag definitions to avoid duplicate getDocumentTagDefinitions call
- Fix Obsidian connector silent empty results when syncContext is undefined

* improvement(connectors): add syncContext to getDocument, clean up caching

- Update docs to say 20+ connectors
- Add syncContext param to ConnectorConfig.getDocument interface
- Use syncContext in Evernote getDocument to cache tag/notebook maps
- Replace index-based cache check with Map keyed by KB ID in search route

* fix(knowledge): address second round of PR review feedback

- Fix Zod .default('text') overriding tag definition's actual fieldType
- Fix encodeURIComponent breaking multi-level folder paths in Obsidian
- Use 413 instead of 400 for file-too-large in document upload
- Add knowledge-bases to API reference docs navigation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(knowledge): prevent cross-workspace KB access in search

Filter accessible KBs by matching workspaceId from the request,
preventing users from querying KBs in other workspaces they have
access to but didn't specify.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(knowledge): audit resourceId, SSRF protection, recursion depth limit

- Fix recordAudit using knowledgeBaseId instead of newDocument.id
- Add SSRF validation to Obsidian connector (reject private/loopback URLs)
- Add max recursion depth (20) to listVaultFiles

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(obsidian): remove SSRF check that blocks localhost usage

The Obsidian connector is designed to connect to the Local REST API
plugin running on localhost (127.0.0.1:27124). The SSRF check was
incorrectly blocking this primary use case.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* improvement(resources): segmented API

* fix(execution): ensure background tasks await post-execution DB status updates (#3466)

The fire-and-forget IIFE in execution-core.ts for post-execution logging could be abandoned when trigger.dev tasks exit, leaving executions permanently stuck in "running" status. Store the promise on LoggingSession so background tasks can optionally await it before returning.

* improvement(resource): sorting and icons

* fix(resource): sorting

* improvement(settings): fix mcp modal, add option to edit JSON and add Sim as an MCP client (#3467)

* improvement(settings): fix mcp modal, add option to edit JSON and add Sim as an MCP client

* added docs link in sidebar

* ack comments

* ack comments

* fixed error msg

* feat(mothership): billing (#3464)

* Billing update

* more billing improvements

* credits UI

* credit purchase safety

* progress

* ui improvements

* fix cancel sub

* fix types

* fix daily refresh for teams

* make max features differentiated

* address bugbot comments

* address greptile comments

* revert isHosted

* address more comments

* fix org refresh bar

* fix ui rounding

* fix minor rounding

* fix upgrade issue for legacy plans

* fix formatPlanName

* fix email dispay names

* fix legacy team reference bugs

* referral bonus in credits

* fix org upgrade bug

* improve logs

* respect toggle for paid users

* fix landing page pro features and usage limit checks

* fixed query and usage

* add unit test

* address more comments

* enterprise guard

* fix limits bug

* pass period start/end for overage

* fix(sidebar): restore drag-and-drop for workflows and folders (#3470)

* fix(sidebar): restore drag-and-drop for workflows and folders

Made-with: Cursor

* update docs, unrelated

* improvement(tables): consolidation

* feat(schedules): add schedule creator modal for standalone jobs

Add modal to create standalone scheduled jobs from the Schedules page.
Includes POST API endpoint, useCreateSchedule mutation hook, and full
modal with schedule type selection, timezone, lifecycle, and live preview.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(schedules): add edit support with context menu for standalone jobs

* style(schedules): apply linter formatting

* improvement: tables, favicon

* feat(files): inline file viewer with text editing (#3475)

* feat(files): add inline file viewer with text editing and create file modal

Add file preview/edit functionality to the workspace files page. Text files
(md, json, txt, yaml, etc.) open in an editable textarea with Cmd/Ctrl+S save.
PDFs render in an iframe. New file button creates empty .md files via a modal.
Uses ResourceHeader breadcrumbs and ResourceOptionsBar for save/download/delete.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* improvement(files): add UX polish, PR review fixes, and context menu

- Add unsaved changes guard modal (matching credentials manager pattern)
- Add delete confirmation modal for both viewer and context menu
- Add save status feedback (Save → Saving... → Saved)
- Add right-click context menu with Open, Download, Delete actions
- Add 50MB file size limit on content update API
- Add storage quota check before content updates
- Add response.ok guard on download to prevent corrupt files
- Add skeleton loading for pending file selection (prevents flicker)
- Fix updateContent in handleSave dependency array

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(files): propagate save errors and remove redundant sizeDiff

- Remove try/catch in TextEditor.handleSave so errors propagate to
  parent, which correctly shows save failure status
- Remove redundant inner sizeDiff declaration that shadowed outer scope

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(files): remove unused textareaRef

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(files): move Cmd+S to parent, add save error feedback, hide save for non-text files

- Move Cmd+S keyboard handler from TextEditor to Files so it goes
  through the parent handleSave with proper status management
- Add 'error' save status with red "Save failed" label that auto-resets
- Only show Save button for text-editable file types (md, txt, json, etc.)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* improvement(files): add save tooltip, deduplicate text-editable extensions

- Add Tooltip on Save button showing Cmd+S / Ctrl+S shortcut
- Export TEXT_EDITABLE_EXTENSIONS from file-viewer and reuse in files.tsx
  instead of duplicating the list inline

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: extract isMacPlatform to shared utility

Move isMacPlatform() from global-commands-provider.tsx to
lib/core/utils/platform.ts so it can be reused by files.tsx tooltip
without duplication.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor(files): deduplicate delete modal, use shared formatFileSize

- Extract DeleteConfirmModal component to eliminate duplicate modal
  markup between viewer and list modes
- Replace local formatFileSize with shared utility from file-utils.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(files): fix a11y label lint error and remove mutation object from useCallback deps

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(files): add isDirty guard on handleSave, return proper HTTP status codes

Prevents "Saving → Saved" flash when pressing Cmd+S with no changes.
Returns 404 for file-not-found and 402 for quota-exceeded instead of 500.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(files): reset isDirty/saveStatus on delete and discard, remove deprecated navigator.platform

- Clear isDirty and saveStatus when deleting the currently-viewed file to
  prevent spurious beforeunload prompts
- Reset saveStatus on discard to prevent stale "Save failed" when opening
  another file
- Remove deprecated navigator.platform, userAgent fallback covers all cases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(files): prevent concurrent saves on rapid Cmd+S, add YAML MIME types

- Add saveStatus === 'saving' guard to handleSave to prevent duplicate
  concurrent PUT requests from rapid keyboard shortcuts
- Add yaml/yml MIME type mappings to getMimeTypeFromExtension

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor(files): reuse shared extension constants, parallelize cancelQueries

- Replace hand-rolled SUPPORTED_EXTENSIONS with composition from existing
  SUPPORTED_DOCUMENT/AUDIO/VIDEO_EXTENSIONS in validation.ts
- Parallelize sequential cancelQueries calls in delete mutation onMutate

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(files): guard handleCreate against duplicate calls while pending

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(files): show upload progress on the Upload button, not New file

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(files): use ref-based guard for create pending state to avoid stale closure

The uploadFile.isPending check was stale because the mutation object
is excluded from useCallback deps (per codebase convention). Using a
ref ensures the guard works correctly across rapid Enter key presses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* cleanup(files): use shared icon import, remove no-op props, wrap handler in useCallback

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* improvement: tables, dropdown

* improvement(docs): align sidebar method badges and polish API reference styling (#3484)

* improvement(docs): align sidebar method badges and polish API reference styling

* fix(docs): revert className prop on DocsPage for CI compatibility

* fix(docs): restore oneOf schema for delete rows and use rem units in CSS

* fix(docs): replace :has() selectors with direct className for reliable prod layout

The API docs layout was intermittently narrow in production because CSS
:has(.api-page-header) selectors are unreliable in Tailwind v4 production
builds. Apply className="openapi-page" directly to DocsPage and replace
all 64 :has() selectors with .openapi-page class targeting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(docs): bypass TypeScript check for className prop on DocsPage

Use spread with type assertion to pass className to DocsPage, working
around a CI type resolution issue where the prop exists at runtime but
is not recognized by TypeScript in the Vercel build environment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(docs): use inline style tag for grid layout, revert CSS to :has() selectors

The className prop on DocsPage doesn't exist in the fumadocs-ui version
resolved on Vercel, so .openapi-page was never applied and all 64 CSS
rules broke. Revert to :has(.api-page-header) selectors for styling and
use an inline <style> tag for the critical grid-column layout override,
which is SSR'd and doesn't depend on any CSS selector matching.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(docs): add pill styling to footer navigation method badges

The footer nav badges (POST, GET, etc.) had color from data-method rules
but lacked the structural pill styling (padding, border-radius, font-size).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* fix(docs): use named grid lines instead of numeric column indices (#3487)

Root cause: the fumadocs grid template has 3 columns in production but
5 columns in local dev. Our CSS used `grid-column: 3 / span 2` which
targeted the wrong column in the 3-column grid, placing content in
the near-zero-width TOC column instead of the main content column.

Fix: use `grid-column: main-start / toc-end` which uses CSS named grid
lines from grid-template-areas, working regardless of column count.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* improvement(resource): layout

* improvement: icon, resource header options

* improvement: icons

* fix(files): icon

* feat(tables): column operations, row ordering, V1 API (#3488)

* feat(tables): add column operations, row ordering, V1 columns API, and OpenAPI spec

Adds column rename/delete/type change/constraint updates to the tables module,
row ordering via position column, UI metadata schema, V1 public API for column
operations with rate limiting and audit logging, and OpenAPI documentation.

Key changes:
- Service-layer column operations with validation (name pattern, type compatibility, unique/required constraints)
- Position column on user_table_rows with composite index for efficient ordering
- V1 /api/v1/tables/{tableId}/columns endpoint (POST/PATCH/DELETE) with rate limiting and audit
- Shared Zod schemas extracted to table/utils.ts using COLUMN_TYPES constant
- Targeted React Query invalidation (row vs schema mutations) with consistent onSettled usage
- OpenAPI 3.1.0 spec for columns endpoint with code samples
- Position field added to all row response mappings for consistency
- Sort fallback to position ordering when buildSortClause returns null

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(tables): use specific error prefixes instead of broad "Cannot" match

Prevents internal TypeErrors (e.g. "Cannot read properties of undefined")
from leaking as 400 responses. Now matches only domain-specific errors:
"Cannot delete the last column" and "Cannot set column".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(tables): reject Infinity and NaN in number type compatibility check

Number.isFinite rejects Infinity, -Infinity, and NaN, preventing
non-finite values from passing column type validation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(tables): invalidate table list on row create/delete for stale rowCount

Row create and delete mutations now invalidate the table list cache since
it includes a computed rowCount. Row updates (which don't change count)
continue to only invalidate row queries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(tables): add column name length check, deduplicate name gen, reset pagination on clear

- Add MAX_COLUMN_NAME_LENGTH validation to addTableColumn (was missing,
  renameColumn already had it)
- Extract generateColumnName helper to eliminate triplicated logic across
  handleAddColumn, handleInsertColumnLeft, handleInsertColumnRight
- Reset pagination to page 0 when clearing sort/filter to prevent showing
  empty pages after narrowing filters are removed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: hoist tableId above try block in V1 columns route, add detail invalidation to invalidateRowCount

- V1 columns route: `tableId` was declared inside `try` but referenced in
  `catch` logger.error, causing undefined in error logs. Hoisted `await params`
  above try in all three handlers (POST, PATCH, DELETE).
- invalidateRowCount: added `tableKeys.detail(tableId)` invalidation since the
  single-table GET response includes `rowCount`, which becomes stale after
  row create/delete without this.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: add position to all row mutation responses, remove dead filter code

- Add `position` field to POST (single + batch) and PATCH row responses
  across both internal and V1 routes, matching GET responses and OpenAPI spec.
- Remove unused `filterConfig`, `handleFilterToggle`, `handleFilterClear`,
  and `activeFilters` — dead code left over from merge conflict resolution.
  `handleFilterApply` (the one actually wired to JSX) is preserved.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: invalidateTableSchema now also invalidates table list cache

Column add/rename/delete/update mutations now invalidate tableKeys.list()
since the list endpoint returns schema.columns for each table. Without this,
the sidebar table list would show stale column schemas until staleTime expires.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: replace window.prompt/confirm with emcn Modal dialogs

Replace non-standard browser dialogs with proper emcn Modal components
to match the existing codebase pattern (e.g. delete table confirmation).

- Column rename: Modal with Input field + Enter key support
- Column delete: Modal with destructive confirmation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* update schedule creation ui and run lint

* improvement: logs

* improvement(tables): multi-select and efficiencies

* Table tools

* improvement(folder-selection): folder deselection + selection order should match visual

* fix(selections): more nested folder inaccuracies

* Tool updates

* Store tool call results

* fix(landing): wire agent input to mothership

* feat(mothership): resource viewer

* fix tests

* fix(streaming): smoother streaming with throttled rendering, ResizeObserver scroll, and batched updates (#3471)

* fix(streaming): smoother streaming with throttled rendering, ResizeObserver scroll, and batched updates

- Add useThrottledValue hook (100ms trailing-edge throttle) to gate DOM re-renders during streaming across all chat surfaces
- Replace 100ms setInterval scroll polling with ResizeObserver-based auto-scroll, programmatic scroll timestamp tracking, and nested [data-scrollable] region handling
- Extract processContentBuffer from inline content handler for cleaner code organization in copilot SSE handlers
- Add RAF-based update batching (50ms max interval) to floating chat and home chat streaming paths
- Add useProgressiveList hook for progressive rendering of long conversation histories via requestAnimationFrame

Made-with: Cursor

* ack PR comments

* fix search modal

* more comments

* ack comments

* count

* ack comments

* ack comment

* improvement(mothership): worklfow resource

* Fix tool call persistence in chat

* Tool results

* Fix error status

* File uploads to mothership

* feat(templates): landing page templates workflow states

* improvement(mothership): chat stability

* improvement(mothership): chat history and stability

* improvement(tables): click-to-select navigation, inline rename, column resize (#3496)

* improvement(tables): click-to-select navigation, inline rename, column resize

* fix(tables): address PR review comments

- Add doneRef guard to useInlineRename preventing Enter+blur double-fire
- Fix PATCH error handler: return 500 for non-validation errors, fix unreachable logger.error
- Stop click propagation on breadcrumb rename input

* fix(tables): add rows-affected check in renameTable service

Prevents silent no-op when tableId doesn't match any record.

* fix(tables): useMemo deps + placeholder memo initialCharacter check

- Use primitive editingId/editValue in useMemo deps instead of whole
  useInlineRename object (which creates a new ref every render)
- Add initialCharacter comparison to placeholderPropsAreEqual, matching
  the existing pattern in dataRowPropsAreEqual

* fix(tables): address round 2 review comments

- Mirror name validation (regex + max length) in PatchTableSchema so
  validateTableName failures return 400 instead of 500
- Add .returning() + rows-affected check to renameWorkspaceFile,
  matching the renameTable pattern
- Check response.ok before parsing JSON in useRenameWorkspaceFile,
  matching the useRenameTable pattern

* refactor(tables): reuse InlineRenameInput in BreadcrumbSegment

Replace duplicated inline input markup with the shared component.
Eliminates redundant useRef, useEffect, and input boilerplate.

* fix(tables): set doneRef in cancelRename to prevent blur-triggered save

Escape → cancelRename → input unmounts → blur → submitRename would
save instead of canceling. Now cancelRename sets doneRef like
submitRename does, blocking the subsequent blur handler.

* fix(tables): pointercancel cleanup + typed FileConflictError

- Add pointercancel handler to column resize to prevent listener leaks
  when system interrupts the pointer (touch-action override, etc.)
- Replace stringly-typed error.message.includes('already exists') with
  FileConflictError class for refactor-safe 409 status detection

* fix(tables): stable useCallback dep + rename shadowed variable

- Use listRename.startRename (stable ref) instead of whole listRename
  object in handleContextMenuRename deps
- Rename inner 'target' to 'origin' in arrow-key handler to avoid
  shadowing the outer HTMLElement 'target'

* fix(tables): move class below imports, stable submitRename, clear editingCell

- Move FileConflictError below import statements (import-first convention)
- Make submitRename a stable useCallback([]) by reading editingId and
  editValue through refs (matches existing onSaveRef pattern)
- Add setEditingCell(null) to handleEmptyRowClick for symmetry with
  handleCellClick

* feat(tables): persist column widths in table metadata

Column widths now survive navigation and page reloads. On resize-end,
widths are debounced (500ms) and saved to the table's metadata field
via a new PUT /api/table/[tableId]/metadata endpoint. On load, widths
are seeded from the server once via React Query.

* fix type checking for file viewer

* fix(tables): address review feedback — 4 fixes

1. headerRename.onSave now uses the fileId parameter directly instead
   of the selectedFile closure, preventing rename-wrong-file race
2. updateMetadataMutation uses ref pattern matching mutateRef/createRef
3. Type-to-enter filters non-numeric chars for number columns, non-date
   chars for date columns
4. renameValue only passed to actively-renaming ColumnHeaderMenu,
   preserving React.memo for other columns

* fix(tables): position-based gap rows, insert above/below, consistency fixes

- Fix gap row insert shifting: only shift rows when target position is
  occupied, preventing unnecessary displacement of rows below
- Switch to position-based indexing throughout (positionMap, maxPosition)
  instead of array-index for correct sparse position handling
- Add insert row above/below to context menu
- Use CellContent for pending values in PositionGapRows (matching PlaceholderRows)
- Add belowHeader selection overlay logic to PositionGapRows
- Remove unnecessary 500ms debounce on column width persistence

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix cells nav w keyboard

* added preview panel for html, markdown rendering, completed table

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* fix(tables): one small tables ting (#3497)

* feat(exa-hosted-key): Restore exa hosted key (#3499)

Co-authored-by: Theodore Li <theo@sim.ai>

* improvement(ui): consistent styling

* styling alignment

* improvements(tables): styling improvements

* improve resizer for file preview for html files

* updated document icon

* fix(credentials): exclude regular login methods from credential sync

* update docs

* upgrade turbo

* improvement: tables, chat

* Fix table column delete

* small table rename bug, files updates not persisting

* Table batch ops

* fix(credentials): block usage at execution layer without perms + fix invites

* feat(hosted-key-services) Add hosted key for multiple services (#3461)

* feat(hosted keys): Implement serper hosted key

* Handle required fields correctly for hosted keys

* Add rate limiting (3 tries, exponential backoff)

* Add custom pricing, switch to exa as first hosted key

* Add telemetry

* Consolidate byok type definitions

* Add warning comment if default calculation is used

* Record usage to user stats table

* Fix unit tests, use cost property

* Include more metadata in cost output

* Fix disabled tests

* Fix spacing

* Fix lint

* Move knowledge cost restructuring away from generic block handler

* Migrate knowledge unit tests

* Lint

* Fix broken tests

* Add user based hosted key throttling

* Refactor hosted key handling. Add optimistic handling of throttling for custom throttle rules.

* Remove research as hosted key. Recommend BYOK if throtttling occurs

* Make adding api keys adjustable via env vars

* Remove vestigial fields from research

* Make billing actor id required for throttling

* Switch to round robin for api key distribution

* Add helper method for adding hosted key cost

* Strip leading double underscores to avoid breaking change

* Lint fix

* Remove falsy check in favor for explicit null check

* Add more detailed metrics for different throttling types

* Fix _costDollars field

* Handle hosted agent tool calls

* Fail loudly if cost field isn't found

* Remove any type

* Fix type error

* Fix lint

* Fix usage log double logging data

* Fix test

* Add browseruse hosted key

* Add firecrawl and serper hosted keys

* feat(hosted key): Add exa hosted key (#3221)

* feat(hosted keys): Implement serper hosted key

* Handle required fields correctly for hosted keys

* Add rate limiting (3 tries, exponential backoff)

* Add custom pricing, switch to exa as first hosted key

* Add telemetry

* Consolidate byok type definitions

* Add warning comment if default calculation is used

* Record usage to user stats table

* Fix unit tests, use cost property

* Include more metadata in cost output

* Fix disabled tests

* Fix spacing

* Fix lint

* Move knowledge cost restructuring away from generic block handler

* Migrate knowledge unit tests

* Lint

* Fix broken tests

* Add user based hosted key throttling

* Refactor hosted key handling. Add optimistic handling of throttling for custom throttle rules.

* Remove research as hosted key. Recommend BYOK if throtttling occurs

* Make adding api keys adjustable via env vars

* Remove vestigial fields from research

* Make billing actor id required for throttling

* Switch to round robin for api key distribution

* Add helper method for adding hosted key cost

* Strip leading double underscores to avoid breaking change

* Lint fix

* Remove falsy check in favor for explicit null check

* Add more detailed metrics for different throttling types

* Fix _costDollars field

* Handle hosted agent tool calls

* Fail loudly if cost field isn't found

* Remove any type

* Fix type error

* Fix lint

* Fix usage log double logging data

* Fix test

---------

Co-authored-by: Theodore Li <teddy@zenobiapay.com>

* Fail fast on cost data not being found

* Add hosted key for google services

* Add hosting configuration and pricing logic for ElevenLabs TTS tools

* Add linkup hosted key

* Add jina hosted key

* Add hugging face hosted key

* Add perplexity hosting

* Add broader metrics for throttling

* Add skill for adding hosted key

* Lint, remove vestigial hosted keys not implemented

* Revert agent changes

* fail fast

* Fix build issue

* Fix build issues

* Fix type error

* Remove byok types that aren't implemented

* Address feedback

* Use default model when model id isn't provided

* Fix cost default issues

* Remove firecrawl error suppression

* Restore original behavior for hugging face

* Add mistral hosted key

* Remove hugging face hosted key

* Fix pricing mismatch is mistral and perplexity

* Add hosted keys for parallel and brand fetch

* Add brandfetch hosted key

* Update types

* Change byok name to parallel_ai

* Add telemetry on unknown models

---------

Co-authored-by: Theodore Li <theo@sim.ai>

* improvement(settings): SSR prefetch, code splitting, dedicated skeletons

* fix: bust browser cache for workspace file downloads

The downloadFile function was using a plain fetch() that honored the
aggressive cache headers, causing newly created files to download empty.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(settings): use emcn Skeleton in extracted skeleton files

* fix(settings): extract shared response mappers to prevent server/client shape drift

Addresses PR review feedback — prefetch.ts duplicated response mapping logic from client hooks. Extracted mapGeneralSettingsResponse and mapUserProfileResponse as shared functions used by both client fetch and server prefetch.

* update byok page

* fix(settings): include theme sync in client-side prefetch queryFn

Hover-based prefetchGeneralSettings now calls syncThemeToNextThemes, matching the useGeneralSettings hook behavior so theme updates aren't missed when prefetch refreshes stale cache.

* fix(byok): use EMCN Input for search field instead of ui Input

Replace @/components/ui Input with the already-imported EmcnInput for design-system consistency.

* fix(byok): use ui Input for search bar to match other settings pages

* fix(settings): use emcn Input for file input in general settings

* improvement(settings): add search bar to skeleton loading states

Skeletons now include the search bar (and action button where applicable) so the layout matches the final component 1:1. Eliminates layout shift when the dynamic chunk loads — search bar area is already reserved by the skeleton.

* fix(settings): align skeleton layouts with actual component structures

- Fix list item gap from 12px to 8px across all skeletons (API keys, custom tools, credentials, MCP)
- Add OAuth icon placeholder to credential skeleton
- Fix credential button group gap from 8px to 4px
- Remove incorrect gap-[4px] from credential-sets text column
- Rebuild debug skeleton to match real layout (description + input/button row)
- Add scrollable wrapper to BYOK skeleton with more representative item count

* chore: lint fixes

* improvement(sidebar): match workspace switcher popover width to sidebar

Use Radix UI's built-in --radix-popover-trigger-width CSS variable
instead of hardcoded 160px so the popover matches the trigger width
and responds to sidebar resizing.

* revert hardcoded ff

* fix: copilot, improvement: tables, mothership

* feat: inline chunk editor and table batch ops with undo/redo (#3504)

* feat: inline chunk editor and table batch operations with undo/redo

Replace modal-based chunk editing/creation with inline editor following
the files tab pattern (state-based view toggle with ResourceHeader).
Add batch update API endpoint, undo/redo support, and Popover-based
context menus for tables.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: remove icons from table context menu PopoverItems

Icons were incorrectly carried over from the DropdownMenu migration.
PopoverItems in this codebase use text-only labels.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: restore DropdownMenu for table context menu

The table-level context menu was incorrectly migrated to Popover during
conflict resolution. Only the row-level context menu uses Popover; the
table context menu should remain DropdownMenu with icons, matching the
base branch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: bound cross-page chunk navigation polling to max 50 retries

Prevent indefinite polling if page data never loads during
chunk navigation across page boundaries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: navigate to last page after chunk creation for multi-page documents

After creating a chunk, navigate to the last page (where new chunks
append) before selecting it. This prevents the editor from showing
"Loading chunk..." when the new chunk is not on the current page.
The loading state breadcrumb remains as an escape hatch for edge cases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: add duplicate rowId validation to BatchUpdateByIdsSchema

Adds a .refine() check to reject duplicate rowIds in batch update
requests, consistent with the positions uniqueness check on batch insert.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: address PR review comments

- Fix disableEdit logic: use || instead of && so connector doc chunks
  cannot be edited from context menu (row click still opens viewer)
- Add uniqueness validation for rowIds in BatchUpdateByIdsSchema
- Fix inconsistent bg token: bg-background → bg-[var(--bg)] in Pagination

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: remove duplicate rowId uniqueness refine on BatchUpdateByIdsSchema

The refine was applied both on the inner updates array and the outer
object. Keep only the inner array refine which is cleaner.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: address additional PR review comments

- Fix stale rowId after create-row redo: patch undo stack with new row
  ID using patchUndoRowId so subsequent undo targets the correct row
- Fix text color tokens in Pagination: use CSS variable references
  (text-[var(--text-body)], text-[var(--text-secondary)]) instead of
  Tailwind semantic tokens for consistency with the rest of the file

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: remove dead code and fix type errors in table context menu

Remove unused `onAddData` prop and `isEmptyCell` variable from row context
menu (introduced in PR but never wired to JSX). Fix type errors in
optimistic update spreads by removing unnecessary `as Record<string, unknown>`
casts that lost the RowData type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: prevent false "Saved" status on invalid content and mark fire-and-forget goToPage calls

ChunkEditor.handleSave now throws on empty/oversized content instead of
silently returning, so the parent's catch block correctly sets saveStatus
to 'error'. Also added explicit `void` to unawaited goToPage(1) calls
in filter handlers to signal intentional fire-and-forget.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: handle stale totalPages in handleChunkCreated for new-page edge case

When creating a chunk that spills onto a new page, totalPages in the
closure is stale. Now polls displayChunksRef for the new chunk, and if
not found, checks totalPagesRef for an updated page count and navigates
to the new last page before continuing to poll.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Streaming fix -- need to test more

* Make mothership block use long input instead of prompt input

* improvement(billing): isAnnual metadata + docs updates (#3506)

* improvement(billing): on demand toggling and infinite limits

* store stripe metadata to distinguish annual vs monthly

* udpate docs

* address bugbot

* Add piping

* feat(clean-hosted-keys) Remove eleven labs, browseruse. Tweak firecrawl and mistral key impl (#3503)

* Remove eleven labs, browseruse, and firecrawl

* Remove creditsUsed output

* Add back mistral hosting for mistral blocks

* Add back firecrawl since they queue up concurrent requests

* Fix price calculation, remove agent since its super long running and will clog up queue

* Define hosting per tool

* Remove redundant token finding

---------

Co-authored-by: Theodore Li <theo@sim.ai>

* Update vfs to handle hosted keys

* improvement(tables): fix cell editing flash, batch API docs, and UI polish (#3507)

* fix: show text cursor in chunk editor and ensure textarea fills container

Add cursor-text to the editor wrapper so the whole area shows a text
cursor. Click on empty space focuses the textarea. Changed textarea from
h-full/w-full to flex-1/min-h-0 so it properly fills the flex container.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* improvement(tables): fix cell editing flash, add batch API docs, and UI polish

Fix stale-data flash when saving inline cell edits by using TanStack Query's
isPending+variables pattern instead of manual cache writes. Also adds OpenAPI
docs for batch table endpoints, DatePicker support in row modal, duplicate row
in context menu, and styling improvements.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: remove dead resolveColumnFromEvent callback

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: unify paste undo into single create-rows action

Batch-created rows from paste now push one `create-rows` undo entry
instead of N individual `create-row` entries, so a single Ctrl+Z
reverses the entire paste operation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: validate dates in inline editor and displayToStorage

InlineDateEditor now validates computed values via Date.parse before
saving, preventing invalid strings like "hello" from being sent to the
server. displayToStorage now rejects out-of-range month/day values
(e.g. 13/32) instead of producing invalid YYYY-MM-DD strings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: accept ISO date format in inline date editor

Fall back to raw draft input when displayToStorage returns null, so
valid ISO dates like "2024-03-15" pasted or typed directly are
accepted instead of silently discarded. Date.parse still validates
the final value.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: add ISO date support to displayToStorage and fix picker Escape

displayToStorage now recognizes YYYY-MM-DD input directly, so ISO
dates typed or pasted work correctly for both saving and picker sync.

DatePicker Escape now refocuses the input instead of saving, so the
user can press Escape again to cancel or Enter to confirm — matching
the expected cancel behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: remove dead paste boundary check

The totalR guard in handlePaste could never trigger since totalR
included pasteRows.length, making targetRow always < totalR.
Remove the unused variable and simplify the selection focus calc.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* update openapi

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* fix dysfunctional unique operation in tables

* feat(autosave): files and chunk editor autosave with debounce + refetch  (#3508)

* feat(files): debounced autosave while editing

* address review comments

* more comments

* fix: unique constraint check crash and copilot table initial rows

- Fix TypeError in updateColumnConstraints: db.execute() returns a
  plain array with postgres-js, not { rows: [...] }. The .rows.length
  access always crashed, making "Set unique" completely broken.

- Add initialRowCount: 20 to copilot table creation so tables created
  via chat have the same empty rows as tables created from the UI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix signaling

* revert: remove initialRowCount from copilot table creation

Copilot populates its own data after creating a table, so pre-creating
20 empty rows causes data to start at position 21 with empty rows above.
initialRowCount only makes sense for the manual UI creation flow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* improvement: chat, workspace header

* chat metadata

* Fix schema mismatch (#3510)

Co-authored-by: Theodore Li <theo@sim.ai>

* Fixes

* fix: manual table creation starts with 1 row, 1 column

Manual tables now create with a single 'name' column and 1 row instead
of 2 columns and 20 rows. Copilot tables remain at 0 rows, 0 columns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: horizontal scroll in embedded table by replacing overflow-hidden with overflow-clip

Cell content spans used Tailwind's `truncate` (overflow: hidden), creating
scroll containers that consumed trackpad wheel events on macOS without
propagating to the actual scroll ancestor. Replaced with overflow-clip
which clips identically but doesn't create a scroll container. Also moved
focus target from outer container to the scroll div for correctness.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix tool call ordering

* Fix tests

* feat: add task multi-select, context menu, and subscription UI updates

Add shift-click range selection, cmd/ctrl-click toggle, and right-click
context menu for tasks in sidebar matching workflow/folder patterns.
Update subscription settings tab UI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(credentials): autosync behaviour cross workspace (#3511)

* fix(credentials): autosync behaviour cross workspace

* address comments

* fix(api-key-reminder) Add reminder on hosted keys that api key isnt needed (#3512)

* Add reminder on hosted keys that api key isnt needed

* Fix test case

---------

Co-authored-by: Theodore Li <theo@sim.ai>

* improvement: sidebar, chat

* Usage limit

* Plan prompt

* fix(sidebar): workspace header collapse

* fix(sidebar): task navigation

* Subagent tool call persistence

* Don't drop suabgent text

* improvement(ux): streaming

* improvement: thinking

* fix(random): optimized kb connector sync engine, rerenders in tables, files, editors, chat (#3513)

* optimized kb connector sync engine, rerenders in tables, files, editors, chat

* refactor(sidebar): rename onTaskClick to onMultiSelectClick for clarity

Made-with: Cursor

* ack comments, add docsFailed

* feat(email-footer) Add "sent with sim ai" for free users (#3515)

* Add "sent with sim ai" for free users

* Only add prompt injection on free tier

* Add try catch around billing info fetch

---------

Co-authored-by: Theodore Li <theo@sim.ai>

* improvement: modals

* ran migrations

* fix(mothership): fix hardcoded workflow color, tables drag line overflowing

* feat(mothership): file attachment indicators, persistence, and chat input improvements

- Show image thumbnails and file-icon cards above user messages in mothership chat
- Persist file attachment metadata (key, filename, media_type, size) in DB with user messages
- Restore attachments from history via /api/files/serve/ URLs so they survive refresh/navigation
- Unify all chat file inputs to use shared CHAT_ACCEPT_ATTRIBUTE constant
- Fix file thumbnail overflow: use flex-wrap instead of hidden horizontal scroll
- Compact attachment cards in floating workflow chat messages

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* improvement: search modal

* improvement(usage): free plan to 1000 credits  (#3516)

* improvement(billing): free plan to five dollars

* fix comment

* remove per month terminology from marketing

* generate migration

* remove migration

* add migration back

* feat(workspace): add workspace color changing, consolidate update hooks, fix popover dismiss

- Add workspace color change via context menu, reusing workflow ColorGrid UI
- Consolidate useUpdateWorkspaceName + useUpdateWorkspaceColor into useUpdateWorkspace
- Fix popover hover submenu dismiss by using DismissableLayerBranch with pointerEvents
- Remove passthrough wrapper for export, reuse Workspace type for capturedWorkspaceRef
- Reorder log columns: workflow first, merge date+time into single column

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Update oauth cred tool

* fix(diff-controls): fixed positioning for copilot diff controls

* fix(font): added back old font for emcn code editor

* improvement: panel, special tags

* improvement: chat

* improvement: loading and file dropping

* feat(templates): create home templates

* fix(uploads): resolve .md file upload rejection and deduplicate file type utilities

Browsers report empty or application/octet-stream MIME types for .md files,
causing copilot uploads to be rejected. Added resolveFileType() utility that
falls back to extension-based MIME resolution at both client and server
boundaries. Consolidated duplicate MIME mappings into module-level constants,
removed duplicate isImageFileType from copilot module, and replaced hardcoded
ALLOWED_EXTENSIONS with composition from shared validation constants. Also
switched file attachment previews to use shared getDocumentIcon utility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(home): prevent initial view from being scrollable

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* autofill fixes

* added back integrations page, reverted secrets page back to old UI

* Fix workspace dropdown getting cut off when sidebar is collapsed

* fix(mothership): lint (#3517)

* fix(mothership): lint

* fix typing

* fix tests

* fix stale query

* fix plan display name

* Feat/add mothership manual workflow runs (#3520)

* Add run and open workflow buttons in workflow preview

* Send log request message after manual workflow run

* Make edges in embedded workflow non-editable

* Change chat to pass in log as additional context

* Revert "Change chat to pass in log as additional context"

This reverts commit e957dffb2f.

* Revert "Send log request message after manual workflow run"

This reverts commit 0fb92751f0.

* Move run and workflow icons to tab bar

* Simplify boolean condition

---------

Co-authored-by: Theodore Li <theo@sim.ai>

* feat(resource-tab-scroll): Allow vertical scrolling to scroll resource tab

* fix(remove-speed-hosted-key) Remove maps speed limit hosted key, it's deprecated (#3521)

Co-authored-by: Theodore Li <theo@sim.ai>

* improvement: home, sidebar

* fix(download-file): render correct file download link for mothership (#3522)

* fix(download-file): render correct file download link for mothership

* Fix uunecessary call

* Use simple strip instead of db lookup and moving behavior

* Make regex strip more strict

---------

Co-authored-by: Theodore Li <theo@sim.ai>

* improvement: schedules, auto-scroll

* fix(settings): navigate back to origin page instead of always going home

Use sessionStorage to store the return URL when entering settings, and
use router.replace for tab switches so history doesn't accumulate.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(schedules): release lastQueuedAt lock on all exit paths to prevent stuck schedules

Multiple error/early-return paths in executeScheduleJob and executeJobInline
were exiting without clearing lastQueuedAt, causing the dueFilter to permanently
skip those schedules — resulting in stale "X hours ago" display for nextRunAt.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(mothership): inline rename for resource tabs + workspace_file rename tool

- Add double-click inline rename on file and table resource tabs
- Wire useInlineRename + useRenameWorkspaceFile/useRenameTable mutations
- Add rename operation to workspace_file copilot tool (schema, server, router)
- Add knowledge base resource support (type, extraction, rendering, actions)
- Accept optional className on InlineRenameInput for context-specific sizing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* revert: remove inline rename UI from resource tabs

Keep the workspace_file rename tool for the mothership agent.
Only the UI-side inline rename (double-click tabs) is removed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(mothership): knowledge base resource extraction + Resource/ResourceTable refactor

- Extract KB resources from knowledge subagent respond format (knowledge_bases array)
- Add knowledge_base tool to RESOURCE_TOOL_NAMES and TOOL_UI_METADATA
- Extract ResourceTable as independently composable memoized component
- Move contentOverride/overlay to Resource shell level (not table primitive)
- Remove redundant disableHeaderSort and loadingRows props
- Rename internal sort state for clarity (sort → internalSort, sortOverride → externalSort)
- Export ResourceTable and ResourceTableProps from barrel

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(logs) Run workflows client side in mothership to transmit logs (#3529)

* Run workflows client side in mothership to transmit logs

* Initialize set as constant, prevent duplicate execution

* Fix lint

---------

Co-authored-by: Theodore Li <theo@sim.ai>

* fix(import) fix missing file

* fix(resource): Hide resources that have been deleted (#3528)

* Hide resources that have been deleted

* Handle table, workflow not found

* Add animation to prevent flash when previous resource was deleted

* Fix animation playing on every switch

* Run workflows client side in mothership to transmit logs

* Fix race condition for animation

* Use shared workflow tool util file

---------

Co-authored-by: Theodore Li <theo@sim.ai>

* fix: chat scrollbar on sidebar collapse/open

* edit existing workflow should bring up artifact

* fix(agent) subagent and main agent text being merged without spacing

* feat(mothership): remove resource-level delete tools from copilot

Remove delete operations for workflows, folders, tables, and files
from the mothership copilot to prevent destructive actions via AI.
Row-level and column-level deletes are preserved.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: stop sidebar from auto-collapsing when resource panel appears (#3540)

The sidebar was forcibly collapsed whenever a resource (e.g. workflow)
first appeared in the resource panel during a task. This was disruptive
on larger screens where users want to keep both the sidebar and resource
panel visible simultaneously.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* fix(mothership): insert copilot-created workflows at top of list (#3537)

* feat(mothership): remove resource-level delete tools from copilot

Remove delete operations for workflows, folders, tables, and files
from the mothership copilot to prevent destructive actions via AI.
Row-level and column-level deletes are preserved.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(mothership): insert copilot-created workflows at top of list

* fix(mothership): server-side top-insertion sort order and deduplicate registry logic

* fix(mothership): include folder sort orders when computing top-insertion position

* fix(mothership): use getNextWorkflowColor instead of hardcoded color

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* fix(stop) Add stop of motehership ran workflows, persist stop messages (#3538)

* Connect play stop workflow in embedded view to workflow

* Fix stop not actually stoping workflow

* Fix ui not showing stopped by user

* Lint fix

* Plumb cancellation through system

* Stopping mothership chat stops workflow

* Remove extra fluff

* Persist blocks on cancellation

* Add root level stopped by user

---------

Co-authored-by: Theodore Li <theo@sim.ai>

* fix(autolayout): targetted autolayout heuristic restored (#3536)

* fix(autolayout): targetted autolayout heuristic restored

* fix autolayout boundary cases

* more fixes

* address comments

* on conflict updates

* address more comments

* fix relative position scope

* fix tye omission

* address bugbot comment

* Credential tags

* Credential id field

* feat(mothership): server-persisted unread task indicators via SSE (#3549)

* feat(mothership): server-persisted unread task indicators via SSE

Replace fragile client-side polling + timer-based green flash with
server-persisted lastSeenAt semantics, real-time SSE push via Redis
pub/sub, and dot overlay UI on the Blimp icon.

- Add lastSeenAt column to copilotChats for server-persisted read state
- Add Redis/local pub/sub singleton for task status events (started,
  completed, created, deleted, renamed)
- Add SSE endpoint (GET /api/mothership/events) with heartbeat and
  workspace-scoped filtering
- Add mark-read endpoint (POST /api/mothership/chats/read)
- Publish SSE events from chat, rename, delete, and auto-title handlers
- Add useTaskEvents hook for client-side SSE subscription
- Add useMarkTaskRead mutation with optimistic update
- Replace timer logic in sidebar with TaskStatus state machine
  (running/unread/idle) and dot overlay using brand color variables
- Mark tasks read on mount and stream completion in home page
- Fix security: add userId check to delete WHERE clause
- Fix: bump updatedAt on stream completion
- Fix: set lastSeenAt on rename to prevent false-positive unread

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: address PR review feedback

- Return 404 when delete finds no matching chat (was silent no-op)
- Move log after ownership check so it only fires on actual deletion
- Publish completed SSE event from stop route so sidebar dot clears on abort

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: backfill last_seen_at in migration to prevent false unread dots

Existing rows would have last_seen_at = NULL after migration, causing
all past completed tasks to show as unread. Backfill sets last_seen_at
to updated_at for all existing rows.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: timestamp mismatch on task creation + wasSendingRef leak across navigation

- Pass updatedAt explicitly alongside lastSeenAt on chat creation so
  both use the same JS timestamp (DB defaultNow() ran later, causing
  updatedAt > lastSeenAt → false unread)
- Reset wasSendingRef when chatId changes to prevent a stale true
  from task A triggering a redundant markRead on task B

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: mark-read fires for inline-created chats + encode workspaceId in SSE URL

Expose resolvedChatId from useChat so home.tsx can mark-read even when
chatId prop stays undefined after replaceState URL update. Also
URL-encode workspaceId in EventSource URL as a defensive measure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: auto-focus home input on initial view + fix sidebar task click handling

Auto-focus the textarea when the initial home view renders. Also fix
sidebar task click to always call onMultiSelectClick so selection state
stays consistent.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: auto-title sets lastSeenAt + move started event inside DB guard

Auto-title now sets both updatedAt and lastSeenAt (matching the rename
route pattern) to prevent false-positive unread dots. Also move the
'started' SSE event inside the if(updated) guard so it only fires when
the DB update actually matched a row.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* modified tasks multi select to be just like workflows

* fix

* refactor: extract generic pub/sub and SSE factories + fixes

- Extract createPubSubChannel factory (lib/events/pubsub.ts) to eliminate
  duplicated Redis/EventEmitter boilerplate between task and MCP pub/sub
- Extract createWorkspaceSSE factory (lib/events/sse-endpoint.ts) to share
  auth, heartbeat, and cleanup logic across SSE endpoints
- Fix auto-title race suppressing unread status by removing updatedAt/lastSeenAt
  from title-only DB update
- Fix wheel event listener leak in ResourceTabs (RefCallback cleanup was silently
  discarded)
- Fix getFullSelection() missing taskIds (inconsistent with hasAnySelection)
- Deduplicate SSE_RESPONSE_HEADERS to spread from shared SSE_HEADERS
- Hoist isSttAvailable to module-level constant to avoid per-render IIFE

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* feat(logs): add workflow trigger type for sub-workflow executions (#3554)

* feat(logs): add workflow trigger type for sub-workflow executions

* fix(logs): align workflow filter color with blue-secondary badge variant

* feat(tab) allow user to control resource tabs

* Make resources persist to backend

* Use colored squares for workflows

* Add click and drag functionality to resource

* Fix expanding panel logic

* Reduce duplication, reading resource also opens up resource panel

* Move resource dropdown to own file

* Handle renamed resources

* Clicking already open tab should just switch to tab

---------

Co-authored-by: Theodore Li <theo@sim.ai>

* Fix new resource tab button not appearing on tasks

* improvement(ui): dropdown menus, icons, globals

* improvement: notifications, terminal, globals

* reverted task logic

* feat(context) pass resource tab as context (#3555)

* feat(context) add currenttly open resource file to context for agent

* Simplify resource resolution

* Skip initialize vfs

* Restore ff

* Add back try catch

* Remove redundant code

* Remove json serialization/deserialization loop

---------

Co-authored-by: Theodore Li <theo@sim.ai>

* Feat(references) add at to reference sim resources(#3560)


* feat(chat) add at sign

* Address bugbot issues

* Remove extra chatcontext defs

* Add table and file to schema

* Add icon to chip for files

---------

Co-authored-by: Theodore Li <theo@sim.ai>

* improvement(refactor): move to soft deletion of resources + reliability improvements (#3561)

* improvement(deletion): migrate to soft deletion of resources

* progress

* scoping fixes

* round of fixes

* deduplicated name on workflow import

* fix tests

* add migration

* cleanup dead code

* address bugbot comments

* optimize query

* feat(sim-mailer): email inbox for mothership with chat history and plan gating (#3558)

* feat(sim-mailer): email inbox for mothership with chat history and plan gating

* revert hardcoded ff

* fix(inbox): address PR review comments - plan enforcement, idempotency, webhook auth

- Enforce Max plan at API layer: hasInboxAccess() now checks subscription tier (>= 25k credits or enterprise)
- Add idempotency guard to executeInboxTask() to prevent duplicate emails on Trigger.dev retries
- Add AGENTMAIL_WEBHOOK_SECRET env var for webhook signature verification (Bearer token)

* improvement(inbox): harden security and efficiency from code audit

- Use crypto.timingSafeEqual for webhook secret comparison (prevents timing attacks)
- Atomic claim in executor: WHERE status='received' prevents duplicate processing on retries
- Parallelize hasInboxAccess + getUserEntityPermissions in all API routes (reduces latency)
- Truncate email body at webhook insertion (50k char limit, prevents unbounded DB storage)
- Harden escapeAttr with angle bracket and single quote escaping
- Rename use-inbox.ts to inbox.ts (matches hooks/queries/ naming convention)

* fix(inbox): replace Bearer token auth with proper Svix HMAC-SHA256 webhook verification

- Use per-workspace webhook secret from DB instead of global env var
- Verify AgentMail/Svix signatures: HMAC-SHA256 over svix-id.timestamp.body
- Timing-safe comparison via crypto.timingSafeEqual
- Replay protection via timestamp tolerance (5 min window)
- Join mothershipInboxWebhook in workspace lookup (zero additional DB calls)
- Remove dead AGENTMAIL_WEBHOOK_SECRET env var
- Select only needed workspace columns in webhook handler

* fix(inbox): require webhook secret — reject requests when secret is missing

Previously, if the webhook secret was missing from the DB (corrupted state),
the handler would skip verification entirely and process the request
unauthenticated. Now all three conditions are hard requirements: secret must
exist in DB, Svix headers must be present, and signature must verify.

* fix(inbox): address second round of PR review comments

- Exclude rejected tasks from rate limit count to prevent DoS via spam
- Strip raw HTML from LLM output before marked.parse to prevent XSS in emails
- Track responseSent flag to prevent duplicate emails when DB update fails after send

* fix(inbox): address third round of PR review comments

- Use dynamic isHosted from feature-flags instead of hardcoded true
- Atomic JSON append for chat message persistence (eliminates read-modify-write race)
- Handle cutIndex === 0 in stripQuotedReply (body starts with quote)
- Clean up orphan mothershipInboxWebhook row on enableInbox rollback
- Validate status query parameter against enum in tasks API

* fix(inbox): validate cursor param, preserve code blocks in HTML stripping

- Validate cursor date before using in query (return 400 for invalid)
- Split on fenced code blocks before stripping HTML tags to preserve
  code examples in email responses

* fix(inbox): return 500 on webhook server errors to enable Svix retries

* fix(inbox): remove isHosted guard from hasInboxAccess — feature flag is sufficient

* fix(inbox): prevent double-enable from deleting webhook secret row

* fix(inbox): null-safe stripThinkingTags, encode URL params, surface remove-sender errors

- Guard against null result.content in stripThinkingTags
- Use encodeURIComponent on all AgentMail API path parameters
- Surface handleRemoveSender errors to the user instead of swallowing

* improvement(inbox): remove unused types, narrow SELECT queries, fix optimistic ID collision

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(inbox): add keyboard accessibility to clickable task rows

* fix(inbox): use Svix library for webhook verification, fix responseSent flag, prevent inbox enumeration

- Replace manual HMAC-SHA256 verification with official Svix library per AgentMail docs
- Fix responseSent flag: only set true when email delivery actually succeeds
- Return consistent 401 for unknown inbox and bad signature to prevent enumeration
- Make AgentMailInbox.organization_id optional to match API docs

* chore(db): rebase inbox migration onto feat/mothership-copilot (0172 → 0173)

Sync schema with target branch and regenerate migration as 0173
to avoid conflicts with 0172_silky_magma on feat/mothership-copilot.

* fix(db): rebase inbox migration to 0173 after feat/mothership-copilot divergence

Target branch added 0172_silky_magma, so our inbox migration is now 0173_youthful_stryfe.

* fix(db): regenerate inbox migration after rebase on feat/mothership-copilot

* fix(inbox): case-insensitive email match and sanitize javascript: URIs in email HTML

- Use lower() in isSenderAllowed SQL to match workspace members regardless
  of email case stored by auth provider
- Strip javascript:, vbscript:, and data: URIs from marked HTML output to
  prevent XSS in outbound email responses

* fix(inbox): case-insensitive email match in resolveUserId

Consistent with the isSenderAllowed fix — uses lower() so mixed-case
stored emails match correctly, preventing silent fallback to workspace owner.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Kb args

* refactor(resource): remove logs-specific escape hatches from Resource abstraction

Logs now composes ResourceHeader + ResourceOptionsBar + ResourceTable directly
instead of using Resource with contentOverride/overlay escape hatches. Removes
contentOverride, onLoadMore, hasMore, isLoadingMore from ResourceProps. Adds
ColumnOption to barrel export and fixes table.tsx internal import.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(sim-mailer): download email attachments and pass to LLM as multimodal content

Attachments were only passed as metadata text in the email body. Now downloads
actual file bytes from AgentMail, converts via createFileContent (same path as
interactive chat), and sends as fileAttachments to the orchestrator. Also
parallelizes attachment fetching with workspace context loading, and downloads
multiple attachments concurrently via Promise.allSettled.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(connector): add Gmail knowledge base connector with thread-based sync and filtering

Syncs email threads from Gmail into knowledge bases with configurable filters:
label scoping, date range presets, promotions/social exclusion, Gmail search
syntax support, and max thread caps to keep KB size manageable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(connector): add Outlook knowledge base connector with conversation grouping and filtering

Syncs email conversations from Outlook/Office 365 via Microsoft Graph API.
Groups messages by conversationId into single documents. Configurable filters:
folder selection, date range presets, Focused Inbox, KQL search syntax, and
max conversation caps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* cleanup resource definition

* feat(connectors): add 8 knowledge base connectors — Zendesk, Intercom, ServiceNow, Google Sheets, Microsoft Teams, Discord, Google Calendar, Reddit

Each connector syncs documents into knowledge bases with configurable filtering:

- Zendesk: Help Center articles + support tickets with status/locale filters
- Intercom: Articles + conversations with state filtering
- ServiceNow: KB articles + incidents with state/priority/category filters
- Google Sheets: Spreadsheet tabs as LLM-friendly row-by-row documents
- Microsoft Teams: Channel messages (Slack-like pattern) via Graph API
- Discord: Channel messages with bot token auth
- Google Calendar: Events with date range presets and attendee metadata
- Reddit: Subreddit posts with top comments, sort/time filters

All connectors validated against official API docs with bug fixes applied.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(inbox): fetch real attachment binary from presigned URL and persist for chat display

The AgentMail attachment endpoint returns JSON metadata with a download_url,
not raw binary. We were base64-encoding the JSON text and sending it to the
LLM, causing provider rejection. Now we parse the metadata, fetch the actual
file from the presigned URL, upload it to copilot storage, and persist it on
the chat message so images render inline with previews.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* added agentmail domain for mailer

* added docs for sim mailer

* fix(resource) handle resource deletion  deletion (#3568)

* Add handle dragging tab to input chat

* Add back delete tools

* Handle deletions properly with resources view

* Fix lint

* Add permisssions checking

* Skip resource_added event when resource is deleted

* Pass workflow id as context

---------

Co-authored-by: Theodore Li <theo@sim.ai>

* update docs styling, add delete confirmation on inbox

* Fix fast edit route

* updated docs styling, added FAQs, updated content

* upgrade turbo

* fix(knowledge) use consistent empty state for documents page

Replace the centered "No documents yet" text with the standard Resource
table empty state (column headers + create row), matching all other
resource pages. Move "Upload documents" from header action to table
create row as "New documents".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(notifications): polish modal styling, credential display, and trigger filters (#3571)

* fix(notifications): polish modal styling, credential display, and trigger filters

- Show credential display name instead of raw account ID in Slack account selector
- Fix label styling to use default Label component (text-primary) for consistency
- Fix modal body spacing with proper top padding after tab bar
- Replace list-card skeleton with form-field skeleton matching actual layout
- Replace custom "Select a Slack account first" box with disabled Combobox (dependsOn pattern)
- Use proper Label component in WorkflowSelector with consistent gap spacing
- Add overflow badge pattern (slice + +N) to level and trigger filter badges
- Use dynamic trigger options from getTriggerOptions() instead of hardcoded CORE_TRIGGER_TYPES
- Relax API validation to accept integration trigger types (z.string instead of z.enum)
- Deduplicate account rows from credential leftJoin in accounts API
- Extract getTriggerOptions() to module-level constants to avoid per-render calls

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(notifications): address PR review feedback

- Restore accountId in displayName fallback chain (credentialDisplayName || accountId || providerId)
- Add .default([]) to triggerFilter in create schema to preserve backward compatibility
- Treat empty triggerFilter as "match all" in notification matching logic
- Remove unreachable overflow badge for levelFilter (only 2 possible values)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(settings): add spacing to Sim Keys toggle and replace Sim Mailer icon with Send

Add 24px top margin to the "Allow personal Sim keys" toggle so it doesn't
sit right below the empty state. Replace the Mail envelope icon for Sim
Mailer with a new Send (paper plane) icon matching the emcn icon style.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* standardize back buttons in settings

* feat(restore) Add restore endpoints and ui (#3570)

* Add restore endpoints and ui

* Derive toast from notification

* Auth user if workspaceid not found

* Fix recently deleted ui

* Add restore error toast

* Fix deleted at timestamp mismatch

---------

Co-authored-by: Theodore Li <theo@sim.ai>

* fix type errors

* Lint

* improvements: ui/ux around mothership

* reactquery best practices, UI alignment in restore

* clamp logs panel

* subagent thinking text

* fix build, speedup tests by up to 40%

* Fix fast edit

* Add download file shortcut on mothership file view

* fix: SVG file support in mothership chat and file serving

- Send SVGs as document/text-xml to Claude instead of unsupported
  image/svg+xml, so the mothership can actually read SVG content
- Serve SVGs inline with proper content type and CSP sandbox so
  chat previews render correctly
- Add SVG preview support in file viewer (sandboxed iframe)
- Derive IMAGE_MIME_TYPES from MIME_TYPE_MAPPING to reduce duplication
- Add missing webp to contentTypeMap, SAFE_INLINE_TYPES, binaryExtensions
- Consolidate PREVIEWABLE_EXTENSIONS into preview-panel exports

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: replace image/* wildcard with explicit supported types in file picker

The image/* accept attribute allowed users to select BMP, TIFF, HEIC,
and other image types that are rejected server-side. Replace with the
exact set of supported image MIME types and extensions to match the
copilot upload validation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Context tags

* Fix lint

* improvement: chat and terminal

---------

Co-authored-by: Emir Karabeg <emirkarabeg@berkeley.edu>
Co-authored-by: Waleed <walif6@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Theodore Li <teddy@zenobiapay.com>
Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
Co-authored-by: Theodore Li <theodoreqili@gmail.com>
Co-authored-by: Theodore Li <theo@sim.ai>
2026-03-13 21:02:08 -07:00

5937 lines
203 KiB
JSON

{
"openapi": "3.1.0",
"info": {
"title": "Sim API",
"description": "API for executing workflows, querying logs, and managing resources in Sim.",
"version": "1.0.0",
"contact": {
"name": "Sim Support",
"email": "help@sim.ai",
"url": "https://www.sim.ai"
},
"license": {
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"servers": [
{
"url": "https://www.sim.ai",
"description": "Production"
}
],
"tags": [
{
"name": "Workflows",
"description": "Execute workflows and manage workflow resources"
},
{
"name": "Logs",
"description": "Query execution logs and retrieve details"
},
{
"name": "Usage",
"description": "Check rate limits and billing usage"
},
{
"name": "Audit Logs",
"description": "View audit trail of workspace activity"
},
{
"name": "Tables",
"description": "Manage tables and rows for structured data storage"
},
{
"name": "Files",
"description": "Upload, download, and manage workspace files"
},
{
"name": "Knowledge Bases",
"description": "Manage knowledge bases, documents, and vector search"
}
],
"security": [
{
"apiKey": []
}
],
"paths": {
"/api/workflows/{id}/execute": {
"post": {
"operationId": "executeWorkflow",
"summary": "Execute Workflow",
"description": "Execute a deployed workflow. Supports synchronous, asynchronous, and streaming modes. For async execution, the response includes a statusUrl you can poll for results.",
"tags": ["Workflows"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X POST \\\n \"https://www.sim.ai/api/workflows/{id}/execute\" \\\n -H \"X-API-Key: YOUR_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"input\": {\n \"key\": \"value\"\n }\n }'"
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "The unique identifier of the deployed workflow to execute.",
"schema": {
"type": "string",
"example": "wf_1a2b3c4d5e"
}
}
],
"requestBody": {
"description": "Execution configuration including input values and execution mode options.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"input": {
"type": "object",
"description": "Key-value pairs matching the workflow's defined input fields. Use the Get Workflow endpoint to discover available input fields.",
"additionalProperties": true
},
"triggerType": {
"type": "string",
"description": "How this execution was triggered. Defaults to api when called via the REST API. Recorded in execution logs for filtering."
},
"stream": {
"type": "boolean",
"description": "When true, returns results as Server-Sent Events (SSE) for real-time block-by-block output streaming."
},
"selectedOutputs": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of specific block IDs whose outputs to include in the response. When omitted, all block outputs are returned."
}
}
},
"example": {
"input": {
"query": "What is the weather in Tokyo?"
}
}
}
}
},
"responses": {
"200": {
"description": "Synchronous execution completed successfully.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ExecutionResult"
},
"example": {
"success": true,
"executionId": "exec_abc123",
"output": {
"content": "The weather in Tokyo is sunny, 22\u00b0C."
},
"error": null,
"metadata": {
"startTime": "2026-01-15T10:30:00Z",
"endTime": "2026-01-15T10:30:01Z",
"duration": 1250
}
}
}
}
},
"202": {
"description": "Asynchronous execution has been queued. Poll the statusUrl for results.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AsyncExecutionResult"
}
}
}
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
}
},
"/api/workflows/{id}/executions/{executionId}/cancel": {
"post": {
"operationId": "cancelExecution",
"summary": "Cancel Execution",
"description": "Cancel a running workflow execution. Only effective for executions that are still in progress.",
"tags": ["Workflows"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X POST \\\n \"https://www.sim.ai/api/workflows/{id}/executions/{executionId}/cancel\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "The unique identifier of the workflow.",
"schema": {
"type": "string",
"example": "wf_1a2b3c4d5e"
}
},
{
"name": "executionId",
"in": "path",
"required": true,
"description": "The unique identifier of the execution to cancel.",
"schema": {
"type": "string",
"example": "exec_9f8e7d6c5b"
}
}
],
"responses": {
"200": {
"description": "Execution was successfully cancelled.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Whether the cancellation was successful."
},
"executionId": {
"type": "string",
"description": "The ID of the cancelled execution."
}
}
},
"example": {
"success": true,
"executionId": "exec_abc123"
}
}
}
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
}
}
},
"/api/v1/workflows": {
"get": {
"operationId": "listWorkflows",
"summary": "List Workflows",
"description": "Retrieve all workflows in a workspace with cursor-based pagination.",
"tags": ["Workflows"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X GET \\\n \"https://www.sim.ai/api/v1/workflows?workspaceId=YOUR_WORKSPACE_ID\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"$ref": "#/components/parameters/WorkspaceId"
},
{
"name": "folderId",
"in": "query",
"description": "Filter results to only include workflows within this folder.",
"schema": {
"type": "string"
}
},
{
"name": "deployedOnly",
"in": "query",
"description": "When true, only return workflows that have been deployed. Useful for listing workflows available for API execution.",
"schema": {
"type": "boolean"
}
},
{
"name": "limit",
"in": "query",
"description": "Maximum number of workflows to return per page. Must be between 1 and 100.",
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 100
}
},
{
"name": "cursor",
"in": "query",
"description": "Pagination cursor returned from a previous request's nextCursor field. Omit for the first page.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "A paginated list of workflows.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "array",
"description": "Array of workflow summary objects for the current page.",
"items": {
"$ref": "#/components/schemas/WorkflowSummary"
}
},
"nextCursor": {
"type": "string",
"nullable": true,
"description": "Cursor for fetching the next page of results. null when there are no more results."
},
"limits": {
"$ref": "#/components/schemas/Limits",
"description": "Rate limit and usage information for the current API key."
}
}
},
"example": {
"data": [
{
"id": "wf_abc123",
"name": "Weather Bot",
"isDeployed": true,
"createdAt": "2026-01-15T10:30:00Z",
"updatedAt": "2026-01-15T10:30:00Z"
}
],
"nextCursor": null
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
}
},
"/api/v1/workflows/{id}": {
"get": {
"operationId": "getWorkflow",
"summary": "Get Workflow",
"description": "Retrieve details for a single workflow, including its input fields and deployment status.",
"tags": ["Workflows"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X GET \\\n \"https://www.sim.ai/api/v1/workflows/{id}\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "The unique workflow identifier.",
"schema": {
"type": "string",
"example": "wf_1a2b3c4d5e"
}
}
],
"responses": {
"200": {
"description": "Workflow details including input field definitions.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"description": "The full workflow detail object.",
"$ref": "#/components/schemas/WorkflowDetail"
},
"limits": {
"$ref": "#/components/schemas/Limits",
"description": "Rate limit and usage information for the current API key."
}
}
},
"example": {
"data": {
"id": "wf_abc123",
"name": "Weather Bot",
"description": "A workflow that fetches weather data",
"isDeployed": true,
"createdAt": "2026-01-15T10:30:00Z",
"updatedAt": "2026-01-15T10:30:00Z"
}
}
}
}
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
}
},
"/api/jobs/{jobId}": {
"get": {
"operationId": "getJobStatus",
"summary": "Get Job Status",
"description": "Poll the status of an asynchronous workflow execution. Use the jobId returned from the Execute Workflow endpoint when the execution is queued asynchronously.",
"tags": ["Workflows"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X GET \\\n \"https://www.sim.ai/api/jobs/{jobId}\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"name": "jobId",
"in": "path",
"required": true,
"description": "The job identifier returned in the async execution response.",
"schema": {
"type": "string",
"example": "job_4a3b2c1d0e"
}
}
],
"responses": {
"200": {
"description": "Current status of the job. When completed, includes the execution output.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/JobStatus"
},
"example": {
"success": true,
"taskId": "job_abc123",
"status": "completed",
"output": {
"content": "Done"
},
"metadata": {
"startTime": "2026-01-15T10:30:00Z"
}
}
}
}
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
}
}
},
"/api/v1/logs": {
"get": {
"operationId": "queryLogs",
"summary": "Query Logs",
"description": "List workflow execution logs with advanced filtering and cursor-based pagination. Supports filtering by workflow, trigger type, date range, duration, cost, and more.",
"tags": ["Logs"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X GET \\\n \"https://www.sim.ai/api/v1/logs?workspaceId=YOUR_WORKSPACE_ID\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"$ref": "#/components/parameters/WorkspaceId"
},
{
"name": "workflowIds",
"in": "query",
"description": "Comma-separated list of workflow IDs to filter by. Only logs from these workflows will be returned.",
"schema": {
"type": "string"
}
},
{
"name": "folderIds",
"in": "query",
"description": "Comma-separated list of folder IDs. Returns logs for all workflows within these folders.",
"schema": {
"type": "string"
}
},
{
"name": "triggers",
"in": "query",
"description": "Comma-separated trigger types to filter by: api, webhook, schedule, manual, chat.",
"schema": {
"type": "string"
}
},
{
"name": "level",
"in": "query",
"description": "Filter logs by severity level. info for successful executions, error for failed ones.",
"schema": {
"type": "string"
}
},
{
"name": "startDate",
"in": "query",
"description": "Only return logs after this ISO 8601 timestamp (inclusive).",
"schema": {
"type": "string",
"format": "date-time"
}
},
{
"name": "endDate",
"in": "query",
"description": "Only return logs before this ISO 8601 timestamp (inclusive).",
"schema": {
"type": "string",
"format": "date-time"
}
},
{
"name": "executionId",
"in": "query",
"description": "Filter by an exact execution ID. Useful for looking up a specific run.",
"schema": {
"type": "string"
}
},
{
"name": "minDurationMs",
"in": "query",
"description": "Only return logs where execution took at least this many milliseconds.",
"schema": {
"type": "integer"
}
},
{
"name": "maxDurationMs",
"in": "query",
"description": "Only return logs where execution took at most this many milliseconds.",
"schema": {
"type": "integer"
}
},
{
"name": "minCost",
"in": "query",
"description": "Only return logs where execution cost at least this amount in USD.",
"schema": {
"type": "number"
}
},
{
"name": "maxCost",
"in": "query",
"description": "Only return logs where execution cost at most this amount in USD.",
"schema": {
"type": "number"
}
},
{
"name": "model",
"in": "query",
"description": "Filter by the AI model used during execution (e.g., gpt-4o, claude-sonnet-4-20250514).",
"schema": {
"type": "string"
}
},
{
"name": "details",
"in": "query",
"description": "Response detail level. basic returns summary fields only. full includes execution data, trace spans, and outputs.",
"schema": {
"type": "string"
}
},
{
"name": "includeTraceSpans",
"in": "query",
"description": "When true, includes block-level execution trace spans with timing and input/output data.",
"schema": {
"type": "boolean"
}
},
{
"name": "includeFinalOutput",
"in": "query",
"description": "When true, includes the workflow's final output in each log entry.",
"schema": {
"type": "boolean"
}
},
{
"name": "limit",
"in": "query",
"description": "Maximum number of log entries to return per page.",
"schema": {
"type": "integer"
}
},
{
"name": "cursor",
"in": "query",
"description": "Pagination cursor returned from a previous request's nextCursor field.",
"schema": {
"type": "string"
}
},
{
"name": "order",
"in": "query",
"description": "Sort order by execution start time. desc returns newest first.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "A paginated list of execution logs matching the filter criteria.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "array",
"description": "Array of log entries for the current page.",
"items": {
"$ref": "#/components/schemas/LogEntry"
}
},
"nextCursor": {
"type": "string",
"nullable": true,
"description": "Cursor for fetching the next page. null when there are no more results."
},
"limits": {
"$ref": "#/components/schemas/Limits"
}
}
},
"example": {
"data": [
{
"id": "log_abc123",
"workflowId": "wf_abc123",
"level": "info",
"trigger": "api",
"createdAt": "2026-01-15T10:30:00Z"
}
],
"nextCursor": null
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
}
},
"/api/v1/logs/{id}": {
"get": {
"operationId": "getLogDetails",
"summary": "Get Log Details",
"description": "Retrieve detailed information about a specific log entry, including workflow metadata, execution data, and cost breakdown.",
"tags": ["Logs"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X GET \\\n \"https://www.sim.ai/api/v1/logs/{id}\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "The unique identifier of the log entry.",
"schema": {
"type": "string",
"example": "log_7x8y9z0a1b"
}
}
],
"responses": {
"200": {
"description": "Detailed log entry with full execution data and cost breakdown.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"description": "The full log detail object.",
"$ref": "#/components/schemas/LogDetail"
},
"limits": {
"$ref": "#/components/schemas/Limits"
}
}
},
"example": {
"data": {
"id": "log_abc123",
"workflowId": "wf_abc123",
"executionId": "exec_abc123",
"level": "info",
"trigger": "api",
"totalDurationMs": 1250,
"startedAt": "2026-01-15T10:30:00Z",
"endedAt": "2026-01-15T10:30:01Z",
"createdAt": "2026-01-15T10:30:00Z"
}
}
}
}
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
}
},
"/api/v1/logs/executions/{executionId}": {
"get": {
"operationId": "getExecutionDetails",
"summary": "Get Execution Details",
"description": "Retrieve the full execution state snapshot, including the workflow state at time of execution and detailed metadata.",
"tags": ["Logs"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X GET \\\n \"https://www.sim.ai/api/v1/logs/executions/{executionId}\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"name": "executionId",
"in": "path",
"required": true,
"description": "The unique execution identifier.",
"schema": {
"type": "string",
"example": "exec_9f8e7d6c5b"
}
}
],
"responses": {
"200": {
"description": "Full execution state snapshot with workflow state and metadata.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"executionId": {
"type": "string",
"description": "The unique identifier for this execution."
},
"workflowId": {
"type": "string",
"description": "The workflow that was executed."
},
"workflowState": {
"type": "object",
"description": "Snapshot of the workflow configuration at the time of execution.",
"properties": {
"blocks": {
"type": "object",
"description": "Map of block IDs to their configuration and state during execution."
},
"edges": {
"type": "array",
"description": "List of connections between blocks defining the execution flow.",
"items": {
"type": "object"
}
},
"loops": {
"type": "object",
"description": "Loop configurations defining iterative execution patterns."
},
"parallels": {
"type": "object",
"description": "Parallel execution group configurations."
}
}
},
"executionMetadata": {
"type": "object",
"description": "Metadata about the execution including timing and cost information.",
"properties": {
"trigger": {
"type": "string",
"description": "How the execution was triggered (e.g., api, manual, schedule)."
},
"startedAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when execution started."
},
"endedAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when execution completed."
},
"totalDurationMs": {
"type": "integer",
"description": "Total execution duration in milliseconds."
},
"cost": {
"type": "object",
"description": "Cost breakdown for this execution including per-model details."
}
}
},
"limits": {
"$ref": "#/components/schemas/Limits"
}
}
},
"example": {
"executionId": "exec_abc123",
"workflowId": "wf_abc123",
"workflowState": {},
"executionMetadata": {}
}
}
}
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
}
},
"/api/v1/audit-logs": {
"get": {
"operationId": "listAuditLogs",
"summary": "List Audit Logs",
"description": "Retrieve audit logs for your organization with cursor-based pagination. Requires an Enterprise subscription and organization admin or owner role.",
"tags": ["Audit Logs"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X GET \\\n \"https://www.sim.ai/api/v1/audit-logs?workspaceId=YOUR_WORKSPACE_ID\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"name": "action",
"in": "query",
"description": "Filter by action type (e.g., workflow.created, workflow.deployed, member.invited).",
"schema": {
"type": "string"
}
},
{
"name": "resourceType",
"in": "query",
"description": "Filter by resource type (e.g., workflow, workspace, member).",
"schema": {
"type": "string"
}
},
{
"name": "resourceId",
"in": "query",
"description": "Filter by a specific resource ID.",
"schema": {
"type": "string"
}
},
{
"$ref": "#/components/parameters/WorkspaceId"
},
{
"name": "actorId",
"in": "query",
"description": "Filter by the user who performed the action. Must be a member of your organization.",
"schema": {
"type": "string"
}
},
{
"name": "startDate",
"in": "query",
"description": "Only return logs after this ISO 8601 timestamp (inclusive).",
"schema": {
"type": "string",
"format": "date-time"
}
},
{
"name": "endDate",
"in": "query",
"description": "Only return logs before this ISO 8601 timestamp (inclusive).",
"schema": {
"type": "string",
"format": "date-time"
}
},
{
"name": "includeDeparted",
"in": "query",
"description": "When true, includes audit logs from users who have left the organization.",
"schema": {
"type": "boolean"
}
},
{
"name": "limit",
"in": "query",
"description": "Maximum number of audit log entries to return per page. Must be between 1 and 100.",
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 100
}
},
{
"name": "cursor",
"in": "query",
"description": "Pagination cursor returned from a previous request's nextCursor field.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "A paginated list of audit log entries.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"type": "array",
"description": "Array of audit log entries for the current page.",
"items": {
"$ref": "#/components/schemas/AuditLogEntry"
}
},
"nextCursor": {
"type": "string",
"nullable": true,
"description": "Cursor for fetching the next page. null when there are no more results."
},
"limits": {
"$ref": "#/components/schemas/Limits"
}
}
},
"example": {
"data": [
{
"id": "audit_abc123",
"action": "workflow.execute",
"actorId": "user_abc123",
"actorName": "Jane Doe",
"actorEmail": "jane@example.com",
"resourceType": "workflow",
"createdAt": "2026-01-15T10:30:00Z"
}
],
"nextCursor": null
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
}
},
"/api/v1/audit-logs/{id}": {
"get": {
"operationId": "getAuditLogDetails",
"summary": "Get Audit Log Details",
"description": "Retrieve a single audit log entry by ID. Requires an Enterprise subscription and organization admin or owner role.",
"tags": ["Audit Logs"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X GET \\\n \"https://www.sim.ai/api/v1/audit-logs/{id}\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "The unique audit log entry identifier.",
"schema": {
"type": "string",
"example": "audit_2c3d4e5f6g"
}
}
],
"responses": {
"200": {
"description": "The audit log entry.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"description": "The audit log entry.",
"$ref": "#/components/schemas/AuditLogEntry"
},
"limits": {
"$ref": "#/components/schemas/Limits"
}
}
},
"example": {
"data": {
"id": "audit_abc123",
"action": "workflow.execute",
"actorId": "user_abc123",
"actorName": "Jane Doe",
"actorEmail": "jane@example.com",
"resourceType": "workflow",
"resourceId": "wf_abc123",
"metadata": {},
"createdAt": "2026-01-15T10:30:00Z"
}
}
}
}
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
}
},
"/api/users/me/usage-limits": {
"get": {
"operationId": "getUsageLimits",
"summary": "Get Usage Limits",
"description": "Retrieve your current rate limits, usage spending, and storage consumption for the billing period.",
"tags": ["Usage"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X GET \\\n \"https://www.sim.ai/api/users/me/usage-limits\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"responses": {
"200": {
"description": "Current rate limits, usage, and storage information.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UsageLimits"
},
"example": {
"success": true,
"rateLimit": {
"sync": {
"limit": 100,
"remaining": 95,
"reset": "2026-01-15T11:00:00Z"
},
"async": {
"limit": 50,
"remaining": 48,
"reset": "2026-01-15T11:00:00Z"
}
},
"usage": {
"currentPeriodCost": 12.5,
"limit": 100.0,
"plan": "pro"
},
"storage": {
"usedBytes": 5242880,
"limitBytes": 1073741824,
"percentUsed": 0.49
}
}
}
}
},
"401": {
"$ref": "#/components/responses/Unauthorized"
}
},
"parameters": []
}
},
"/api/v1/tables": {
"get": {
"operationId": "listTables",
"summary": "List Tables",
"description": "List all tables in a workspace. Returns table metadata including name, schema, and row counts.",
"tags": ["Tables"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X GET \\\n \"https://www.sim.ai/api/v1/tables?workspaceId=YOUR_WORKSPACE_ID\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"$ref": "#/components/parameters/WorkspaceId"
}
],
"responses": {
"200": {
"description": "List of tables in the workspace.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Indicates whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"tables": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Table"
},
"description": "Array of tables in the workspace."
},
"totalCount": {
"type": "integer",
"description": "Total number of tables."
}
},
"description": "Response payload."
}
}
},
"example": {
"success": true,
"data": {
"tables": [
{
"id": "tbl_abc123",
"name": "contacts",
"description": "Customer contacts",
"schema": {
"columns": [
{
"name": "email",
"type": "string",
"required": true,
"unique": true
}
]
},
"rowCount": 150,
"maxRows": 10000,
"createdAt": "2026-01-15T10:30:00Z",
"updatedAt": "2026-01-15T10:30:00Z"
}
],
"totalCount": 1
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
},
"post": {
"operationId": "createTable",
"summary": "Create Table",
"description": "Create a new table in a workspace. Define the table schema with typed columns, optional constraints (required, unique), and a name.",
"tags": ["Tables"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X POST \\\n \"https://www.sim.ai/api/v1/tables\" \\\n -H \"X-API-Key: YOUR_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"workspaceId\": \"YOUR_WORKSPACE_ID\",\n \"name\": \"contacts\",\n \"description\": \"Customer contacts\",\n \"schema\": {\n \"columns\": [\n { \"name\": \"email\", \"type\": \"string\", \"required\": true, \"unique\": true },\n { \"name\": \"name\", \"type\": \"string\", \"required\": true },\n { \"name\": \"age\", \"type\": \"number\" }\n ]\n }\n }'"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["workspaceId", "name", "schema"],
"properties": {
"workspaceId": {
"type": "string",
"description": "The workspace to create the table in."
},
"name": {
"type": "string",
"description": "Table name. Must start with a letter or underscore, alphanumeric and underscores only.",
"pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$"
},
"description": {
"type": "string",
"description": "Optional description of the table."
},
"schema": {
"type": "object",
"required": ["columns"],
"properties": {
"columns": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ColumnDefinition"
},
"minItems": 1,
"description": "Column definitions for the table."
}
},
"description": "Table schema definition containing column definitions."
}
}
},
"example": {
"workspaceId": "wsp_abc123",
"name": "contacts",
"description": "Customer contacts",
"schema": {
"columns": [
{
"name": "email",
"type": "string",
"required": true,
"unique": true
},
{
"name": "name",
"type": "string",
"required": true
},
{
"name": "age",
"type": "number"
}
]
}
}
}
}
},
"responses": {
"200": {
"description": "Table created successfully.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Indicates whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"table": {
"$ref": "#/components/schemas/Table",
"description": "The newly created table."
},
"message": {
"type": "string",
"description": "Confirmation message."
}
},
"description": "Response payload."
}
}
},
"example": {
"success": true,
"data": {
"table": {
"id": "tbl_abc123",
"name": "contacts",
"description": "Customer contacts",
"schema": {
"columns": [
{
"name": "email",
"type": "string",
"required": true,
"unique": true
}
]
},
"rowCount": 0,
"maxRows": 10000,
"createdAt": "2026-01-15T10:30:00Z",
"updatedAt": "2026-01-15T10:30:00Z"
},
"message": "Table created successfully"
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
},
"parameters": []
}
},
"/api/v1/tables/{tableId}": {
"get": {
"operationId": "getTable",
"summary": "Get Table",
"description": "Retrieve a table's metadata, schema, and row count.",
"tags": ["Tables"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X GET \\\n \"https://www.sim.ai/api/v1/tables/{tableId}?workspaceId=YOUR_WORKSPACE_ID\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"$ref": "#/components/parameters/TableId"
},
{
"$ref": "#/components/parameters/WorkspaceId"
}
],
"responses": {
"200": {
"description": "Table details.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Indicates whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"table": {
"$ref": "#/components/schemas/Table",
"description": "The requested table with its metadata and schema."
}
},
"description": "Response payload."
}
}
},
"example": {
"success": true,
"data": {
"table": {
"id": "tbl_abc123",
"name": "contacts",
"description": "Customer contacts",
"schema": {
"columns": [
{
"name": "email",
"type": "string",
"required": true,
"unique": true
}
]
},
"rowCount": 150,
"maxRows": 10000,
"createdAt": "2026-01-15T10:30:00Z",
"updatedAt": "2026-01-15T10:30:00Z"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
},
"delete": {
"operationId": "deleteTable",
"summary": "Delete Table",
"description": "Delete a table and all its rows. This action is irreversible.",
"tags": ["Tables"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X DELETE \\\n \"https://www.sim.ai/api/v1/tables/{tableId}?workspaceId=YOUR_WORKSPACE_ID\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"$ref": "#/components/parameters/TableId"
},
{
"$ref": "#/components/parameters/WorkspaceId"
}
],
"responses": {
"200": {
"description": "Table deleted successfully.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Indicates whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "Confirmation message."
}
},
"description": "Response payload."
}
}
},
"example": {
"success": true,
"data": {
"message": "Table deleted successfully"
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
}
},
"/api/v1/tables/{tableId}/columns": {
"post": {
"operationId": "addColumn",
"summary": "Add Column",
"description": "Add a new column to the table schema. Optionally specify a position to insert the column at a specific index.",
"tags": ["Tables"],
"x-codeSamples": [
{
"lang": "curl",
"source": "curl -X POST \\\n \"https://www.sim.ai/api/v1/tables/{tableId}/columns\" \\\n -H \"X-API-Key: YOUR_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"workspaceId\": \"YOUR_WORKSPACE_ID\",\n \"column\": {\n \"name\": \"email\",\n \"type\": \"string\",\n \"required\": true,\n \"unique\": true\n }\n }'"
}
],
"parameters": [
{
"$ref": "#/components/parameters/TableId"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["workspaceId", "column"],
"properties": {
"workspaceId": {
"type": "string",
"description": "The workspace ID"
},
"column": {
"type": "object",
"required": ["name", "type"],
"properties": {
"name": {
"type": "string",
"description": "Column name (alphanumeric and underscores, must start with letter or underscore)"
},
"type": {
"type": "string",
"enum": ["string", "number", "boolean", "date", "json"],
"description": "Column data type"
},
"required": {
"type": "boolean",
"description": "Whether the column requires a value"
},
"unique": {
"type": "boolean",
"description": "Whether column values must be unique"
},
"position": {
"type": "integer",
"minimum": 0,
"description": "Position index to insert the column at (0-based). Appends if omitted."
}
}
}
}
},
"example": {
"workspaceId": "wsp_abc123",
"column": {
"name": "phone",
"type": "string",
"required": false,
"unique": false
}
}
}
}
},
"responses": {
"200": {
"description": "Column added successfully",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"data": {
"type": "object",
"properties": {
"columns": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ColumnDefinition"
}
}
}
}
}
},
"example": {
"success": true,
"data": {
"columns": [
{
"name": "email",
"type": "string",
"required": true,
"unique": true
},
{
"name": "phone",
"type": "string",
"required": false,
"unique": false
}
]
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
},
"patch": {
"operationId": "updateColumn",
"summary": "Update Column",
"description": "Update a column's name, type, or constraints. Multiple updates can be applied in a single request. When renaming, subsequent updates (type, constraints) use the new name.",
"tags": ["Tables"],
"x-codeSamples": [
{
"lang": "curl",
"source": "curl -X PATCH \\\n \"https://www.sim.ai/api/v1/tables/{tableId}/columns\" \\\n -H \"X-API-Key: YOUR_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"workspaceId\": \"YOUR_WORKSPACE_ID\",\n \"columnName\": \"old_name\",\n \"updates\": {\n \"name\": \"new_name\",\n \"type\": \"number\"\n }\n }'"
}
],
"parameters": [
{
"$ref": "#/components/parameters/TableId"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["workspaceId", "columnName", "updates"],
"properties": {
"workspaceId": {
"type": "string",
"description": "The workspace ID"
},
"columnName": {
"type": "string",
"description": "Current name of the column to update"
},
"updates": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "New column name"
},
"type": {
"type": "string",
"enum": ["string", "number", "boolean", "date", "json"],
"description": "New column data type"
},
"required": {
"type": "boolean",
"description": "Whether the column requires a value"
},
"unique": {
"type": "boolean",
"description": "Whether column values must be unique"
}
}
}
}
},
"example": {
"workspaceId": "wsp_abc123",
"columnName": "phone",
"updates": {
"name": "phone_number",
"type": "string",
"required": true
}
}
}
}
},
"responses": {
"200": {
"description": "Column updated successfully",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"data": {
"type": "object",
"properties": {
"columns": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ColumnDefinition"
}
}
}
}
}
},
"example": {
"success": true,
"data": {
"columns": [
{
"name": "email",
"type": "string",
"required": true,
"unique": true
},
{
"name": "phone_number",
"type": "string",
"required": true,
"unique": false
}
]
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
},
"delete": {
"operationId": "deleteColumn",
"summary": "Delete Column",
"description": "Delete a column from the table schema. This removes the column definition and strips the corresponding key from all existing row data. Cannot delete the last remaining column.",
"tags": ["Tables"],
"x-codeSamples": [
{
"lang": "curl",
"source": "curl -X DELETE \\\n \"https://www.sim.ai/api/v1/tables/{tableId}/columns\" \\\n -H \"X-API-Key: YOUR_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"workspaceId\": \"YOUR_WORKSPACE_ID\",\n \"columnName\": \"old_column\"\n }'"
}
],
"parameters": [
{
"$ref": "#/components/parameters/TableId"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["workspaceId", "columnName"],
"properties": {
"workspaceId": {
"type": "string",
"description": "The workspace ID"
},
"columnName": {
"type": "string",
"description": "Name of the column to delete"
}
}
},
"example": {
"workspaceId": "wsp_abc123",
"columnName": "phone_number"
}
}
}
},
"responses": {
"200": {
"description": "Column deleted successfully",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"data": {
"type": "object",
"properties": {
"columns": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ColumnDefinition"
}
}
}
}
}
},
"example": {
"success": true,
"data": {
"columns": [
{
"name": "email",
"type": "string",
"required": true,
"unique": true
}
]
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
}
},
"/api/v1/tables/{tableId}/rows": {
"get": {
"operationId": "listRows",
"summary": "List Rows",
"description": "Query rows from a table with optional filtering, sorting, and pagination. Filters and sorts are passed as JSON-encoded query parameters.",
"tags": ["Tables"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X GET \\\n \"https://www.sim.ai/api/v1/tables/{tableId}/rows?workspaceId=YOUR_WORKSPACE_ID&limit=50&offset=0\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"$ref": "#/components/parameters/TableId"
},
{
"$ref": "#/components/parameters/WorkspaceId"
},
{
"name": "filter",
"in": "query",
"required": false,
"description": "JSON-encoded filter object. Example: {\"status\": \"active\"} or {\"age\": {\"$gt\": 18}}.",
"schema": {
"type": "string"
}
},
{
"name": "sort",
"in": "query",
"required": false,
"description": "JSON-encoded sort object. Example: {\"created_at\": \"desc\"}.",
"schema": {
"type": "string"
}
},
{
"name": "limit",
"in": "query",
"required": false,
"description": "Maximum rows to return (1-1000, default 100).",
"schema": {
"type": "integer",
"default": 100,
"minimum": 1,
"maximum": 1000
}
},
{
"name": "offset",
"in": "query",
"required": false,
"description": "Number of rows to skip for pagination (default 0).",
"schema": {
"type": "integer",
"default": 0,
"minimum": 0
}
}
],
"responses": {
"200": {
"description": "Rows matching the query.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Indicates whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"rows": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TableRow"
},
"description": "Array of rows matching the query."
},
"rowCount": {
"type": "integer",
"description": "Number of rows returned in this response."
},
"totalCount": {
"type": "integer",
"description": "Total rows matching the filter."
},
"limit": {
"type": "integer",
"description": "The limit that was applied to the query."
},
"offset": {
"type": "integer",
"description": "The offset that was applied to the query."
}
},
"description": "Response payload."
}
}
},
"example": {
"success": true,
"data": {
"rows": [
{
"id": "row_abc123",
"data": {
"email": "jane@example.com",
"name": "Jane Doe"
},
"position": 0,
"createdAt": "2026-01-15T10:30:00Z",
"updatedAt": "2026-01-15T10:30:00Z"
}
],
"rowCount": 1,
"totalCount": 1,
"limit": 100,
"offset": 0
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
},
"post": {
"operationId": "insertRows",
"summary": "Insert Rows",
"description": "Insert one or more rows into a table. For a single row, pass a `data` object. For batch insert, pass a `rows` array (up to 1000 rows).",
"tags": ["Tables"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X POST \\\n \"https://www.sim.ai/api/v1/tables/{tableId}/rows\" \\\n -H \"X-API-Key: YOUR_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"workspaceId\": \"YOUR_WORKSPACE_ID\",\n \"data\": {\n \"email\": \"user@example.com\",\n \"name\": \"Jane Doe\"\n }\n }'"
}
],
"parameters": [
{
"$ref": "#/components/parameters/TableId"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": ["workspaceId", "data"],
"description": "Single row insert.",
"properties": {
"workspaceId": {
"type": "string",
"description": "The workspace that owns the table."
},
"data": {
"type": "object",
"additionalProperties": true,
"description": "Key-value pairs matching the table schema."
},
"position": {
"type": "integer",
"minimum": 0,
"description": "Position index for the row. If omitted, the row is appended at the end of the table."
}
}
},
{
"type": "object",
"required": ["workspaceId", "rows"],
"description": "Batch insert (up to 1000 rows).",
"properties": {
"workspaceId": {
"type": "string",
"description": "The workspace that owns the table."
},
"rows": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
},
"minItems": 1,
"maxItems": 1000,
"description": "Array of row objects to insert. Each object contains key-value pairs matching the table schema."
},
"positions": {
"type": "array",
"items": {
"type": "integer",
"minimum": 0
},
"uniqueItems": true,
"maxItems": 1000,
"description": "Array of position indices for each row. Must be the same length as the rows array and must not contain duplicates. If omitted, rows are appended in order."
}
}
}
]
},
"example": {
"workspaceId": "wsp_abc123",
"data": {
"email": "jane@example.com",
"name": "Jane Doe",
"age": 30
}
}
}
}
},
"responses": {
"200": {
"description": "Row(s) inserted successfully.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Indicates whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"row": {
"$ref": "#/components/schemas/TableRow",
"description": "The inserted row (present for single-row inserts)."
},
"rows": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TableRow"
},
"description": "Array of inserted rows (present for batch inserts)."
},
"insertedCount": {
"type": "integer",
"description": "Number of rows successfully inserted."
},
"message": {
"type": "string",
"description": "Confirmation message."
}
},
"description": "Response payload."
}
}
},
"example": {
"success": true,
"data": {
"row": {
"id": "row_abc123",
"data": {
"email": "jane@example.com",
"name": "Jane Doe",
"age": 30
},
"position": 0,
"createdAt": "2026-01-15T10:30:00Z",
"updatedAt": "2026-01-15T10:30:00Z"
},
"message": "Row inserted successfully"
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
},
"put": {
"operationId": "updateRows",
"summary": "Update Rows",
"description": "Bulk update rows matching a filter. All matching rows will have the specified fields updated. Validates against schema and unique constraints.",
"tags": ["Tables"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X PUT \\\n \"https://www.sim.ai/api/v1/tables/{tableId}/rows\" \\\n -H \"X-API-Key: YOUR_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"workspaceId\": \"YOUR_WORKSPACE_ID\",\n \"filter\": { \"status\": \"pending\" },\n \"data\": { \"status\": \"active\" }\n }'"
}
],
"parameters": [
{
"$ref": "#/components/parameters/TableId"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["workspaceId", "filter", "data"],
"properties": {
"workspaceId": {
"type": "string",
"description": "The workspace that owns the table."
},
"filter": {
"type": "object",
"additionalProperties": true,
"description": "Filter criteria to match rows."
},
"data": {
"type": "object",
"additionalProperties": true,
"description": "Fields to update on matching rows."
},
"limit": {
"type": "integer",
"minimum": 1,
"maximum": 1000,
"description": "Maximum number of rows to update."
}
}
},
"example": {
"workspaceId": "wsp_abc123",
"filter": {
"status": "pending"
},
"data": {
"status": "active"
}
}
}
}
},
"responses": {
"200": {
"$ref": "#/components/responses/RowsUpdated"
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
},
"delete": {
"operationId": "deleteRows",
"summary": "Delete Rows",
"description": "Delete rows by filter criteria or by an explicit list of row IDs. Pass either a `filter` object or a `rowIds` array.",
"tags": ["Tables"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X DELETE \\\n \"https://www.sim.ai/api/v1/tables/{tableId}/rows\" \\\n -H \"X-API-Key: YOUR_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"workspaceId\": \"YOUR_WORKSPACE_ID\",\n \"rowIds\": [\"row_abc123\", \"row_def456\"]\n }'"
}
],
"parameters": [
{
"$ref": "#/components/parameters/TableId"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"required": ["workspaceId", "filter"],
"description": "Delete by filter.",
"properties": {
"workspaceId": {
"type": "string",
"description": "The workspace that owns the table."
},
"filter": {
"type": "object",
"additionalProperties": true,
"description": "Filter criteria to match rows for deletion."
},
"limit": {
"type": "integer",
"minimum": 1,
"maximum": 1000,
"description": "Maximum number of rows to delete. Defaults to all matching rows, capped at 1000."
}
}
},
{
"type": "object",
"required": ["workspaceId", "rowIds"],
"description": "Delete by IDs.",
"properties": {
"workspaceId": {
"type": "string",
"description": "The workspace that owns the table."
},
"rowIds": {
"type": "array",
"items": {
"type": "string"
},
"maxItems": 1000,
"description": "Explicit list of row IDs to delete (max 1000)."
}
}
}
]
},
"example": {
"workspaceId": "wsp_abc123",
"rowIds": ["row_abc123", "row_def456"]
}
}
}
},
"responses": {
"200": {
"description": "Rows deleted.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Indicates whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "Confirmation message describing how many rows were deleted."
},
"deletedCount": {
"type": "integer",
"description": "Number of rows that were deleted."
},
"deletedRowIds": {
"type": "array",
"items": {
"type": "string"
},
"description": "Array of IDs for each row that was deleted."
},
"requestedCount": {
"type": "integer",
"description": "Number of row IDs requested for deletion (only present when deleting by IDs)."
},
"missingRowIds": {
"type": "array",
"items": {
"type": "string"
},
"description": "Row IDs that were requested but not found (only present when deleting by IDs)."
}
},
"description": "Response payload."
}
}
},
"example": {
"success": true,
"data": {
"message": "Rows deleted successfully",
"deletedCount": 2,
"deletedRowIds": ["row_abc123", "row_def456"]
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
},
"patch": {
"operationId": "batchUpdateRows",
"summary": "Batch Update Rows",
"description": "Update multiple specific rows by their IDs in a single request. Each entry in the `updates` array specifies a row ID and the fields to update. Validates against the table schema and unique constraints. Up to 1000 rows can be updated per request.",
"tags": ["Tables"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X PATCH \\\n \"https://www.sim.ai/api/v1/tables/{tableId}/rows\" \\\n -H \"X-API-Key: YOUR_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"workspaceId\": \"YOUR_WORKSPACE_ID\",\n \"updates\": [\n { \"rowId\": \"row_abc123\", \"data\": { \"status\": \"active\" } },\n { \"rowId\": \"row_def456\", \"data\": { \"status\": \"archived\" } }\n ]\n }'"
}
],
"parameters": [
{
"$ref": "#/components/parameters/TableId"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["workspaceId", "updates"],
"properties": {
"workspaceId": {
"type": "string",
"description": "The workspace that owns the table."
},
"updates": {
"type": "array",
"items": {
"type": "object",
"required": ["rowId", "data"],
"properties": {
"rowId": {
"type": "string",
"description": "The ID of the row to update."
},
"data": {
"type": "object",
"additionalProperties": true,
"description": "Key-value pairs of fields to update on this row."
}
}
},
"minItems": 1,
"maxItems": 1000,
"description": "Array of update objects. Each object specifies a row ID and the fields to update. Duplicate row IDs are not allowed."
}
}
},
"example": {
"workspaceId": "wsp_abc123",
"updates": [
{
"rowId": "row_abc123",
"data": {
"status": "active"
}
},
{
"rowId": "row_def456",
"data": {
"status": "archived"
}
}
]
}
}
}
},
"responses": {
"200": {
"$ref": "#/components/responses/RowsUpdated"
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
}
},
"/api/v1/tables/{tableId}/rows/{rowId}": {
"get": {
"operationId": "getRow",
"summary": "Get Row",
"description": "Retrieve a single row by its ID.",
"tags": ["Tables"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X GET \\\n \"https://www.sim.ai/api/v1/tables/{tableId}/rows/{rowId}?workspaceId=YOUR_WORKSPACE_ID\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"$ref": "#/components/parameters/TableId"
},
{
"$ref": "#/components/parameters/RowId"
},
{
"$ref": "#/components/parameters/WorkspaceId"
}
],
"responses": {
"200": {
"description": "Row data.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Indicates whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"row": {
"$ref": "#/components/schemas/TableRow",
"description": "The requested row."
}
},
"description": "Response payload."
}
}
},
"example": {
"success": true,
"data": {
"row": {
"id": "row_abc123",
"data": {
"email": "jane@example.com",
"name": "Jane Doe"
},
"position": 0,
"createdAt": "2026-01-15T10:30:00Z",
"updatedAt": "2026-01-15T10:30:00Z"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
},
"patch": {
"operationId": "updateRow",
"summary": "Update Row",
"description": "Partially update a single row. Only the provided fields are updated; existing fields are preserved. Data is validated against the table schema.",
"tags": ["Tables"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X PATCH \\\n \"https://www.sim.ai/api/v1/tables/{tableId}/rows/{rowId}\" \\\n -H \"X-API-Key: YOUR_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"workspaceId\": \"YOUR_WORKSPACE_ID\",\n \"data\": { \"name\": \"Updated Name\" }\n }'"
}
],
"parameters": [
{
"$ref": "#/components/parameters/TableId"
},
{
"$ref": "#/components/parameters/RowId"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["workspaceId", "data"],
"properties": {
"workspaceId": {
"type": "string",
"description": "The workspace that owns the table."
},
"data": {
"type": "object",
"additionalProperties": true,
"description": "Fields to update. Only specified fields are changed."
}
}
},
"example": {
"workspaceId": "wsp_abc123",
"data": {
"name": "Updated Name"
}
}
}
}
},
"responses": {
"200": {
"description": "Row updated.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Indicates whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"row": {
"$ref": "#/components/schemas/TableRow",
"description": "The updated row with all current field values."
},
"message": {
"type": "string",
"description": "Confirmation message."
}
},
"description": "Response payload."
}
}
},
"example": {
"success": true,
"data": {
"row": {
"id": "row_abc123",
"data": {
"email": "jane@example.com",
"name": "Updated Name"
},
"position": 0,
"createdAt": "2026-01-15T10:30:00Z",
"updatedAt": "2026-01-16T08:00:00Z"
},
"message": "Row updated successfully"
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
},
"delete": {
"operationId": "deleteRow",
"summary": "Delete Row",
"description": "Delete a single row by its ID.",
"tags": ["Tables"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X DELETE \\\n \"https://www.sim.ai/api/v1/tables/{tableId}/rows/{rowId}\" \\\n -H \"X-API-Key: YOUR_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"workspaceId\": \"YOUR_WORKSPACE_ID\"\n }'"
}
],
"parameters": [
{
"$ref": "#/components/parameters/TableId"
},
{
"$ref": "#/components/parameters/RowId"
}
],
"responses": {
"200": {
"description": "Row deleted.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Indicates whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "Confirmation message."
},
"deletedCount": {
"type": "integer",
"description": "Number of rows deleted (always 1 for single-row deletion)."
}
},
"description": "Response payload."
}
}
},
"example": {
"success": true,
"data": {
"message": "Row deleted successfully",
"deletedCount": 1
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["workspaceId"],
"properties": {
"workspaceId": {
"type": "string",
"description": "The workspace that owns the table."
}
}
},
"example": {
"workspaceId": "wsp_abc123"
}
}
}
}
}
},
"/api/v1/tables/{tableId}/rows/upsert": {
"post": {
"operationId": "upsertRow",
"summary": "Upsert Row",
"description": "Insert a new row or update an existing one based on a unique column value. The table must have at least one column with a unique constraint. If a row with a matching unique value exists, it is updated; otherwise, a new row is inserted. When multiple unique columns exist, specify `conflictTarget` to indicate which column to match on.",
"tags": ["Tables"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X POST \\\n \"https://www.sim.ai/api/v1/tables/{tableId}/rows/upsert\" \\\n -H \"X-API-Key: YOUR_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"workspaceId\": \"YOUR_WORKSPACE_ID\",\n \"data\": { \"email\": \"user@example.com\", \"name\": \"John\" }\n }'"
}
],
"parameters": [
{
"$ref": "#/components/parameters/TableId"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["workspaceId", "data"],
"properties": {
"workspaceId": {
"type": "string",
"description": "The workspace ID."
},
"data": {
"type": "object",
"additionalProperties": true,
"description": "Row data. Must include a value for the conflict target column."
},
"conflictTarget": {
"type": "string",
"description": "Name of the unique column to match on. Required when the table has multiple unique columns. If the table has exactly one unique column, this can be omitted."
}
}
},
"example": {
"workspaceId": "wsp_abc123",
"data": {
"email": "user@example.com",
"name": "John Doe"
}
}
}
}
},
"responses": {
"200": {
"description": "Row upserted successfully.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Indicates whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"row": {
"$ref": "#/components/schemas/TableRow",
"description": "The inserted or updated row."
},
"operation": {
"type": "string",
"enum": ["insert", "update"],
"description": "Whether the row was inserted or updated."
},
"message": {
"type": "string",
"description": "Confirmation message."
}
},
"description": "Response payload."
}
}
},
"example": {
"success": true,
"data": {
"row": {
"id": "row_abc123",
"data": {
"email": "user@example.com",
"name": "John Doe"
},
"createdAt": "2026-01-15T10:30:00Z",
"updatedAt": "2026-01-15T10:30:00Z"
},
"operation": "insert",
"message": "Row inserted successfully"
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
}
},
"/api/v1/files": {
"get": {
"operationId": "listFiles",
"summary": "List Files",
"description": "List all files in a workspace.",
"tags": ["Files"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X GET \\\n \"https://www.sim.ai/api/v1/files?workspaceId=YOUR_WORKSPACE_ID\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"$ref": "#/components/parameters/WorkspaceId"
}
],
"responses": {
"200": {
"description": "List of workspace files.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Whether the request completed successfully."
},
"data": {
"type": "object",
"properties": {
"files": {
"type": "array",
"items": {
"$ref": "#/components/schemas/FileMetadata"
},
"description": "Array of file metadata objects in the workspace."
},
"totalCount": {
"type": "integer",
"description": "Total number of files."
}
},
"description": "Response payload containing the files list and count."
}
}
},
"example": {
"success": true,
"data": {
"files": [
{
"id": "file_abc123",
"name": "data.csv",
"size": 1024,
"type": "text/csv",
"key": "files/wsp_abc123/data.csv",
"uploadedBy": "user_abc123",
"uploadedAt": "2026-01-15T10:30:00Z"
}
],
"totalCount": 1
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
},
"post": {
"operationId": "uploadFile",
"summary": "Upload File",
"description": "Upload a file to a workspace. Send the file as multipart/form-data with a `file` field and a `workspaceId` field. Maximum file size is 100MB. Duplicate filenames within a workspace are not allowed.",
"tags": ["Files"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X POST \\\n \"https://www.sim.ai/api/v1/files\" \\\n -H \"X-API-Key: YOUR_API_KEY\" \\\n -F \"workspaceId=YOUR_WORKSPACE_ID\" \\\n -F \"file=@/path/to/file.csv\""
}
],
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"required": ["file", "workspaceId"],
"properties": {
"file": {
"type": "string",
"format": "binary",
"description": "The file to upload (max 100MB)."
},
"workspaceId": {
"type": "string",
"description": "The workspace to upload the file to."
}
}
}
}
}
},
"responses": {
"200": {
"description": "File uploaded successfully.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Whether the upload completed successfully."
},
"data": {
"type": "object",
"properties": {
"file": {
"$ref": "#/components/schemas/FileMetadata",
"description": "Metadata of the newly uploaded file."
},
"message": {
"type": "string",
"description": "Human-readable confirmation message."
}
},
"description": "Response payload containing the uploaded file metadata."
}
}
},
"example": {
"success": true,
"data": {
"file": {
"id": "file_abc123",
"name": "data.csv",
"size": 1024,
"type": "text/csv",
"key": "files/wsp_abc123/data.csv",
"uploadedBy": "user_abc123",
"uploadedAt": "2026-01-15T10:30:00Z"
},
"message": "File uploaded successfully"
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"409": {
"description": "A file with the same name already exists in this workspace.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Error message indicating a file with the same name already exists in this workspace."
}
}
}
}
}
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
},
"parameters": []
}
},
"/api/v1/files/{fileId}": {
"get": {
"operationId": "downloadFile",
"summary": "Download File",
"description": "Download a file's content. Returns the raw file bytes with appropriate Content-Type, Content-Disposition, and Content-Length headers. File metadata is included in custom response headers: X-File-Id, X-File-Name, X-Uploaded-At.",
"tags": ["Files"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X GET \\\n \"https://www.sim.ai/api/v1/files/{fileId}?workspaceId=YOUR_WORKSPACE_ID\" \\\n -H \"X-API-Key: YOUR_API_KEY\" \\\n -o downloaded-file.csv"
}
],
"parameters": [
{
"name": "fileId",
"in": "path",
"required": true,
"description": "The unique identifier of the file.",
"schema": {
"type": "string",
"example": "wf_1709571234_abc1234"
}
},
{
"$ref": "#/components/parameters/WorkspaceId"
}
],
"responses": {
"200": {
"description": "File content as binary data.",
"headers": {
"Content-Type": {
"description": "MIME type of the file.",
"schema": {
"type": "string",
"example": "text/csv"
}
},
"Content-Disposition": {
"description": "Attachment with filename.",
"schema": {
"type": "string",
"example": "attachment; filename=\"data.csv\""
}
},
"Content-Length": {
"description": "File size in bytes.",
"schema": {
"type": "string",
"example": "1024"
}
},
"X-File-Id": {
"description": "Unique file identifier.",
"schema": {
"type": "string"
}
},
"X-File-Name": {
"description": "Original filename.",
"schema": {
"type": "string"
}
},
"X-Uploaded-At": {
"description": "ISO 8601 upload timestamp.",
"schema": {
"type": "string",
"format": "date-time"
}
}
},
"content": {
"application/octet-stream": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
},
"delete": {
"operationId": "deleteFile",
"summary": "Delete File",
"description": "Delete a file from a workspace. This removes both the file content and its metadata. This action is irreversible.",
"tags": ["Files"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X DELETE \\\n \"https://www.sim.ai/api/v1/files/{fileId}?workspaceId=YOUR_WORKSPACE_ID\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"name": "fileId",
"in": "path",
"required": true,
"description": "The unique identifier of the file to delete.",
"schema": {
"type": "string",
"example": "wf_1709571234_abc1234"
}
},
{
"$ref": "#/components/parameters/WorkspaceId"
}
],
"responses": {
"200": {
"description": "File deleted successfully.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Whether the deletion completed successfully."
},
"data": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "Human-readable confirmation message."
}
},
"description": "Response payload containing the deletion confirmation."
}
}
},
"example": {
"success": true,
"data": {
"message": "File deleted successfully"
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
}
},
"/api/v1/knowledge": {
"get": {
"operationId": "listKnowledgeBases",
"summary": "List Knowledge Bases",
"description": "List all knowledge bases in a workspace.",
"tags": ["Knowledge Bases"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X GET \\\n \"https://www.sim.ai/api/v1/knowledge?workspaceId=YOUR_WORKSPACE_ID\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"$ref": "#/components/parameters/WorkspaceId"
}
],
"responses": {
"200": {
"description": "List of knowledge bases in the workspace.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"knowledgeBases": {
"type": "array",
"items": {
"$ref": "#/components/schemas/KnowledgeBase"
},
"description": "Array of knowledge base objects in the workspace."
},
"totalCount": {
"type": "integer",
"description": "Total number of knowledge bases."
}
},
"description": "Response payload containing the list of knowledge bases."
}
}
},
"example": {
"success": true,
"data": {
"knowledgeBases": [
{
"id": "kb_abc123",
"name": "Product Docs",
"description": "Product documentation and FAQs",
"docCount": 5,
"tokenCount": 25000,
"embeddingModel": "text-embedding-3-small",
"createdAt": "2026-01-15T10:30:00Z",
"updatedAt": "2026-01-15T10:30:00Z"
}
],
"totalCount": 1
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
},
"post": {
"operationId": "createKnowledgeBase",
"summary": "Create Knowledge Base",
"description": "Create a new knowledge base in a workspace. Optionally configure chunking parameters for document processing.",
"tags": ["Knowledge Bases"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X POST \\\n \"https://www.sim.ai/api/v1/knowledge\" \\\n -H \"X-API-Key: YOUR_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"workspaceId\": \"YOUR_WORKSPACE_ID\",\n \"name\": \"Product Documentation\",\n \"description\": \"Internal product docs for search\",\n \"chunkingConfig\": {\n \"maxSize\": 1024,\n \"minSize\": 100,\n \"overlap\": 200\n }\n }'"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["workspaceId", "name"],
"properties": {
"workspaceId": {
"type": "string",
"description": "The workspace to create the knowledge base in."
},
"name": {
"type": "string",
"description": "Knowledge base name (1-255 characters).",
"maxLength": 255
},
"description": {
"type": "string",
"description": "Optional description (max 1000 characters).",
"maxLength": 1000
},
"chunkingConfig": {
"$ref": "#/components/schemas/ChunkingConfig",
"description": "Optional chunking configuration for document processing. Defaults to maxSize=1024, minSize=100, overlap=200 if omitted."
}
}
},
"example": {
"workspaceId": "wsp_abc123",
"name": "Product Docs",
"description": "Product documentation and FAQs"
}
}
}
},
"responses": {
"200": {
"description": "Knowledge base created successfully.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"knowledgeBase": {
"$ref": "#/components/schemas/KnowledgeBase",
"description": "The newly created knowledge base object."
},
"message": {
"type": "string",
"description": "Human-readable confirmation message."
}
},
"description": "Response payload containing the created knowledge base."
}
}
},
"example": {
"success": true,
"data": {
"knowledgeBase": {
"id": "kb_abc123",
"name": "Product Docs",
"description": "Product documentation and FAQs",
"docCount": 0,
"tokenCount": 0,
"embeddingModel": "text-embedding-3-small",
"createdAt": "2026-01-15T10:30:00Z",
"updatedAt": "2026-01-15T10:30:00Z"
},
"message": "Knowledge base created successfully"
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
},
"parameters": []
}
},
"/api/v1/knowledge/{id}": {
"get": {
"operationId": "getKnowledgeBase",
"summary": "Get Knowledge Base",
"description": "Get details of a specific knowledge base.",
"tags": ["Knowledge Bases"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X GET \\\n \"https://www.sim.ai/api/v1/knowledge/KB_ID?workspaceId=YOUR_WORKSPACE_ID\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "Knowledge base ID.",
"schema": {
"type": "string"
}
},
{
"$ref": "#/components/parameters/WorkspaceId"
}
],
"responses": {
"200": {
"description": "Knowledge base details.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"knowledgeBase": {
"$ref": "#/components/schemas/KnowledgeBase",
"description": "The knowledge base object."
}
},
"description": "Response payload containing the knowledge base details."
}
}
},
"example": {
"success": true,
"data": {
"knowledgeBase": {
"id": "kb_abc123",
"name": "Product Docs",
"description": "Product documentation and FAQs",
"docCount": 5,
"tokenCount": 25000,
"embeddingModel": "text-embedding-3-small",
"createdAt": "2026-01-15T10:30:00Z",
"updatedAt": "2026-01-15T10:30:00Z"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
},
"put": {
"operationId": "updateKnowledgeBase",
"summary": "Update Knowledge Base",
"description": "Update a knowledge base's name, description, or chunking configuration. At least one field must be provided.",
"tags": ["Knowledge Bases"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X PUT \\\n \"https://www.sim.ai/api/v1/knowledge/KB_ID\" \\\n -H \"X-API-Key: YOUR_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"workspaceId\": \"YOUR_WORKSPACE_ID\",\n \"name\": \"Updated Name\"\n }'"
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "Knowledge base ID.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["workspaceId"],
"properties": {
"workspaceId": {
"type": "string",
"description": "The workspace the knowledge base belongs to."
},
"name": {
"type": "string",
"description": "New name (1-255 characters).",
"maxLength": 255
},
"description": {
"type": "string",
"description": "New description (max 1000 characters).",
"maxLength": 1000
},
"chunkingConfig": {
"$ref": "#/components/schemas/ChunkingConfig",
"description": "Updated chunking configuration. All three fields (maxSize, minSize, overlap) must be provided if included."
}
}
},
"example": {
"workspaceId": "wsp_abc123",
"name": "Updated Product Docs",
"description": "Updated product documentation"
}
}
}
},
"responses": {
"200": {
"description": "Knowledge base updated successfully.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"knowledgeBase": {
"$ref": "#/components/schemas/KnowledgeBase",
"description": "The updated knowledge base object."
},
"message": {
"type": "string",
"description": "Human-readable confirmation message."
}
},
"description": "Response payload containing the updated knowledge base."
}
}
},
"example": {
"success": true,
"data": {
"knowledgeBase": {
"id": "kb_abc123",
"name": "Updated Product Docs",
"description": "Updated product documentation",
"docCount": 5,
"tokenCount": 25000,
"embeddingModel": "text-embedding-3-small",
"createdAt": "2026-01-15T10:30:00Z",
"updatedAt": "2026-01-16T08:00:00Z"
},
"message": "Knowledge base updated successfully"
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
},
"delete": {
"operationId": "deleteKnowledgeBase",
"summary": "Delete Knowledge Base",
"description": "Soft-delete a knowledge base and all its documents.",
"tags": ["Knowledge Bases"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X DELETE \\\n \"https://www.sim.ai/api/v1/knowledge/KB_ID?workspaceId=YOUR_WORKSPACE_ID\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "Knowledge base ID.",
"schema": {
"type": "string"
}
},
{
"$ref": "#/components/parameters/WorkspaceId"
}
],
"responses": {
"200": {
"description": "Knowledge base deleted successfully.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "Human-readable confirmation message."
}
},
"description": "Response payload."
}
}
},
"example": {
"success": true,
"data": {
"message": "Knowledge base deleted successfully"
}
}
}
}
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
}
},
"/api/v1/knowledge/{id}/documents": {
"get": {
"operationId": "listDocuments",
"summary": "List Documents",
"description": "List documents in a knowledge base with pagination, filtering, and sorting.",
"tags": ["Knowledge Bases"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X GET \\\n \"https://www.sim.ai/api/v1/knowledge/KB_ID/documents?workspaceId=YOUR_WORKSPACE_ID&limit=50&offset=0\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "Knowledge base ID.",
"schema": {
"type": "string"
}
},
{
"$ref": "#/components/parameters/WorkspaceId"
},
{
"name": "limit",
"in": "query",
"description": "Maximum number of documents to return (1-100, default 50).",
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 100,
"default": 50
}
},
{
"name": "offset",
"in": "query",
"description": "Number of documents to skip (default 0).",
"schema": {
"type": "integer",
"minimum": 0,
"default": 0
}
},
{
"name": "search",
"in": "query",
"description": "Search documents by filename.",
"schema": {
"type": "string"
}
},
{
"name": "enabledFilter",
"in": "query",
"description": "Filter by enabled status.",
"schema": {
"type": "string",
"enum": ["all", "enabled", "disabled"],
"default": "all"
}
},
{
"name": "sortBy",
"in": "query",
"description": "Field to sort by.",
"schema": {
"type": "string",
"enum": [
"filename",
"fileSize",
"tokenCount",
"chunkCount",
"uploadedAt",
"processingStatus",
"enabled"
],
"default": "uploadedAt"
}
},
{
"name": "sortOrder",
"in": "query",
"description": "Sort direction.",
"schema": {
"type": "string",
"enum": ["asc", "desc"],
"default": "desc"
}
}
],
"responses": {
"200": {
"description": "List of documents.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"documents": {
"type": "array",
"items": {
"$ref": "#/components/schemas/KnowledgeDocument"
},
"description": "Array of document objects in the knowledge base."
},
"pagination": {
"type": "object",
"properties": {
"total": {
"type": "integer",
"description": "Total number of documents matching the query."
},
"limit": {
"type": "integer",
"description": "Maximum number of documents returned per page."
},
"offset": {
"type": "integer",
"description": "Number of documents skipped from the beginning."
},
"hasMore": {
"type": "boolean",
"description": "Whether there are more documents beyond the current page."
}
},
"description": "Pagination metadata for the document list."
}
},
"description": "Response payload containing the documents and pagination info."
}
}
},
"example": {
"success": true,
"data": {
"documents": [
{
"id": "doc_abc123",
"knowledgeBaseId": "kb_abc123",
"filename": "Getting Started.pdf",
"fileSize": 204800,
"mimeType": "application/pdf",
"processingStatus": "completed",
"chunkCount": 12,
"tokenCount": 3500,
"enabled": true,
"createdAt": "2026-01-15T10:30:00Z"
}
],
"pagination": {
"total": 1,
"limit": 50,
"offset": 0,
"hasMore": false
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
},
"post": {
"operationId": "uploadDocument",
"summary": "Upload Document",
"description": "Upload a document to a knowledge base. The document will be processed asynchronously (chunked and embedded). Maximum file size is 100MB.",
"tags": ["Knowledge Bases"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X POST \\\n \"https://www.sim.ai/api/v1/knowledge/KB_ID/documents\" \\\n -H \"X-API-Key: YOUR_API_KEY\" \\\n -F \"workspaceId=YOUR_WORKSPACE_ID\" \\\n -F \"file=@/path/to/document.pdf\""
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "Knowledge base ID.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"required": ["file", "workspaceId"],
"properties": {
"file": {
"type": "string",
"format": "binary",
"description": "The document file to upload (max 100MB)."
},
"workspaceId": {
"type": "string",
"description": "The workspace the knowledge base belongs to."
}
}
}
}
}
},
"responses": {
"200": {
"description": "Document uploaded successfully. Processing will begin shortly.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"document": {
"$ref": "#/components/schemas/KnowledgeDocument",
"description": "The newly created document object with initial processing status of 'pending'."
},
"message": {
"type": "string",
"description": "Human-readable confirmation message."
}
},
"description": "Response payload containing the uploaded document."
}
}
},
"example": {
"success": true,
"data": {
"document": {
"id": "doc_abc123",
"knowledgeBaseId": "kb_abc123",
"filename": "Getting Started.pdf",
"fileSize": 204800,
"mimeType": "application/pdf",
"processingStatus": "pending",
"chunkCount": 0,
"tokenCount": 0,
"enabled": true,
"createdAt": "2026-01-15T10:30:00Z"
},
"message": "Document uploaded successfully. Processing will begin shortly."
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"409": {
"description": "A file with the same name already exists.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Error message indicating a file with the same name already exists."
}
}
}
}
}
},
"413": {
"description": "Storage limit exceeded for the workspace.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Error message indicating the workspace storage limit has been exceeded."
}
}
}
}
}
},
"415": {
"description": "Unsupported file type. See error message for supported types.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Error message indicating the file type is not supported."
}
}
}
}
}
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
}
},
"/api/v1/knowledge/{id}/documents/{documentId}": {
"get": {
"operationId": "getDocument",
"summary": "Get Document",
"description": "Get details of a specific document in a knowledge base.",
"tags": ["Knowledge Bases"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X GET \\\n \"https://www.sim.ai/api/v1/knowledge/KB_ID/documents/DOC_ID?workspaceId=YOUR_WORKSPACE_ID\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "Knowledge base ID.",
"schema": {
"type": "string"
}
},
{
"name": "documentId",
"in": "path",
"required": true,
"description": "Document ID.",
"schema": {
"type": "string"
}
},
{
"$ref": "#/components/parameters/WorkspaceId"
}
],
"responses": {
"200": {
"description": "Document details.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"document": {
"$ref": "#/components/schemas/KnowledgeDocumentDetail",
"description": "Detailed document object including processing and connector information."
}
},
"description": "Response payload containing the document details."
}
}
},
"example": {
"success": true,
"data": {
"document": {
"id": "doc_abc123",
"knowledgeBaseId": "kb_abc123",
"filename": "Getting Started.pdf",
"fileSize": 204800,
"mimeType": "application/pdf",
"processingStatus": "completed",
"chunkCount": 12,
"tokenCount": 3500,
"characterCount": 18000,
"enabled": true,
"createdAt": "2026-01-15T10:30:00Z"
}
}
}
}
}
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
},
"delete": {
"operationId": "deleteDocument",
"summary": "Delete Document",
"description": "Soft-delete a document from a knowledge base. For connector-sourced documents, this also prevents re-import on future syncs.",
"tags": ["Knowledge Bases"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X DELETE \\\n \"https://www.sim.ai/api/v1/knowledge/KB_ID/documents/DOC_ID?workspaceId=YOUR_WORKSPACE_ID\" \\\n -H \"X-API-Key: YOUR_API_KEY\""
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "Knowledge base ID.",
"schema": {
"type": "string"
}
},
{
"name": "documentId",
"in": "path",
"required": true,
"description": "Document ID.",
"schema": {
"type": "string"
}
},
{
"$ref": "#/components/parameters/WorkspaceId"
}
],
"responses": {
"200": {
"description": "Document deleted successfully.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "Human-readable confirmation message."
}
},
"description": "Response payload."
}
}
},
"example": {
"success": true,
"data": {
"message": "Document deleted successfully"
}
}
}
}
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
}
}
},
"/api/v1/knowledge/search": {
"post": {
"operationId": "searchKnowledgeBase",
"summary": "Search Knowledge Base",
"description": "Perform vector similarity search across one or more knowledge bases. Supports semantic search via query text, tag-based filtering, or a combination of both.",
"tags": ["Knowledge Bases"],
"x-codeSamples": [
{
"id": "curl",
"label": "cURL",
"lang": "bash",
"source": "curl -X POST \\\n \"https://www.sim.ai/api/v1/knowledge/search\" \\\n -H \"X-API-Key: YOUR_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"workspaceId\": \"YOUR_WORKSPACE_ID\",\n \"knowledgeBaseIds\": [\"KB_ID\"],\n \"query\": \"How do I reset my password?\",\n \"topK\": 5\n }'"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["workspaceId", "knowledgeBaseIds"],
"properties": {
"workspaceId": {
"type": "string",
"description": "The workspace containing the knowledge bases."
},
"knowledgeBaseIds": {
"oneOf": [
{
"type": "string",
"description": "A single knowledge base ID."
},
{
"type": "array",
"items": {
"type": "string"
},
"description": "An array of knowledge base IDs to search across."
}
],
"description": "Array of knowledge base IDs to search across."
},
"query": {
"type": "string",
"description": "Search query text for semantic similarity search. Either query or tagFilters must be provided."
},
"topK": {
"type": "integer",
"minimum": 1,
"maximum": 100,
"default": 10,
"description": "Maximum number of results to return."
},
"tagFilters": {
"type": "array",
"description": "Tag-based filters. Either query or tagFilters must be provided.",
"items": {
"$ref": "#/components/schemas/TagFilter"
}
}
}
},
"example": {
"workspaceId": "wsp_abc123",
"knowledgeBaseIds": ["kb_abc123"],
"query": "How do I reset my password?",
"topK": 5
}
}
}
},
"responses": {
"200": {
"description": "Search results.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SearchResult"
},
"description": "Array of search result objects ranked by similarity."
},
"query": {
"type": "string",
"description": "The search query used."
},
"knowledgeBaseIds": {
"type": "array",
"items": {
"type": "string"
},
"description": "Knowledge base IDs that were searched."
},
"topK": {
"type": "integer",
"description": "Maximum results requested."
},
"totalResults": {
"type": "integer",
"description": "Number of results returned."
}
},
"description": "Response payload containing the search results and metadata."
}
}
},
"example": {
"success": true,
"data": {
"results": [
{
"documentId": "doc_abc123",
"documentName": "Getting Started.pdf",
"content": "To reset your password, go to Settings > Security.",
"chunkIndex": 3,
"similarity": 0.95,
"metadata": {}
}
],
"query": "How do I reset my password?",
"knowledgeBaseIds": ["kb_abc123"],
"topK": 5,
"totalResults": 1
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"404": {
"$ref": "#/components/responses/NotFound"
},
"429": {
"$ref": "#/components/responses/RateLimited"
}
},
"parameters": []
}
}
},
"components": {
"securitySchemes": {
"apiKey": {
"type": "apiKey",
"in": "header",
"name": "X-API-Key",
"description": "Your Sim API key (personal or workspace). Generate one from the Sim dashboard under Settings > API Keys."
}
},
"parameters": {
"TableId": {
"name": "tableId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"example": "tbl_abc123"
},
"description": "The unique identifier of the table."
},
"RowId": {
"name": "rowId",
"in": "path",
"required": true,
"schema": {
"type": "string",
"example": "row_xyz789"
},
"description": "The unique identifier of the row."
},
"WorkspaceId": {
"name": "workspaceId",
"in": "query",
"required": true,
"schema": {
"type": "string"
},
"description": "The unique identifier of the workspace."
}
},
"schemas": {
"ColumnDefinition": {
"type": "object",
"description": "Definition of a table column including its type and constraints.",
"required": ["name", "type"],
"properties": {
"name": {
"type": "string",
"description": "Column name. Must start with a letter or underscore.",
"example": "email",
"pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$"
},
"type": {
"type": "string",
"enum": ["string", "number", "boolean", "date", "json"],
"description": "Data type of the column."
},
"required": {
"type": "boolean",
"description": "Whether the column requires a value on insert.",
"default": false
},
"unique": {
"type": "boolean",
"description": "Whether values in this column must be unique across all rows.",
"default": false
}
}
},
"Table": {
"type": "object",
"description": "A user-defined table with a typed schema.",
"properties": {
"id": {
"type": "string",
"description": "Unique table identifier.",
"example": "tbl_abc123"
},
"name": {
"type": "string",
"description": "Table name.",
"example": "contacts"
},
"description": {
"type": "string",
"description": "Optional description of the table.",
"example": "Customer contact records"
},
"schema": {
"type": "object",
"description": "Table schema definition.",
"properties": {
"columns": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ColumnDefinition"
},
"description": "Array of column definitions for the table."
}
}
},
"rowCount": {
"type": "integer",
"description": "Current number of rows in the table."
},
"maxRows": {
"type": "integer",
"description": "Maximum rows allowed by the current billing plan."
},
"createdAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when the table was created."
},
"updatedAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when the table was last modified."
}
}
},
"TableRow": {
"type": "object",
"description": "A single row in a table.",
"properties": {
"id": {
"type": "string",
"description": "Unique row identifier.",
"example": "row_xyz789"
},
"data": {
"type": "object",
"additionalProperties": true,
"description": "Row data as key-value pairs matching the table schema."
},
"position": {
"type": "integer",
"description": "Row's position/order in the table."
},
"createdAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when the row was created."
},
"updatedAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when the row was last modified."
}
}
},
"WorkflowSummary": {
"type": "object",
"description": "Summary representation of a workflow returned in list operations.",
"properties": {
"id": {
"type": "string",
"description": "Unique workflow identifier.",
"example": "wf_1a2b3c4d5e"
},
"name": {
"type": "string",
"description": "Human-readable workflow name.",
"example": "Customer Support Agent"
},
"description": {
"type": "string",
"nullable": true,
"description": "Optional description of what the workflow does.",
"example": "Routes incoming support tickets and drafts responses"
},
"color": {
"type": "string",
"description": "Hex color code used for the workflow icon in the dashboard (e.g., #33c482).",
"example": "#33c482"
},
"folderId": {
"type": "string",
"nullable": true,
"description": "The folder this workflow belongs to. null if at the workspace root.",
"example": "folder_abc123"
},
"workspaceId": {
"type": "string",
"description": "The workspace this workflow belongs to.",
"example": "ws_xyz789"
},
"isDeployed": {
"type": "boolean",
"description": "Whether the workflow is currently deployed and available for API execution.",
"example": true
},
"deployedAt": {
"type": "string",
"format": "date-time",
"nullable": true,
"description": "ISO 8601 timestamp of the most recent deployment. null if never deployed.",
"example": "2025-06-15T10:30:00Z"
},
"runCount": {
"type": "integer",
"description": "Total number of times this workflow has been executed.",
"example": 142
},
"lastRunAt": {
"type": "string",
"format": "date-time",
"nullable": true,
"description": "ISO 8601 timestamp of the most recent execution. null if never run.",
"example": "2025-06-20T14:15:22Z"
},
"createdAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when the workflow was created.",
"example": "2025-01-10T09:00:00Z"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when the workflow was last modified.",
"example": "2025-06-18T16:45:00Z"
}
}
},
"WorkflowDetail": {
"type": "object",
"description": "Full workflow representation including input field definitions and configuration.",
"properties": {
"id": {
"type": "string",
"description": "Unique workflow identifier.",
"example": "wf_1a2b3c4d5e"
},
"name": {
"type": "string",
"description": "Human-readable workflow name.",
"example": "Customer Support Agent"
},
"description": {
"type": "string",
"nullable": true,
"description": "Optional description of what the workflow does.",
"example": "Routes incoming support tickets and drafts responses"
},
"color": {
"type": "string",
"description": "Hex color code used for the workflow icon in the dashboard.",
"example": "#33c482"
},
"folderId": {
"type": "string",
"nullable": true,
"description": "The folder this workflow belongs to. null if at the workspace root.",
"example": "folder_abc123"
},
"workspaceId": {
"type": "string",
"description": "The workspace this workflow belongs to.",
"example": "ws_xyz789"
},
"isDeployed": {
"type": "boolean",
"description": "Whether the workflow is currently deployed and available for API execution.",
"example": true
},
"deployedAt": {
"type": "string",
"format": "date-time",
"nullable": true,
"description": "ISO 8601 timestamp of the most recent deployment. null if never deployed.",
"example": "2025-06-15T10:30:00Z"
},
"runCount": {
"type": "integer",
"description": "Total number of times this workflow has been executed.",
"example": 142
},
"lastRunAt": {
"type": "string",
"format": "date-time",
"nullable": true,
"description": "ISO 8601 timestamp of the most recent execution. null if never run.",
"example": "2025-06-20T14:15:22Z"
},
"variables": {
"type": "object",
"description": "Workflow-level variables and their current values.",
"example": {}
},
"inputs": {
"type": "object",
"description": "The workflow's input field definitions. Use these to construct the input object when executing the workflow.",
"properties": {
"fields": {
"type": "object",
"description": "Map of field names to their type definitions and configuration.",
"additionalProperties": true,
"example": {}
}
}
},
"createdAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when the workflow was created.",
"example": "2025-01-10T09:00:00Z"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when the workflow was last modified.",
"example": "2025-06-18T16:45:00Z"
}
}
},
"ExecutionResult": {
"type": "object",
"description": "Result of a synchronous workflow execution.",
"properties": {
"success": {
"type": "boolean",
"description": "Whether the workflow executed successfully without errors.",
"example": true
},
"executionId": {
"type": "string",
"description": "Unique identifier for this execution. Use this to query logs or cancel the execution.",
"example": "exec_9f8e7d6c5b"
},
"output": {
"type": "object",
"description": "Workflow output keyed by block name and output field. Structure depends on the workflow's block configuration.",
"additionalProperties": true,
"example": {
"result": "Hello, world!"
}
},
"error": {
"type": "string",
"nullable": true,
"description": "Error message if the execution failed. null on success.",
"example": null
},
"metadata": {
"type": "object",
"description": "Execution timing metadata.",
"properties": {
"duration": {
"type": "integer",
"description": "Total execution duration in milliseconds.",
"example": 1250
},
"startTime": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when execution started.",
"example": "2025-06-20T14:15:22Z"
},
"endTime": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when execution completed.",
"example": "2025-06-20T14:15:23Z"
}
}
}
}
},
"AsyncExecutionResult": {
"type": "object",
"description": "Response returned when a workflow execution is queued for asynchronous processing.",
"properties": {
"success": {
"type": "boolean",
"description": "Whether the execution was successfully queued.",
"example": true
},
"async": {
"type": "boolean",
"description": "Always true for async executions. Use this to distinguish from synchronous responses.",
"example": true
},
"jobId": {
"type": "string",
"description": "Internal job queue identifier for tracking the execution.",
"example": "job_4a3b2c1d0e"
},
"executionId": {
"type": "string",
"description": "Unique execution identifier. Use this to query execution status or cancel.",
"example": "exec_9f8e7d6c5b"
},
"message": {
"type": "string",
"description": "Human-readable status message (e.g., \"Execution queued\").",
"example": "Execution queued"
},
"statusUrl": {
"type": "string",
"format": "uri",
"description": "URL to poll for execution status and results. Returns the full execution result once complete.",
"example": "https://www.sim.ai/api/jobs/job_4a3b2c1d0e"
}
}
},
"LogEntry": {
"type": "object",
"description": "Summary of a single workflow execution log entry.",
"properties": {
"id": {
"type": "string",
"description": "Unique log entry identifier.",
"example": "log_7x8y9z0a1b"
},
"workflowId": {
"type": "string",
"description": "The workflow that was executed.",
"example": "wf_1a2b3c4d5e"
},
"executionId": {
"type": "string",
"description": "Unique execution identifier for this run.",
"example": "exec_9f8e7d6c5b"
},
"level": {
"type": "string",
"description": "Log severity. info for successful executions, error for failures.",
"example": "info"
},
"trigger": {
"type": "string",
"description": "How the execution was triggered (e.g., api, manual, webhook, schedule, chat).",
"example": "api"
},
"startedAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when execution started.",
"example": "2025-06-20T14:15:22Z"
},
"endedAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when execution completed.",
"example": "2025-06-20T14:15:23Z"
},
"totalDurationMs": {
"type": "integer",
"description": "Total execution duration in milliseconds.",
"example": 1250
},
"cost": {
"type": "object",
"description": "Cost summary for this execution.",
"properties": {
"total": {
"type": "number",
"description": "Total cost of this execution in USD.",
"example": 0.0032
}
}
},
"files": {
"type": "object",
"nullable": true,
"description": "File outputs produced during execution. null if no files were generated.",
"example": null
}
}
},
"LogDetail": {
"type": "object",
"description": "Detailed log entry with full execution data, workflow metadata, and cost breakdown.",
"properties": {
"id": {
"type": "string",
"description": "Unique log entry identifier.",
"example": "log_7x8y9z0a1b"
},
"workflowId": {
"type": "string",
"description": "The workflow that was executed.",
"example": "wf_1a2b3c4d5e"
},
"executionId": {
"type": "string",
"description": "Unique execution identifier for this run.",
"example": "exec_9f8e7d6c5b"
},
"level": {
"type": "string",
"description": "Log severity. info for successful executions, error for failures.",
"example": "info"
},
"trigger": {
"type": "string",
"description": "How the execution was triggered (e.g., api, manual, webhook, schedule, chat).",
"example": "api"
},
"startedAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when execution started.",
"example": "2025-06-20T14:15:22Z"
},
"endedAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when execution completed.",
"example": "2025-06-20T14:15:23Z"
},
"totalDurationMs": {
"type": "integer",
"description": "Total execution duration in milliseconds.",
"example": 1250
},
"workflow": {
"type": "object",
"description": "Summary metadata about the workflow at the time of execution.",
"properties": {
"id": {
"type": "string",
"description": "Unique workflow identifier.",
"example": "wf_1a2b3c4d5e"
},
"name": {
"type": "string",
"description": "Workflow name at the time of execution.",
"example": "Customer Support Agent"
},
"description": {
"type": "string",
"nullable": true,
"description": "Workflow description at the time of execution.",
"example": "Routes incoming support tickets and drafts responses"
}
}
},
"executionData": {
"type": "object",
"description": "Detailed execution data including block-level traces and final output.",
"properties": {
"traceSpans": {
"type": "array",
"description": "Block-level execution traces with timing, inputs, and outputs for each block that ran.",
"items": {
"type": "object"
}
},
"finalOutput": {
"type": "object",
"description": "The workflow's final output after all blocks completed."
}
}
},
"cost": {
"type": "object",
"description": "Detailed cost breakdown for this execution.",
"properties": {
"total": {
"type": "number",
"description": "Total cost of this execution in USD.",
"example": 0.0032
},
"tokens": {
"type": "object",
"description": "Aggregate token usage across all AI model calls in this execution.",
"properties": {
"prompt": {
"type": "integer",
"description": "Total prompt (input) tokens consumed.",
"example": 450
},
"completion": {
"type": "integer",
"description": "Total completion (output) tokens generated.",
"example": 120
},
"total": {
"type": "integer",
"description": "Total tokens (prompt + completion).",
"example": 570
}
}
},
"models": {
"type": "object",
"description": "Per-model cost and token breakdown. Keys are model identifiers (e.g., gpt-4o, claude-sonnet-4-20250514).",
"additionalProperties": {
"type": "object",
"description": "Cost and token details for a specific model.",
"properties": {
"input": {
"type": "number",
"description": "Cost of prompt tokens for this model in USD."
},
"output": {
"type": "number",
"description": "Cost of completion tokens for this model in USD."
},
"total": {
"type": "number",
"description": "Total cost for this model in USD."
},
"tokens": {
"type": "object",
"description": "Token usage for this specific model.",
"properties": {
"prompt": {
"type": "integer",
"description": "Prompt tokens consumed by this model."
},
"completion": {
"type": "integer",
"description": "Completion tokens generated by this model."
},
"total": {
"type": "integer",
"description": "Total tokens for this model."
}
}
}
}
}
}
}
}
}
},
"Limits": {
"type": "object",
"description": "Rate limit and usage information included in every API response.",
"properties": {
"workflowExecutionRateLimit": {
"type": "object",
"description": "Current rate limit status for workflow executions.",
"properties": {
"sync": {
"description": "Rate limit bucket for synchronous executions.",
"$ref": "#/components/schemas/RateLimitBucket"
},
"async": {
"description": "Rate limit bucket for asynchronous executions.",
"$ref": "#/components/schemas/RateLimitBucket"
}
}
},
"usage": {
"type": "object",
"description": "Current billing period usage and plan limits.",
"properties": {
"currentPeriodCost": {
"type": "number",
"description": "Total spend in the current billing period in USD.",
"example": 1.25
},
"limit": {
"type": "number",
"description": "Maximum allowed spend for the current billing period in USD.",
"example": 50.0
},
"plan": {
"type": "string",
"description": "Your current subscription plan (e.g., free, pro, team).",
"example": "pro"
},
"isExceeded": {
"type": "boolean",
"description": "Whether the usage limit has been exceeded. Executions may be blocked when true.",
"example": false
}
}
}
}
},
"RateLimitBucket": {
"type": "object",
"description": "Rate limit status for a specific execution type.",
"properties": {
"requestsPerMinute": {
"type": "integer",
"description": "Maximum number of requests allowed per minute.",
"example": 60
},
"maxBurst": {
"type": "integer",
"description": "Maximum number of concurrent requests allowed in a burst.",
"example": 10
},
"remaining": {
"type": "integer",
"description": "Number of requests remaining in the current rate limit window.",
"example": 59
},
"resetAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when the rate limit window resets.",
"example": "2025-06-20T14:16:00Z"
}
}
},
"JobStatus": {
"type": "object",
"description": "Status of an asynchronous job.",
"properties": {
"success": {
"type": "boolean",
"description": "Whether the request was successful.",
"example": true
},
"taskId": {
"type": "string",
"description": "The unique identifier of the job.",
"example": "job_4a3b2c1d0e"
},
"status": {
"type": "string",
"enum": ["queued", "processing", "completed", "failed"],
"description": "Current status of the job.",
"example": "completed"
},
"metadata": {
"type": "object",
"description": "Timing metadata for the job.",
"properties": {
"startedAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when the job started processing.",
"example": "2025-06-20T14:15:22Z"
},
"completedAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when the job completed. Present only when status is completed or failed.",
"example": "2025-06-20T14:15:23Z"
},
"duration": {
"type": "integer",
"description": "Duration of the job in milliseconds. Present only when status is completed or failed.",
"example": 1250
}
}
},
"output": {
"description": "The workflow execution output. Present only when status is completed.",
"type": "object",
"example": {
"result": "Hello, world!"
}
},
"error": {
"description": "Error details. Present only when status is failed.",
"type": "string",
"example": null
},
"estimatedDuration": {
"type": "integer",
"description": "Estimated duration in milliseconds. Present only when status is queued or processing.",
"example": 2000
}
}
},
"AuditLogEntry": {
"type": "object",
"description": "An enterprise audit log entry recording an action taken in the workspace.",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the audit log entry.",
"example": "audit_2c3d4e5f6g"
},
"workspaceId": {
"type": "string",
"nullable": true,
"description": "The workspace where the action occurred.",
"example": "ws_xyz789"
},
"actorId": {
"type": "string",
"nullable": true,
"description": "The user ID of the person who performed the action.",
"example": "user_abc123"
},
"actorName": {
"type": "string",
"nullable": true,
"description": "Display name of the person who performed the action.",
"example": "Jane Smith"
},
"actorEmail": {
"type": "string",
"nullable": true,
"description": "Email address of the person who performed the action.",
"example": "jane@example.com"
},
"action": {
"type": "string",
"description": "The action that was performed (e.g., workflow.created, member.invited).",
"example": "workflow.deployed"
},
"resourceType": {
"type": "string",
"description": "The type of resource affected (e.g., workflow, workspace, member).",
"example": "workflow"
},
"resourceId": {
"type": "string",
"nullable": true,
"description": "The unique identifier of the affected resource.",
"example": "wf_1a2b3c4d5e"
},
"resourceName": {
"type": "string",
"nullable": true,
"description": "Display name of the affected resource.",
"example": "Customer Support Agent"
},
"description": {
"type": "string",
"nullable": true,
"description": "Human-readable description of the action.",
"example": "Deployed workflow Customer Support Agent"
},
"metadata": {
"type": "object",
"nullable": true,
"description": "Additional context about the action.",
"example": null
},
"createdAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when the action occurred.",
"example": "2025-06-20T14:15:22Z"
}
}
},
"UsageLimits": {
"type": "object",
"description": "Current rate limits, usage, and storage information for the authenticated user.",
"properties": {
"success": {
"type": "boolean",
"description": "Whether the request was successful."
},
"rateLimit": {
"type": "object",
"description": "Rate limit status for workflow executions.",
"properties": {
"sync": {
"description": "Rate limit bucket for synchronous executions.",
"allOf": [
{
"$ref": "#/components/schemas/RateLimitBucket"
},
{
"type": "object",
"properties": {
"isLimited": {
"type": "boolean",
"description": "Whether the rate limit has been reached."
}
}
}
]
},
"async": {
"description": "Rate limit bucket for asynchronous executions.",
"allOf": [
{
"$ref": "#/components/schemas/RateLimitBucket"
},
{
"type": "object",
"properties": {
"isLimited": {
"type": "boolean",
"description": "Whether the rate limit has been reached."
}
}
}
]
},
"authType": {
"type": "string",
"description": "The authentication type used (api or manual)."
}
}
},
"usage": {
"type": "object",
"description": "Current billing period usage.",
"properties": {
"currentPeriodCost": {
"type": "number",
"description": "Total spend in the current billing period in USD."
},
"limit": {
"type": "number",
"description": "Maximum allowed spend for the current billing period in USD."
},
"plan": {
"type": "string",
"description": "Your current subscription plan (e.g., free, pro, team)."
}
}
},
"storage": {
"type": "object",
"description": "File storage usage.",
"properties": {
"usedBytes": {
"type": "integer",
"description": "Total storage used in bytes."
},
"limitBytes": {
"type": "integer",
"description": "Maximum storage allowed in bytes."
},
"percentUsed": {
"type": "number",
"description": "Percentage of storage used (0-100)."
}
}
}
}
},
"FileMetadata": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique file identifier.",
"example": "wf_1709571234_abc1234"
},
"name": {
"type": "string",
"description": "Original filename.",
"example": "data.csv"
},
"size": {
"type": "integer",
"description": "File size in bytes.",
"example": 1024
},
"type": {
"type": "string",
"description": "MIME type of the file.",
"example": "text/csv"
},
"key": {
"type": "string",
"description": "Storage key for the file.",
"example": "workspace/abc-123/1709571234-xyz-data.csv"
},
"uploadedBy": {
"type": "string",
"description": "User ID of the uploader."
},
"uploadedAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp of when the file was uploaded."
}
}
},
"KnowledgeBase": {
"type": "object",
"description": "A knowledge base for storing and searching document embeddings.",
"properties": {
"id": {
"type": "string",
"description": "Unique knowledge base identifier."
},
"name": {
"type": "string",
"description": "Knowledge base name."
},
"description": {
"type": "string",
"nullable": true,
"description": "Optional description."
},
"tokenCount": {
"type": "integer",
"description": "Total token count across all documents."
},
"embeddingModel": {
"type": "string",
"description": "Embedding model used (e.g. text-embedding-3-small)."
},
"embeddingDimension": {
"type": "integer",
"description": "Embedding vector dimension."
},
"chunkingConfig": {
"$ref": "#/components/schemas/ChunkingConfig"
},
"docCount": {
"type": "integer",
"description": "Number of documents in the knowledge base."
},
"connectorTypes": {
"type": "array",
"items": {
"type": "string"
},
"description": "Types of connectors attached to this knowledge base."
},
"createdAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when the knowledge base was created."
},
"updatedAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when the knowledge base was last modified."
}
}
},
"ChunkingConfig": {
"type": "object",
"description": "Configuration for how documents are split into chunks for embedding.",
"properties": {
"maxSize": {
"type": "integer",
"minimum": 100,
"maximum": 4000,
"default": 1024,
"description": "Maximum chunk size in tokens."
},
"minSize": {
"type": "integer",
"minimum": 1,
"maximum": 2000,
"default": 100,
"description": "Minimum chunk size in characters."
},
"overlap": {
"type": "integer",
"minimum": 0,
"maximum": 500,
"default": 200,
"description": "Overlap between chunks in tokens."
}
}
},
"KnowledgeDocument": {
"type": "object",
"description": "A document in a knowledge base.",
"properties": {
"id": {
"type": "string",
"description": "Unique document identifier."
},
"knowledgeBaseId": {
"type": "string",
"description": "Knowledge base this document belongs to."
},
"filename": {
"type": "string",
"description": "Original filename."
},
"fileSize": {
"type": "integer",
"description": "File size in bytes."
},
"mimeType": {
"type": "string",
"description": "MIME type of the file."
},
"processingStatus": {
"type": "string",
"enum": ["pending", "processing", "completed", "failed"],
"description": "Current processing status."
},
"chunkCount": {
"type": "integer",
"description": "Number of chunks created from this document."
},
"tokenCount": {
"type": "integer",
"description": "Total token count."
},
"characterCount": {
"type": "integer",
"description": "Total character count."
},
"enabled": {
"type": "boolean",
"description": "Whether the document is enabled for search."
},
"createdAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when the document was uploaded."
}
}
},
"KnowledgeDocumentDetail": {
"type": "object",
"description": "Detailed document information including processing and connector details.",
"properties": {
"id": {
"type": "string",
"description": "Unique document identifier."
},
"knowledgeBaseId": {
"type": "string",
"description": "Knowledge base this document belongs to."
},
"filename": {
"type": "string",
"description": "Original filename."
},
"fileSize": {
"type": "integer",
"description": "File size in bytes."
},
"mimeType": {
"type": "string",
"description": "MIME type of the file."
},
"processingStatus": {
"type": "string",
"enum": ["pending", "processing", "completed", "failed"],
"description": "Current processing status."
},
"processingError": {
"type": "string",
"nullable": true,
"description": "Error message if processing failed."
},
"processingStartedAt": {
"type": "string",
"format": "date-time",
"nullable": true,
"description": "When processing started."
},
"processingCompletedAt": {
"type": "string",
"format": "date-time",
"nullable": true,
"description": "When processing completed."
},
"chunkCount": {
"type": "integer",
"description": "Number of chunks created."
},
"tokenCount": {
"type": "integer",
"description": "Total token count."
},
"characterCount": {
"type": "integer",
"description": "Total character count."
},
"enabled": {
"type": "boolean",
"description": "Whether the document is enabled for search."
},
"connectorId": {
"type": "string",
"nullable": true,
"description": "Connector ID if sourced from an external connector."
},
"connectorType": {
"type": "string",
"nullable": true,
"description": "Connector type (e.g. google-drive, notion)."
},
"sourceUrl": {
"type": "string",
"nullable": true,
"description": "Original source URL for connector-sourced documents."
},
"createdAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when the document was uploaded."
}
}
},
"SearchResult": {
"type": "object",
"description": "A single search result from knowledge base vector search.",
"properties": {
"documentId": {
"type": "string",
"description": "ID of the source document."
},
"documentName": {
"type": "string",
"description": "Filename of the source document."
},
"content": {
"type": "string",
"description": "The matched chunk content."
},
"chunkIndex": {
"type": "integer",
"description": "Index of the chunk within the document."
},
"metadata": {
"type": "object",
"description": "Tag metadata associated with the chunk (display names mapped to values)."
},
"similarity": {
"type": "number",
"minimum": 0,
"maximum": 1,
"description": "Similarity score (0-1, where 1 is most similar)."
}
}
},
"TagFilter": {
"type": "object",
"description": "A tag-based filter for knowledge base search.",
"required": ["tagName", "value"],
"properties": {
"tagName": {
"type": "string",
"description": "Display name of the tag to filter by."
},
"fieldType": {
"type": "string",
"enum": ["text", "number", "date", "boolean"],
"default": "text",
"description": "Data type of the tag field."
},
"operator": {
"type": "string",
"default": "eq",
"description": "Comparison operator (e.g. eq, neq, gt, lt, gte, lte, contains, between)."
},
"value": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
}
],
"description": "Value to filter by."
},
"valueTo": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
}
],
"description": "Upper bound value for 'between' operator."
}
}
}
},
"responses": {
"BadRequest": {
"description": "Invalid request parameters. Check the details array for specific validation errors.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Human-readable error message describing the validation failure."
},
"details": {
"type": "array",
"description": "List of specific validation errors with field-level details.",
"items": {
"type": "object"
}
}
}
}
}
}
},
"Unauthorized": {
"description": "Invalid or missing API key. Ensure the X-API-Key header is set with a valid key.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Human-readable error message."
}
}
}
}
}
},
"Forbidden": {
"description": "Access denied. You do not have permission to access this resource. For audit log endpoints, this requires an Enterprise subscription and organization admin/owner role.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Human-readable error message."
}
}
}
}
}
},
"NotFound": {
"description": "The requested resource was not found. Verify the ID is correct and belongs to your workspace.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Human-readable error message."
}
}
}
}
}
},
"RateLimited": {
"description": "Rate limit exceeded. Wait for the duration specified in the Retry-After header before retrying.",
"headers": {
"Retry-After": {
"description": "Number of seconds to wait before retrying the request.",
"schema": {
"type": "integer"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Human-readable error message with rate limit details."
}
}
}
}
}
},
"RowsUpdated": {
"description": "Rows updated.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "Indicates whether the request was successful."
},
"data": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "Confirmation message describing how many rows were updated."
},
"updatedCount": {
"type": "integer",
"description": "Number of rows that were updated."
},
"updatedRowIds": {
"type": "array",
"items": {
"type": "string"
},
"description": "Array of IDs for each row that was updated."
}
},
"description": "Response payload."
}
}
},
"example": {
"success": true,
"data": {
"message": "Rows updated successfully",
"updatedCount": 2,
"updatedRowIds": ["row_abc123", "row_def456"]
}
}
}
}
}
}
}
}