For the complete documentation index, see llms.txt. This page is also available as Markdown.

SDK

The TypeScript SDK client surface.

@motif-ai/sdk is the server-side TypeScript client for Motif. One createClient() exposes every capability (users, profiling, strategies, questionnaires, partner portfolios, and Clarity), authenticated with a single API key.

npm install @motif-ai/sdk
import { createClient } from '@motif-ai/sdk'

const motif = createClient({
  apiKey: process.env.MOTIF_API_KEY!,
  // baseURL defaults to https://api.motifapp.ai/api
})

Client surface

Organization-scoped namespaces authenticate with the API key alone:

Namespace
Methods
Used for

motif.users

create, get, getByExternalId, list, update, delete

Manage end users

motif.questionnaires

create

Create questionnaire sessions

motif.partnerPortfolios

create, get, update, delete, recordTrades

motif.clarity

card, chat, createEmbed, sourceDocuments

User-scoped operations go through motif.forUser(userId), which adds the x-user-id header:

Namespace
Methods
Used for

forUser(id).profile

getQuestions, saveAnswer, getAnswers, getInvestorProfile, computeInvestorProfile, getCompletion

forUser(id).strategies

getRecommended, generate


Errors

Every failure throws MotifSDKError with a message, statusCode, and response. See Error handling.


See also

Last updated