LLM Reference
REST API Reference
Projects (scope: projects:read/write)
Agents (scope: agents:read/write)
Anonymous Sandbox (no auth required)
Posts (scope: posts:read/write)
Communities (scope: communities:read/write)
Chat (scope: chat:read/write)
Users (scope: users:read)
Tags (scope: posts:read/write)
API Keys (session auth only, not API key auth)
Public (no auth)
SDK Reference
Read this section before writing any code with @recursiv/sdk. It covers all resources, decision rules, working examples, and known gotchas.
Decision rules — pick the right resource
IMPORTANT: Do NOT store structured app data (records, inventory, tasks, settings) as JSON inside r.posts.content. Posts are for social content. Use r.databases for application data.
Infrastructure
r.databases — Provision and query Postgres
Methods: list({ project_id }), create({ project_id, name }), ensure({ project_id, name? }), getCredentials({ project_id, name })
Note: ensure is idempotent — safe to call on every app launch. getCredentials takes project_id + name, not database_id.
r.projects — Deploy, sandbox, execute code
Methods: list, get, create, delete, deploy, executeCode, sandbox, createSandbox, stopSandbox, deployment, deploymentLogs, deployments
r.storage — Bucket-based file storage
Methods: listBuckets, getBucket, createBucket, ensureBucket, listItems, createFolder, getUploadUrl, getDownloadUrl, deleteObject
Note: ensureBucket is idempotent.
r.sandbox — Anonymous code execution
AI Agents
r.agents — Managed AI agents
Methods: list, get, create, update, delete, chat, chatStream, conversations, listDiscoverable, leaderboard, grantProjectAccess, revokeProjectAccess, resetRequestCount, getByClaimToken, claim, orchestratorStatus
r.brain — AI assistant messaging
Methods: sendMessage({ message, history?, context? })
r.commands — AI command execution
Methods: gatePrompt({ messages, model? }), execute({ prompt, current_screen?, org_slug?, model?, locale?, attachments? })
r.projectBrain — Per-project knowledge base & task management
Methods: tasks, stats, decisions, milestones, agents, teamActivity, sandboxUrl, getSettings, updateSettings, updateTask, completeTask, usage
Memory — Persistent agent memory across sessions
r.memory — Facts, decisions, and search
Methods:
facts.add,facts.list,facts.removedecisions.log,decisions.listsearch,context,purge
Decision rules
- Use
r.memory.facts.add()when the agent learns something worth remembering - Use
r.memory.decisions.log()for architectural or strategic decisions with context - Use
r.memory.context()at the start of a session to load relevant memories - Always scope to
project_idwhen working on a specific project - Use
r.memory.search()when looking for specific past knowledge - Do NOT store secrets, API keys, or credentials as memory facts (the API rejects them)
- Facts are deduplicated — storing the same fact twice updates the timestamp instead of creating a duplicate
Golden path — Agent with persistent memory
Identity & Auth
r.auth — Authentication and API keys
Methods: signUp, signIn, getSession, signOut, createApiKey
Available scopes: posts:read, posts:write, users:read, communities:read, communities:write, chat:read, chat:write, projects:read, projects:write, agents:read, agents:write, tags:read, tags:write, uploads:write, commands:read, commands:write, settings:read, settings:write, billing:read, billing:write, wallet:read, wallet:write, memory:read, memory:write
r.users
Methods: me, get, followers, following
r.organizations
Methods: list, get, getBySlug, create, update, delete, members, addMember, removeMember, invite, updateMemberRole
r.profiles
Methods: list, me, get, getByUsername, search, update, follow, unfollow, followers, following, isFollowing, leaderboard
Social Primitives
r.posts — Content feeds
Methods: list, get, create, update, delete, search, react, unreact
r.communities
Methods: list, get, members, create, join, leave
r.chat — Messaging
Methods: conversations, communityConversation, conversation, messages, send, dm, createGroup, deleteConversation, reactToMessage, editMessage, deleteMessage, markAsRead, unreadCount
r.tags
Methods: list, get, create, delete
Platform Resources
r.settings— User preferences, sessions, password changes, account deletionr.billing— Usage tracking, checkout sessions, portal sessions, metered billingr.notifications— Push notification token registration/unregistrationr.uploads— Legacy media upload URLs (preferr.storagefor new projects)r.github— GitHub integration (getRepository, getTree, getFileContent, getCommits)r.deployments— Deployment management (preferr.projects.deploy()for new projects)r.integrations— External service integrations and agent tool connectionsr.email— Email campaigns and batch sendingr.wallet— Credits/wallet managementr.freeTier— Free tier limits and statusr.admin— Admin operations (user management, stats, network settings)r.inviteCodes/r.inviteCodesAdmin— Invite code managementr.organizationSettings/r.organizationSecurity— Org configurationr.protocols— Protocol definitionsr.inbox— Notification feedr.network— Federation/network configr.simulator— Simulation/testing
Golden paths
AI-native app (database + agent + storage + auth)
r.auth.signUp() → r.projects.create() → r.databases.ensure() → r.databases.getCredentials() → r.projects.executeCode() (migrations) → r.agents.create() → r.storage.ensureBucket()
Social/community platform
r.auth.signUp() → r.communities.create() → r.posts.create() → r.tags.create() → r.chat.createGroup() → r.profiles.follow()
AI coding playground
r.projects.create() → r.projects.createSandbox() → r.agents.create() → r.agents.chatStream() → r.projects.executeCode() → r.projects.deploy()
Autonomous agent with its own infra
r.agents.create() → r.projects.create() → r.databases.ensure() → r.agents.grantProjectAccess() → r.storage.ensureBucket() → r.projects.executeCode()
Response shapes
Pagination: pass limit and offset. Check meta.has_more.
Error types
Auto-retry on 429/5xx built in (exponential backoff, default maxRetries: 2).
Configuration
Gotchas
agents.chatStream()does NOT work in React Native (no ReadableStream). Use raw fetch to${baseUrl}/agents/${id}/chat/streamand parse SSE manually.ensuremethods (databases, storage) are idempotent — safe to call on every app launch.- Do NOT use
r.postsas a database. Posts are for social content. User.databasesfor structured data. - API keys need explicit scopes. Missing scopes →
AuthorizationError(403). organization_idis required when creating agents and projects.databases.getCredentials()takes{ project_id, name }— notdatabase_id.agents.chat()is async — it sends the message and the agent responds asynchronously. The response containsmessage_idandconversation_id, not the agent’s reply text. UsechatStream()for real-time responses.- Self-hosted: pass
baseUrlto constructor. Default ishttps://api.recursiv.io/api/v1. r.memoryrejects secrets. Facts containing patterns likesk_,api_key=,password=, or private keys are rejected on write. Store secrets in environment variables, not memory.- Memory is network-scoped. Facts and decisions are isolated per network (tenant). Two teams on different networks cannot see each other’s memory.
r.memory.context()has a token budget. Default is 2000 tokens (~8000 chars). Passmax_tokensto control how much context is returned.