{"name":"ChatStack CRM Agent API","version":"2.0.0","description":"Authenticated REST API for AI coding agents (Cursor, Claude Desktop). Read packs / Improve / build prompts, and write the same mutations as the portal (stories, plan, requirements, techspecs, design, lock/unlock). Mint a personal access token in Portal → Settings → API access. Auth is per-user PAT + membership checks — never the submit mega-key, never service role in MCP clients.","auth":{"type":"http","scheme":"bearer","header":"Authorization","headerExample":"Authorization: Bearer cst_…","mintTokenUrl":"https://www.portal.chatstack.app/settings/api-access"},"mcp":{"package":"@chatstack/mcp","transport":"stdio_or_hosted_streamable_http","note":"Portal hosted MCP is CRM tools only (CHATSTACK_MCP_TOOLSET=crm) and requires Bearer cst_…. Public interview MCP is a separate Cloud Run service (no PAT). Stdio default toolset is all for local convenience.","env":{"CHATSTACK_API_URL":"https://www.portal.chatstack.app","CHATSTACK_TOKEN":"<personal-access-token>","CHATSTACK_MCP_TOOLSET":"crm"}},"invariants":["Personal PATs never elevate CRM portal super-admins; owner + company membership only","Original quote versions (is_quote) are view-only","Improve and Build generation refuse quote versions; Build also requires is_locked on a working version","Artifact writes require an unlocked working version in the path","Create version inserts an empty unlocked shell — does not deep-copy artifacts"],"operations":{"read":[{"method":"GET","path":"/api/agent/me","description":"PAT whoami (profile_id) for Interview API identity mapping"},{"method":"GET","path":"/api/agent/projects","description":"List projects accessible to the token owner"},{"method":"GET","path":"/api/agent/projects/{projectId}","description":"Get one project (403 if no access)"},{"method":"GET","path":"/api/agent/projects/{projectId}/versions","description":"List versions for a project"},{"method":"GET","path":"/api/agent/projects/{projectId}/versions/{versionId}/pack","description":"Full PRD pack (stories, requirements, tech specs, estimate). Unlocked working versions include estimate_note (stale-estimate warning); locked/quote → estimate_note null."},{"method":"GET","path":"/api/agent/projects/{projectId}/versions/{versionId}/improve","description":"Improve outputs + agents[] catalog (available|in_development) + generation[agent_key] job status/phase (poll after async POST)"},{"method":"GET","path":"/api/agent/projects/{projectId}/versions/{versionId}/build-prompt","description":"Build prompt + optional generation job status/phase (poll after async POST)"}],"write":[{"method":"POST","path":"/api/agent/projects/{projectId}/versions/{versionId}/improve","description":"Start Improve agent (default async 202; poll GET ~5s up to minutes). Body { agent_key?, wait?, stream? }. stream/Accept SSE for progress. Only available agents; in_development → 400. Quote refused."},{"method":"POST","path":"/api/agent/projects/{projectId}/versions/{versionId}/build-prompt","description":"Start build prompt on Next.js (default async 202; must be locked working version; quote refused). Body { wait?, stream? }. Poll GET; jobs may take several minutes."},{"method":"POST","path":"/api/agent/projects/{projectId}/versions","description":"Create unlocked working version (empty plan; inherits interview_summary only)"},{"method":"POST","path":"/api/agent/projects/{projectId}/versions/{versionId}/lock","description":"Lock or re-lock (pack snapshot + headless estimate)"},{"method":"POST","path":"/api/agent/projects/{projectId}/versions/{versionId}/unlock","description":"Unlock; keeps pack_json and estimate_json"},{"method":"GET|POST","path":"/api/agent/projects/{projectId}/versions/{versionId}/stories","description":"List / create user stories (create requires unlocked version)"},{"method":"PATCH|DELETE","path":"/api/agent/projects/{projectId}/versions/{versionId}/stories/{storyId}","description":"Update / delete story (refuses done-on-locked stories)"},{"method":"POST","path":"/api/agent/projects/{projectId}/versions/{versionId}/stories/reorder","description":"Body { ordered_ids: uuid[] } → display_order"},{"method":"GET|POST","path":"/api/agent/projects/{projectId}/versions/{versionId}/stories/{storyId}/acceptance-criteria","description":"List / create acceptance criteria"},{"method":"PATCH|DELETE","path":"/api/agent/projects/{projectId}/versions/{versionId}/stories/{storyId}/acceptance-criteria/{acId}","description":"Update / delete acceptance criterion"},{"method":"GET","path":"/api/agent/projects/{projectId}/versions/{versionId}/plan","description":"List Doing story IDs for the version"},{"method":"POST|DELETE","path":"/api/agent/projects/{projectId}/versions/{versionId}/plan/stories/{storyId}","description":"Add to Doing / move to Backlog (finalized required for Doing)"},{"method":"GET|POST","path":"/api/agent/projects/{projectId}/versions/{versionId}/requirements","description":"List / create requirements (?kind=functional|non_functional)"},{"method":"PATCH|DELETE","path":"/api/agent/projects/{projectId}/versions/{versionId}/requirements/{requirementId}","description":"Update / delete requirement"},{"method":"POST","path":"/api/agent/projects/{projectId}/versions/{versionId}/requirements/reorder","description":"Body { ordered_ids }"},{"method":"GET|POST","path":"/api/agent/projects/{projectId}/versions/{versionId}/requirement-assumptions","description":"List / create requirement assumptions"},{"method":"PATCH|DELETE","path":"/api/agent/projects/{projectId}/versions/{versionId}/requirement-assumptions/{assumptionId}","description":"Update / delete requirement assumption"},{"method":"GET|POST","path":"/api/agent/projects/{projectId}/versions/{versionId}/techspecs","description":"List / create technical specifications"},{"method":"PATCH|DELETE","path":"/api/agent/projects/{projectId}/versions/{versionId}/techspecs/{techspecId}","description":"Update / delete tech spec"},{"method":"POST","path":"/api/agent/projects/{projectId}/versions/{versionId}/techspecs/reorder","description":"Body { ordered_ids }"},{"method":"GET|POST","path":"/api/agent/projects/{projectId}/versions/{versionId}/techspec-assumptions","description":"List / create techspec assumptions"},{"method":"PATCH|DELETE","path":"/api/agent/projects/{projectId}/versions/{versionId}/techspec-assumptions/{assumptionId}","description":"Update / delete techspec assumption"},{"method":"GET|PUT","path":"/api/agent/projects/{projectId}/versions/{versionId}/design","description":"Get / upsert design preferences"}]},"updatedAt":"2026-09-15T18:02:48.082Z"}