@motif-ai/sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,450 @@
1
+ // src/axios-instance.ts
2
+ import axios from "axios";
3
+ var MotifSDKError = class extends Error {
4
+ constructor(message, statusCode, response) {
5
+ super(message);
6
+ this.statusCode = statusCode;
7
+ this.response = response;
8
+ this.name = "MotifSDKError";
9
+ }
10
+ };
11
+ var config = null;
12
+ var configure = (options) => {
13
+ if (!options.apiKey) {
14
+ throw new Error("API key is required");
15
+ }
16
+ config = {
17
+ ...options,
18
+ baseURL: options.baseURL || "https://api.motifapp.ai/api",
19
+ timeout: options.timeout || 3e4
20
+ };
21
+ };
22
+ var customInstance = async (requestConfig) => {
23
+ if (!config) {
24
+ throw new MotifSDKError(
25
+ "Motif SDK not configured. Call configure() first with your API key."
26
+ );
27
+ }
28
+ const baseURL = config.baseURL;
29
+ let origin;
30
+ let basePath;
31
+ try {
32
+ const parsed = new URL(baseURL);
33
+ origin = parsed.origin;
34
+ basePath = parsed.pathname.replace(/\/+$/, "");
35
+ } catch {
36
+ origin = "";
37
+ basePath = baseURL.replace(/\/+$/, "");
38
+ }
39
+ if (basePath && requestConfig.url) {
40
+ requestConfig.url = `${basePath}${requestConfig.url}`;
41
+ }
42
+ const instance = axios.create({
43
+ baseURL: origin || void 0,
44
+ timeout: config.timeout,
45
+ headers: {
46
+ "Content-Type": "application/json",
47
+ "x-api-key": config.apiKey,
48
+ ...config.headers
49
+ }
50
+ });
51
+ instance.interceptors.request.use(
52
+ (request) => {
53
+ const isJsonContentType = request.headers?.["Content-Type"] === "application/json";
54
+ const isWriteMethod = ["POST", "PUT", "PATCH"].includes(
55
+ request.method?.toUpperCase() || ""
56
+ );
57
+ if (isJsonContentType && isWriteMethod && request.data === void 0) {
58
+ request.data = {};
59
+ }
60
+ return request;
61
+ },
62
+ (error) => {
63
+ return Promise.reject(error);
64
+ }
65
+ );
66
+ instance.interceptors.response.use(
67
+ (response) => {
68
+ return response;
69
+ },
70
+ (error) => {
71
+ if (error.response) {
72
+ const message = error.response.data?.message || error.message || "Request failed";
73
+ throw new MotifSDKError(
74
+ message,
75
+ error.response.status,
76
+ error.response.data
77
+ );
78
+ } else if (error.request) {
79
+ throw new MotifSDKError("No response received from server");
80
+ } else {
81
+ throw new MotifSDKError(error.message);
82
+ }
83
+ }
84
+ );
85
+ try {
86
+ const response = await instance.request(requestConfig);
87
+ return response.data;
88
+ } catch (error) {
89
+ if (error instanceof MotifSDKError) {
90
+ throw error;
91
+ }
92
+ throw new MotifSDKError(
93
+ error instanceof Error ? error.message : "Unknown error"
94
+ );
95
+ }
96
+ };
97
+
98
+ // src/generated/sdk/sdk.ts
99
+ var getSdk = () => {
100
+ const sdkUsersCreate = (sdkUsersCreateBody) => {
101
+ return customInstance({
102
+ url: `/v1/sdk/users`,
103
+ method: "POST",
104
+ headers: { "Content-Type": "application/json" },
105
+ data: sdkUsersCreateBody
106
+ });
107
+ };
108
+ const sdkUsersList = (params) => {
109
+ return customInstance({
110
+ url: `/v1/sdk/users`,
111
+ method: "GET",
112
+ params
113
+ });
114
+ };
115
+ const sdkUsersGet = (id) => {
116
+ return customInstance({
117
+ url: `/v1/sdk/users/${id}`,
118
+ method: "GET"
119
+ });
120
+ };
121
+ const sdkUsersUpdate = (id, sdkUsersUpdateBody) => {
122
+ return customInstance({
123
+ url: `/v1/sdk/users/${id}`,
124
+ method: "PATCH",
125
+ headers: { "Content-Type": "application/json" },
126
+ data: sdkUsersUpdateBody
127
+ });
128
+ };
129
+ const sdkUsersDelete = (id) => {
130
+ return customInstance({
131
+ url: `/v1/sdk/users/${id}`,
132
+ method: "DELETE"
133
+ });
134
+ };
135
+ const sdkUsersGetByExternalId = (externalId) => {
136
+ return customInstance({
137
+ url: `/v1/sdk/users/external/${externalId}`,
138
+ method: "GET"
139
+ });
140
+ };
141
+ const sdkProfileGetQuestions = (params) => {
142
+ return customInstance({
143
+ url: `/v1/sdk/profile/questions`,
144
+ method: "GET",
145
+ params
146
+ });
147
+ };
148
+ const sdkProfileSaveAnswer = (sdkProfileSaveAnswerBody) => {
149
+ return customInstance({
150
+ url: `/v1/sdk/profile/answers`,
151
+ method: "POST",
152
+ headers: { "Content-Type": "application/json" },
153
+ data: sdkProfileSaveAnswerBody
154
+ });
155
+ };
156
+ const sdkProfileGetAnswers = () => {
157
+ return customInstance({
158
+ url: `/v1/sdk/profile/answers`,
159
+ method: "GET"
160
+ });
161
+ };
162
+ const sdkProfileGetInvestorProfile = () => {
163
+ return customInstance({
164
+ url: `/v1/sdk/profile/investor-profile`,
165
+ method: "GET"
166
+ });
167
+ };
168
+ const sdkProfileComputeInvestorProfile = (sdkProfileComputeInvestorProfileBody) => {
169
+ return customInstance({
170
+ url: `/v1/sdk/profile/investor-profile/compute`,
171
+ method: "POST",
172
+ headers: { "Content-Type": "application/json" },
173
+ data: sdkProfileComputeInvestorProfileBody
174
+ });
175
+ };
176
+ const sdkProfileGetCompletion = (params) => {
177
+ return customInstance({
178
+ url: `/v1/sdk/profile/completion`,
179
+ method: "GET",
180
+ params
181
+ });
182
+ };
183
+ const sdkStrategiesGetRecommended = () => {
184
+ return customInstance({
185
+ url: `/v1/sdk/strategies/recommended`,
186
+ method: "GET"
187
+ });
188
+ };
189
+ const sdkStrategiesGenerate = (sdkStrategiesGenerateBody) => {
190
+ return customInstance({
191
+ url: `/v1/sdk/strategies/generate`,
192
+ method: "POST",
193
+ headers: { "Content-Type": "application/json" },
194
+ data: sdkStrategiesGenerateBody
195
+ });
196
+ };
197
+ return {
198
+ sdkUsersCreate,
199
+ sdkUsersList,
200
+ sdkUsersGet,
201
+ sdkUsersUpdate,
202
+ sdkUsersDelete,
203
+ sdkUsersGetByExternalId,
204
+ sdkProfileGetQuestions,
205
+ sdkProfileSaveAnswer,
206
+ sdkProfileGetAnswers,
207
+ sdkProfileGetInvestorProfile,
208
+ sdkProfileComputeInvestorProfile,
209
+ sdkProfileGetCompletion,
210
+ sdkStrategiesGetRecommended,
211
+ sdkStrategiesGenerate
212
+ };
213
+ };
214
+
215
+ // src/generated/models/adminApiKeysCreateBodyEnvironment.ts
216
+ var AdminApiKeysCreateBodyEnvironment = {
217
+ production: "production",
218
+ sandbox: "sandbox"
219
+ };
220
+
221
+ // src/generated/models/adminConfigUpdateInvestmentConfigBodyConfigDexRouteOrder.ts
222
+ var AdminConfigUpdateInvestmentConfigBodyConfigDexRouteOrder = {
223
+ CHEAPEST: "CHEAPEST",
224
+ FASTEST: "FASTEST",
225
+ SAFEST: "SAFEST"
226
+ };
227
+
228
+ // src/generated/models/adminConfigUpdateInvestmentConfigBodyConfigDexRouteSelectionHierarchyItem.ts
229
+ var AdminConfigUpdateInvestmentConfigBodyConfigDexRouteSelectionHierarchyItem = {
230
+ RECOMMENDED: "RECOMMENDED",
231
+ CHEAPEST: "CHEAPEST",
232
+ FASTEST: "FASTEST"
233
+ };
234
+
235
+ // src/generated/models/adminConfigUpdateTransactionConfigBodyConfigRouteSelectionHierarchyItem.ts
236
+ var AdminConfigUpdateTransactionConfigBodyConfigRouteSelectionHierarchyItem = {
237
+ RECOMMENDED: "RECOMMENDED",
238
+ CHEAPEST: "CHEAPEST",
239
+ FASTEST: "FASTEST"
240
+ };
241
+
242
+ // src/generated/models/adminOrganizationInviteOrgAdminBodyRole.ts
243
+ var AdminOrganizationInviteOrgAdminBodyRole = {
244
+ member: "member",
245
+ admin: "admin",
246
+ owner: "owner"
247
+ };
248
+
249
+ // src/generated/models/adminUserUpdateMemberRoleBodyRole.ts
250
+ var AdminUserUpdateMemberRoleBodyRole = {
251
+ member: "member",
252
+ admin: "admin",
253
+ owner: "owner"
254
+ };
255
+
256
+ // src/generated/models/marketDataGetLatestMarketDataProvider.ts
257
+ var MarketDataGetLatestMarketDataProvider = {
258
+ COINMARKETCAP: "COINMARKETCAP",
259
+ LIFI: "LIFI",
260
+ TIINGO: "TIINGO"
261
+ };
262
+
263
+ // src/generated/models/marketDataGetLatestMarketDataResolution.ts
264
+ var MarketDataGetLatestMarketDataResolution = {
265
+ AD_HOC: "AD_HOC",
266
+ FIVE_MIN: "FIVE_MIN",
267
+ FIFTEEN_MIN: "FIFTEEN_MIN",
268
+ ONE_HOUR: "ONE_HOUR",
269
+ ONE_DAY: "ONE_DAY"
270
+ };
271
+
272
+ // src/generated/models/sdkProfileGetAnswers200ItemTier.ts
273
+ var SdkProfileGetAnswers200ItemTier = {
274
+ Basic: "Basic",
275
+ Advanced: "Advanced",
276
+ KYC: "KYC"
277
+ };
278
+
279
+ // src/generated/models/sdkProfileGetCompletionTier.ts
280
+ var SdkProfileGetCompletionTier = {
281
+ Basic: "Basic",
282
+ Advanced: "Advanced",
283
+ KYC: "KYC"
284
+ };
285
+
286
+ // src/generated/models/sdkProfileGetQuestions200ItemAction.ts
287
+ var SdkProfileGetQuestions200ItemAction = {
288
+ SingleSelect: "SingleSelect",
289
+ MultiSelect: "MultiSelect",
290
+ Matrix: "Matrix",
291
+ NumberInput: "NumberInput",
292
+ PercentageSlider: "PercentageSlider"
293
+ };
294
+
295
+ // src/generated/models/sdkProfileGetQuestions200ItemType.ts
296
+ var SdkProfileGetQuestions200ItemType = {
297
+ Basic: "Basic",
298
+ Advanced: "Advanced",
299
+ KYC: "KYC"
300
+ };
301
+
302
+ // src/generated/models/sdkProfileGetQuestionsType.ts
303
+ var SdkProfileGetQuestionsType = {
304
+ Basic: "Basic",
305
+ Advanced: "Advanced",
306
+ KYC: "KYC"
307
+ };
308
+
309
+ // src/index.ts
310
+ function createClient(config2) {
311
+ configure(config2);
312
+ const sdk = getSdk();
313
+ return {
314
+ /**
315
+ * User management operations (organization-level)
316
+ *
317
+ * These operations require only an API key and operate at the
318
+ * organization level. Use these to manage end users within your organization.
319
+ */
320
+ users: {
321
+ /**
322
+ * Create a new end user in the organization
323
+ * @param data - User data (email, name, optional externalId)
324
+ */
325
+ create: sdk.sdkUsersCreate,
326
+ /**
327
+ * List all users in the organization with pagination
328
+ * @param params - Optional pagination params (limit, cursor)
329
+ */
330
+ list: sdk.sdkUsersList,
331
+ /**
332
+ * Get a user by their internal Motif ID
333
+ * @param id - User ID
334
+ */
335
+ get: sdk.sdkUsersGet,
336
+ /**
337
+ * Update user details
338
+ * @param id - User ID
339
+ * @param data - Updated user data
340
+ */
341
+ update: sdk.sdkUsersUpdate,
342
+ /**
343
+ * Delete a user permanently
344
+ * @param id - User ID
345
+ */
346
+ delete: sdk.sdkUsersDelete,
347
+ /**
348
+ * Get a user by their external ID (partner-defined identifier)
349
+ * @param externalId - External ID
350
+ */
351
+ getByExternalId: sdk.sdkUsersGetByExternalId
352
+ },
353
+ /**
354
+ * Create a user-specific client for profile and strategy operations
355
+ *
356
+ * These operations require both an API key and a user context (x-user-id header).
357
+ * Use this method to perform operations on behalf of a specific user.
358
+ *
359
+ * @param userId - The ID of the user to perform operations for
360
+ * @returns User-scoped client with profile and strategies namespaces
361
+ *
362
+ * @example
363
+ * ```typescript
364
+ * const userClient = client.forUser('user_123')
365
+ * const questions = await userClient.profile.getQuestions({ type: 'Basic' })
366
+ * ```
367
+ */
368
+ forUser: (userId) => {
369
+ configure({
370
+ ...config2,
371
+ headers: {
372
+ ...config2.headers,
373
+ "x-user-id": userId
374
+ }
375
+ });
376
+ const userSdk = getSdk();
377
+ return {
378
+ /**
379
+ * User profiling operations
380
+ *
381
+ * Manage investor profiling questionnaires and computed profiles.
382
+ */
383
+ profile: {
384
+ /**
385
+ * Get profiling questions for a specific tier
386
+ * @param params - Question type (Basic, Advanced, or KYC)
387
+ */
388
+ getQuestions: userSdk.sdkProfileGetQuestions,
389
+ /**
390
+ * Save an answer to a profiling question
391
+ * @param data - Question ID and answer
392
+ */
393
+ saveAnswer: userSdk.sdkProfileSaveAnswer,
394
+ /**
395
+ * Get all profiling answers for the user
396
+ */
397
+ getAnswers: userSdk.sdkProfileGetAnswers,
398
+ /**
399
+ * Get the computed investor profile
400
+ */
401
+ getInvestorProfile: userSdk.sdkProfileGetInvestorProfile,
402
+ /**
403
+ * Compute or refresh the investor profile based on current answers
404
+ * @param data - Optional parameters
405
+ */
406
+ computeInvestorProfile: userSdk.sdkProfileComputeInvestorProfile,
407
+ /**
408
+ * Get profiling completion status for a tier
409
+ * @param params - Tier to check (Basic, Advanced, or KYC)
410
+ */
411
+ getCompletion: userSdk.sdkProfileGetCompletion
412
+ },
413
+ /**
414
+ * Investment strategy operations
415
+ *
416
+ * Get personalized investment strategy recommendations.
417
+ */
418
+ strategies: {
419
+ /**
420
+ * Get the recommended investment strategy for the user
421
+ */
422
+ getRecommended: userSdk.sdkStrategiesGetRecommended,
423
+ /**
424
+ * Generate a new AI-powered investment strategy
425
+ * @param data - Optional generation parameters
426
+ */
427
+ generate: userSdk.sdkStrategiesGenerate
428
+ }
429
+ };
430
+ }
431
+ };
432
+ }
433
+ export {
434
+ AdminApiKeysCreateBodyEnvironment,
435
+ AdminConfigUpdateInvestmentConfigBodyConfigDexRouteOrder,
436
+ AdminConfigUpdateInvestmentConfigBodyConfigDexRouteSelectionHierarchyItem,
437
+ AdminConfigUpdateTransactionConfigBodyConfigRouteSelectionHierarchyItem,
438
+ AdminOrganizationInviteOrgAdminBodyRole,
439
+ AdminUserUpdateMemberRoleBodyRole,
440
+ MarketDataGetLatestMarketDataProvider,
441
+ MarketDataGetLatestMarketDataResolution,
442
+ MotifSDKError,
443
+ SdkProfileGetAnswers200ItemTier,
444
+ SdkProfileGetCompletionTier,
445
+ SdkProfileGetQuestions200ItemAction,
446
+ SdkProfileGetQuestions200ItemType,
447
+ SdkProfileGetQuestionsType,
448
+ createClient
449
+ };
450
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/axios-instance.ts","../src/generated/sdk/sdk.ts","../src/generated/models/adminApiKeysCreateBodyEnvironment.ts","../src/generated/models/adminConfigUpdateInvestmentConfigBodyConfigDexRouteOrder.ts","../src/generated/models/adminConfigUpdateInvestmentConfigBodyConfigDexRouteSelectionHierarchyItem.ts","../src/generated/models/adminConfigUpdateTransactionConfigBodyConfigRouteSelectionHierarchyItem.ts","../src/generated/models/adminOrganizationInviteOrgAdminBodyRole.ts","../src/generated/models/adminUserUpdateMemberRoleBodyRole.ts","../src/generated/models/marketDataGetLatestMarketDataProvider.ts","../src/generated/models/marketDataGetLatestMarketDataResolution.ts","../src/generated/models/sdkProfileGetAnswers200ItemTier.ts","../src/generated/models/sdkProfileGetCompletionTier.ts","../src/generated/models/sdkProfileGetQuestions200ItemAction.ts","../src/generated/models/sdkProfileGetQuestions200ItemType.ts","../src/generated/models/sdkProfileGetQuestionsType.ts","../src/index.ts"],"sourcesContent":["import axios, { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios'\n\n/**\n * SDK configuration options\n */\nexport interface MotifSDKConfig {\n /** API key for authentication */\n apiKey: string\n /** Base URL for the API (defaults to production) */\n baseURL?: string\n /** Request timeout in milliseconds (defaults to 30000) */\n timeout?: number\n /** Custom headers to include in all requests */\n headers?: Record<string, string>\n}\n\n/**\n * SDK error with additional context\n */\nexport class MotifSDKError extends Error {\n constructor(\n message: string,\n public readonly statusCode?: number,\n public readonly response?: unknown\n ) {\n super(message)\n this.name = 'MotifSDKError'\n }\n}\n\n// Internal configuration state\nlet config: MotifSDKConfig | null = null\n\n/**\n * Configure the Motif SDK\n *\n * @example\n * ```typescript\n * import { configure } from '@motif/sdk'\n *\n * configure({\n * apiKey: 'your_api_key_here',\n * baseURL: 'https://api.motifapp.ai/api', // optional\n * })\n * ```\n */\nexport const configure = (options: MotifSDKConfig): void => {\n if (!options.apiKey) {\n throw new Error('API key is required')\n }\n config = {\n ...options,\n baseURL: options.baseURL || 'https://api.motifapp.ai/api',\n timeout: options.timeout || 30000,\n }\n}\n\n/**\n * Get the current configuration\n */\nexport const getConfig = (): MotifSDKConfig | null => config\n\n/**\n * Check if the SDK is configured\n */\nexport const isConfigured = (): boolean => config !== null\n\n/**\n * Reset the SDK configuration (useful for testing)\n */\nexport const resetConfig = (): void => {\n config = null\n}\n\n/**\n * Custom axios instance for Orval-generated code\n * This function is called by all generated API methods\n */\nexport const customInstance = async <T>(\n requestConfig: AxiosRequestConfig\n): Promise<T> => {\n if (!config) {\n throw new MotifSDKError(\n 'Motif SDK not configured. Call configure() first with your API key.'\n )\n }\n\n // Extract origin and path from baseURL separately.\n // Axios ignores the path portion of baseURL when url starts with '/',\n // so we prepend the basePath to the request URL ourselves.\n const baseURL = config.baseURL!\n let origin: string\n let basePath: string\n try {\n const parsed = new URL(baseURL)\n origin = parsed.origin\n basePath = parsed.pathname.replace(/\\/+$/, '') // strip trailing slashes\n } catch {\n // If baseURL is not a full URL (e.g., '/api'), use it as basePath\n origin = ''\n basePath = baseURL.replace(/\\/+$/, '')\n }\n\n // Prepend basePath to the request URL if present\n if (basePath && requestConfig.url) {\n requestConfig.url = `${basePath}${requestConfig.url}`\n }\n\n const instance = axios.create({\n baseURL: origin || undefined,\n timeout: config.timeout,\n headers: {\n 'Content-Type': 'application/json',\n 'x-api-key': config.apiKey,\n ...config.headers,\n },\n })\n\n // Request interceptor for logging/debugging\n instance.interceptors.request.use(\n request => {\n // Handle POST/PUT/PATCH with Content-Type: application/json but no body\n // Server rejects empty body with json content-type, so send empty object\n const isJsonContentType =\n request.headers?.['Content-Type'] === 'application/json'\n const isWriteMethod = ['POST', 'PUT', 'PATCH'].includes(\n request.method?.toUpperCase() || ''\n )\n if (isJsonContentType && isWriteMethod && request.data === undefined) {\n request.data = {}\n }\n return request\n },\n error => {\n return Promise.reject(error)\n }\n )\n\n // Response interceptor for error handling\n instance.interceptors.response.use(\n (response: AxiosResponse) => {\n return response\n },\n (error: AxiosError) => {\n if (error.response) {\n // Server responded with error status\n const message =\n (error.response.data as { message?: string })?.message ||\n error.message ||\n 'Request failed'\n\n throw new MotifSDKError(\n message,\n error.response.status,\n error.response.data\n )\n } else if (error.request) {\n // Request was made but no response received\n throw new MotifSDKError('No response received from server')\n } else {\n // Error in request setup\n throw new MotifSDKError(error.message)\n }\n }\n )\n\n try {\n const response = await instance.request<T>(requestConfig)\n return response.data\n } catch (error) {\n if (error instanceof MotifSDKError) {\n throw error\n }\n throw new MotifSDKError(\n error instanceof Error ? error.message : 'Unknown error'\n )\n }\n}\n\nexport default customInstance\n","/**\n * Generated by orval v7.18.0 🍺\n * Do not edit manually.\n * Motif API\n * Motif API provides programmatic access to the Motif platform.\n\n## Authentication\n\nThis API supports two authentication methods:\n\n### API Key Authentication (for SDK/M2M)\nInclude your API key in the `x-api-key` header:\n```\nx-api-key: your_api_key_here\n```\n\n**Important:** API keys MUST be created via the Admin Panel (`POST /api/admin/api-keys`) to work with SDK endpoints.\nKeys created outside the admin panel will not be associated with an organization and will fail authentication.\n\nThe API key system uses a two-table architecture:\n- **Apikey** (Better Auth) - stores the key hash and rate limits\n- **OrganizationApiKey** (linking table) - associates keys with organizations\n\nOnly keys with both records will work with SDK endpoints (`/api/v1/sdk/*`).\n\n### Bearer Token Authentication (for user sessions)\nInclude your JWT token in the `Authorization` header:\n```\nAuthorization: Bearer your_jwt_token\n```\n\n## Rate Limits\n\nAPI requests are rate limited per organization. Contact support for higher limits.\n * OpenAPI spec version: 1.0.0\n */\nimport type {\n SdkProfileComputeInvestorProfile200,\n SdkProfileComputeInvestorProfileBody,\n SdkProfileGetAnswers200Item,\n SdkProfileGetCompletion200,\n SdkProfileGetCompletionParams,\n SdkProfileGetInvestorProfile200,\n SdkProfileGetQuestions200Item,\n SdkProfileGetQuestionsParams,\n SdkProfileSaveAnswer200,\n SdkProfileSaveAnswerBody,\n SdkStrategiesGenerate200,\n SdkStrategiesGenerateBody,\n SdkStrategiesGetRecommended200,\n SdkUsersCreate200,\n SdkUsersCreateBody,\n SdkUsersDelete200,\n SdkUsersGet200,\n SdkUsersGetByExternalId200,\n SdkUsersList200,\n SdkUsersListParams,\n SdkUsersUpdate200,\n SdkUsersUpdateBody,\n} from '.././models'\n\nimport { customInstance } from '../../axios-instance'\n\nexport const getSdk = () => {\n /**\n * Creates a new end user in the organization. SDK-created users are automatically email verified.\n * @summary Create user\n */\n const sdkUsersCreate = (sdkUsersCreateBody: SdkUsersCreateBody) => {\n return customInstance<SdkUsersCreate200>({\n url: `/v1/sdk/users`,\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n data: sdkUsersCreateBody,\n })\n }\n /**\n * Returns a paginated list of users in the organization. Use cursor for pagination.\n * @summary List users\n */\n const sdkUsersList = (params?: SdkUsersListParams) => {\n return customInstance<SdkUsersList200>({\n url: `/v1/sdk/users`,\n method: 'GET',\n params,\n })\n }\n /**\n * Returns a user by their internal Motif ID. User must belong to the organization.\n * @summary Get user by ID\n */\n const sdkUsersGet = (id: string) => {\n return customInstance<SdkUsersGet200>({\n url: `/v1/sdk/users/${id}`,\n method: 'GET',\n })\n }\n /**\n * Updates user details. User must belong to the organization.\n * @summary Update user\n */\n const sdkUsersUpdate = (\n id: string,\n sdkUsersUpdateBody: SdkUsersUpdateBody\n ) => {\n return customInstance<SdkUsersUpdate200>({\n url: `/v1/sdk/users/${id}`,\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json' },\n data: sdkUsersUpdateBody,\n })\n }\n /**\n * Permanently deletes a user. User must belong to the organization. This action cannot be undone.\n * @summary Delete user\n */\n const sdkUsersDelete = (id: string) => {\n return customInstance<SdkUsersDelete200>({\n url: `/v1/sdk/users/${id}`,\n method: 'DELETE',\n })\n }\n /**\n * Returns a user by their partner-defined external ID. User must belong to the organization.\n * @summary Get user by external ID\n */\n const sdkUsersGetByExternalId = (externalId: string) => {\n return customInstance<SdkUsersGetByExternalId200>({\n url: `/v1/sdk/users/external/${externalId}`,\n method: 'GET',\n })\n }\n /**\n * Returns profiling questions for the specified type (Basic, Advanced, or KYC). Requires x-user-id header.\n * @summary Get profiling questions\n */\n const sdkProfileGetQuestions = (params: SdkProfileGetQuestionsParams) => {\n return customInstance<SdkProfileGetQuestions200Item[]>({\n url: `/v1/sdk/profile/questions`,\n method: 'GET',\n params,\n })\n }\n /**\n * Saves an answer to a profiling question for the target user. Requires x-user-id header.\n * @summary Save profiling answer\n */\n const sdkProfileSaveAnswer = (\n sdkProfileSaveAnswerBody: SdkProfileSaveAnswerBody\n ) => {\n return customInstance<SdkProfileSaveAnswer200>({\n url: `/v1/sdk/profile/answers`,\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n data: sdkProfileSaveAnswerBody,\n })\n }\n /**\n * Returns all profiling answers for the target user. Requires x-user-id header.\n * @summary Get profiling answers\n */\n const sdkProfileGetAnswers = () => {\n return customInstance<SdkProfileGetAnswers200Item[]>({\n url: `/v1/sdk/profile/answers`,\n method: 'GET',\n })\n }\n /**\n * Returns the computed investor profile (spider chart, strength level, summary). Requires x-user-id header.\n * @summary Get investor profile\n */\n const sdkProfileGetInvestorProfile = () => {\n return customInstance<SdkProfileGetInvestorProfile200>({\n url: `/v1/sdk/profile/investor-profile`,\n method: 'GET',\n })\n }\n /**\n * Computes or refreshes the investor profile based on profiling answers. Requires x-user-id header.\n * @summary Compute investor profile\n */\n const sdkProfileComputeInvestorProfile = (\n sdkProfileComputeInvestorProfileBody?: SdkProfileComputeInvestorProfileBody\n ) => {\n return customInstance<SdkProfileComputeInvestorProfile200>({\n url: `/v1/sdk/profile/investor-profile/compute`,\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n data: sdkProfileComputeInvestorProfileBody,\n })\n }\n /**\n * Returns completion status for the specified profiling tier. Requires x-user-id header.\n * @summary Get profile completion status\n */\n const sdkProfileGetCompletion = (params: SdkProfileGetCompletionParams) => {\n return customInstance<SdkProfileGetCompletion200>({\n url: `/v1/sdk/profile/completion`,\n method: 'GET',\n params,\n })\n }\n /**\n * Returns the recommended investment strategy for the target user. If no strategy exists, one will be generated. Requires completed Basic profiling. Requires x-user-id header.\n * @summary Get recommended strategy\n */\n const sdkStrategiesGetRecommended = () => {\n return customInstance<SdkStrategiesGetRecommended200>({\n url: `/v1/sdk/strategies/recommended`,\n method: 'GET',\n })\n }\n /**\n * Generates a new personalized investment strategy using AI. Requires completed Basic profiling. This may take several seconds. Requires x-user-id header.\n * @summary Generate investment strategy\n */\n const sdkStrategiesGenerate = (\n sdkStrategiesGenerateBody?: SdkStrategiesGenerateBody\n ) => {\n return customInstance<SdkStrategiesGenerate200>({\n url: `/v1/sdk/strategies/generate`,\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n data: sdkStrategiesGenerateBody,\n })\n }\n return {\n sdkUsersCreate,\n sdkUsersList,\n sdkUsersGet,\n sdkUsersUpdate,\n sdkUsersDelete,\n sdkUsersGetByExternalId,\n sdkProfileGetQuestions,\n sdkProfileSaveAnswer,\n sdkProfileGetAnswers,\n sdkProfileGetInvestorProfile,\n sdkProfileComputeInvestorProfile,\n sdkProfileGetCompletion,\n sdkStrategiesGetRecommended,\n sdkStrategiesGenerate,\n }\n}\nexport type SdkUsersCreateResult = NonNullable<\n Awaited<ReturnType<ReturnType<typeof getSdk>['sdkUsersCreate']>>\n>\nexport type SdkUsersListResult = NonNullable<\n Awaited<ReturnType<ReturnType<typeof getSdk>['sdkUsersList']>>\n>\nexport type SdkUsersGetResult = NonNullable<\n Awaited<ReturnType<ReturnType<typeof getSdk>['sdkUsersGet']>>\n>\nexport type SdkUsersUpdateResult = NonNullable<\n Awaited<ReturnType<ReturnType<typeof getSdk>['sdkUsersUpdate']>>\n>\nexport type SdkUsersDeleteResult = NonNullable<\n Awaited<ReturnType<ReturnType<typeof getSdk>['sdkUsersDelete']>>\n>\nexport type SdkUsersGetByExternalIdResult = NonNullable<\n Awaited<ReturnType<ReturnType<typeof getSdk>['sdkUsersGetByExternalId']>>\n>\nexport type SdkProfileGetQuestionsResult = NonNullable<\n Awaited<ReturnType<ReturnType<typeof getSdk>['sdkProfileGetQuestions']>>\n>\nexport type SdkProfileSaveAnswerResult = NonNullable<\n Awaited<ReturnType<ReturnType<typeof getSdk>['sdkProfileSaveAnswer']>>\n>\nexport type SdkProfileGetAnswersResult = NonNullable<\n Awaited<ReturnType<ReturnType<typeof getSdk>['sdkProfileGetAnswers']>>\n>\nexport type SdkProfileGetInvestorProfileResult = NonNullable<\n Awaited<ReturnType<ReturnType<typeof getSdk>['sdkProfileGetInvestorProfile']>>\n>\nexport type SdkProfileComputeInvestorProfileResult = NonNullable<\n Awaited<\n ReturnType<ReturnType<typeof getSdk>['sdkProfileComputeInvestorProfile']>\n >\n>\nexport type SdkProfileGetCompletionResult = NonNullable<\n Awaited<ReturnType<ReturnType<typeof getSdk>['sdkProfileGetCompletion']>>\n>\nexport type SdkStrategiesGetRecommendedResult = NonNullable<\n Awaited<ReturnType<ReturnType<typeof getSdk>['sdkStrategiesGetRecommended']>>\n>\nexport type SdkStrategiesGenerateResult = NonNullable<\n Awaited<ReturnType<ReturnType<typeof getSdk>['sdkStrategiesGenerate']>>\n>\n","/**\n * Generated by orval v7.18.0 🍺\n * Do not edit manually.\n * Motif API\n * Motif API provides programmatic access to the Motif platform.\n\n## Authentication\n\nThis API supports two authentication methods:\n\n### API Key Authentication (for SDK/M2M)\nInclude your API key in the `x-api-key` header:\n```\nx-api-key: your_api_key_here\n```\n\n### Bearer Token Authentication (for user sessions)\nInclude your JWT token in the `Authorization` header:\n```\nAuthorization: Bearer your_jwt_token\n```\n\n## Rate Limits\n\nAPI requests are rate limited per organization. Contact support for higher limits.\n * OpenAPI spec version: 1.0.0\n */\n\nexport type AdminApiKeysCreateBodyEnvironment =\n (typeof AdminApiKeysCreateBodyEnvironment)[keyof typeof AdminApiKeysCreateBodyEnvironment]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const AdminApiKeysCreateBodyEnvironment = {\n production: 'production',\n sandbox: 'sandbox',\n} as const\n","/**\n * Generated by orval v7.18.0 🍺\n * Do not edit manually.\n * Motif API\n * Motif API provides programmatic access to the Motif platform.\n\n## Authentication\n\nThis API supports two authentication methods:\n\n### API Key Authentication (for SDK/M2M)\nInclude your API key in the `x-api-key` header:\n```\nx-api-key: your_api_key_here\n```\n\n### Bearer Token Authentication (for user sessions)\nInclude your JWT token in the `Authorization` header:\n```\nAuthorization: Bearer your_jwt_token\n```\n\n## Rate Limits\n\nAPI requests are rate limited per organization. Contact support for higher limits.\n * OpenAPI spec version: 1.0.0\n */\n\nexport type AdminConfigUpdateInvestmentConfigBodyConfigDexRouteOrder =\n (typeof AdminConfigUpdateInvestmentConfigBodyConfigDexRouteOrder)[keyof typeof AdminConfigUpdateInvestmentConfigBodyConfigDexRouteOrder]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const AdminConfigUpdateInvestmentConfigBodyConfigDexRouteOrder = {\n CHEAPEST: 'CHEAPEST',\n FASTEST: 'FASTEST',\n SAFEST: 'SAFEST',\n} as const\n","/**\n * Generated by orval v7.18.0 🍺\n * Do not edit manually.\n * Motif API\n * Motif API provides programmatic access to the Motif platform.\n\n## Authentication\n\nThis API supports two authentication methods:\n\n### API Key Authentication (for SDK/M2M)\nInclude your API key in the `x-api-key` header:\n```\nx-api-key: your_api_key_here\n```\n\n### Bearer Token Authentication (for user sessions)\nInclude your JWT token in the `Authorization` header:\n```\nAuthorization: Bearer your_jwt_token\n```\n\n## Rate Limits\n\nAPI requests are rate limited per organization. Contact support for higher limits.\n * OpenAPI spec version: 1.0.0\n */\n\nexport type AdminConfigUpdateInvestmentConfigBodyConfigDexRouteSelectionHierarchyItem =\n (typeof AdminConfigUpdateInvestmentConfigBodyConfigDexRouteSelectionHierarchyItem)[keyof typeof AdminConfigUpdateInvestmentConfigBodyConfigDexRouteSelectionHierarchyItem]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const AdminConfigUpdateInvestmentConfigBodyConfigDexRouteSelectionHierarchyItem =\n {\n RECOMMENDED: 'RECOMMENDED',\n CHEAPEST: 'CHEAPEST',\n FASTEST: 'FASTEST',\n } as const\n","/**\n * Generated by orval v7.18.0 🍺\n * Do not edit manually.\n * Motif API\n * Motif API provides programmatic access to the Motif platform.\n\n## Authentication\n\nThis API supports two authentication methods:\n\n### API Key Authentication (for SDK/M2M)\nInclude your API key in the `x-api-key` header:\n```\nx-api-key: your_api_key_here\n```\n\n### Bearer Token Authentication (for user sessions)\nInclude your JWT token in the `Authorization` header:\n```\nAuthorization: Bearer your_jwt_token\n```\n\n## Rate Limits\n\nAPI requests are rate limited per organization. Contact support for higher limits.\n * OpenAPI spec version: 1.0.0\n */\n\nexport type AdminConfigUpdateTransactionConfigBodyConfigRouteSelectionHierarchyItem =\n (typeof AdminConfigUpdateTransactionConfigBodyConfigRouteSelectionHierarchyItem)[keyof typeof AdminConfigUpdateTransactionConfigBodyConfigRouteSelectionHierarchyItem]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const AdminConfigUpdateTransactionConfigBodyConfigRouteSelectionHierarchyItem =\n {\n RECOMMENDED: 'RECOMMENDED',\n CHEAPEST: 'CHEAPEST',\n FASTEST: 'FASTEST',\n } as const\n","/**\n * Generated by orval v7.18.0 🍺\n * Do not edit manually.\n * Motif API\n * Motif API provides programmatic access to the Motif platform.\n\n## Authentication\n\nThis API supports two authentication methods:\n\n### API Key Authentication (for SDK/M2M)\nInclude your API key in the `x-api-key` header:\n```\nx-api-key: your_api_key_here\n```\n\n### Bearer Token Authentication (for user sessions)\nInclude your JWT token in the `Authorization` header:\n```\nAuthorization: Bearer your_jwt_token\n```\n\n## Rate Limits\n\nAPI requests are rate limited per organization. Contact support for higher limits.\n * OpenAPI spec version: 1.0.0\n */\n\nexport type AdminOrganizationInviteOrgAdminBodyRole =\n (typeof AdminOrganizationInviteOrgAdminBodyRole)[keyof typeof AdminOrganizationInviteOrgAdminBodyRole]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const AdminOrganizationInviteOrgAdminBodyRole = {\n member: 'member',\n admin: 'admin',\n owner: 'owner',\n} as const\n","/**\n * Generated by orval v7.18.0 🍺\n * Do not edit manually.\n * Motif API\n * Motif API provides programmatic access to the Motif platform.\n\n## Authentication\n\nThis API supports two authentication methods:\n\n### API Key Authentication (for SDK/M2M)\nInclude your API key in the `x-api-key` header:\n```\nx-api-key: your_api_key_here\n```\n\n### Bearer Token Authentication (for user sessions)\nInclude your JWT token in the `Authorization` header:\n```\nAuthorization: Bearer your_jwt_token\n```\n\n## Rate Limits\n\nAPI requests are rate limited per organization. Contact support for higher limits.\n * OpenAPI spec version: 1.0.0\n */\n\nexport type AdminUserUpdateMemberRoleBodyRole =\n (typeof AdminUserUpdateMemberRoleBodyRole)[keyof typeof AdminUserUpdateMemberRoleBodyRole]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const AdminUserUpdateMemberRoleBodyRole = {\n member: 'member',\n admin: 'admin',\n owner: 'owner',\n} as const\n","/**\n * Generated by orval v7.18.0 🍺\n * Do not edit manually.\n * Motif API\n * Motif API provides programmatic access to the Motif platform.\n\n## Authentication\n\nThis API supports two authentication methods:\n\n### API Key Authentication (for SDK/M2M)\nInclude your API key in the `x-api-key` header:\n```\nx-api-key: your_api_key_here\n```\n\n### Bearer Token Authentication (for user sessions)\nInclude your JWT token in the `Authorization` header:\n```\nAuthorization: Bearer your_jwt_token\n```\n\n## Rate Limits\n\nAPI requests are rate limited per organization. Contact support for higher limits.\n * OpenAPI spec version: 1.0.0\n */\n\nexport type MarketDataGetLatestMarketDataProvider =\n (typeof MarketDataGetLatestMarketDataProvider)[keyof typeof MarketDataGetLatestMarketDataProvider]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const MarketDataGetLatestMarketDataProvider = {\n COINMARKETCAP: 'COINMARKETCAP',\n LIFI: 'LIFI',\n TIINGO: 'TIINGO',\n} as const\n","/**\n * Generated by orval v7.18.0 🍺\n * Do not edit manually.\n * Motif API\n * Motif API provides programmatic access to the Motif platform.\n\n## Authentication\n\nThis API supports two authentication methods:\n\n### API Key Authentication (for SDK/M2M)\nInclude your API key in the `x-api-key` header:\n```\nx-api-key: your_api_key_here\n```\n\n### Bearer Token Authentication (for user sessions)\nInclude your JWT token in the `Authorization` header:\n```\nAuthorization: Bearer your_jwt_token\n```\n\n## Rate Limits\n\nAPI requests are rate limited per organization. Contact support for higher limits.\n * OpenAPI spec version: 1.0.0\n */\n\nexport type MarketDataGetLatestMarketDataResolution =\n (typeof MarketDataGetLatestMarketDataResolution)[keyof typeof MarketDataGetLatestMarketDataResolution]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const MarketDataGetLatestMarketDataResolution = {\n AD_HOC: 'AD_HOC',\n FIVE_MIN: 'FIVE_MIN',\n FIFTEEN_MIN: 'FIFTEEN_MIN',\n ONE_HOUR: 'ONE_HOUR',\n ONE_DAY: 'ONE_DAY',\n} as const\n","/**\n * Generated by orval v7.18.0 🍺\n * Do not edit manually.\n * Motif API\n * Motif API provides programmatic access to the Motif platform.\n\n## Authentication\n\nThis API supports two authentication methods:\n\n### API Key Authentication (for SDK/M2M)\nInclude your API key in the `x-api-key` header:\n```\nx-api-key: your_api_key_here\n```\n\n**Important:** API keys MUST be created via the Admin Panel (`POST /api/admin/api-keys`) to work with SDK endpoints.\nKeys created outside the admin panel will not be associated with an organization and will fail authentication.\n\nThe API key system uses a two-table architecture:\n- **Apikey** (Better Auth) - stores the key hash and rate limits\n- **OrganizationApiKey** (linking table) - associates keys with organizations\n\nOnly keys with both records will work with SDK endpoints (`/api/v1/sdk/*`).\n\n### Bearer Token Authentication (for user sessions)\nInclude your JWT token in the `Authorization` header:\n```\nAuthorization: Bearer your_jwt_token\n```\n\n## Rate Limits\n\nAPI requests are rate limited per organization. Contact support for higher limits.\n * OpenAPI spec version: 1.0.0\n */\n\nexport type SdkProfileGetAnswers200ItemTier =\n (typeof SdkProfileGetAnswers200ItemTier)[keyof typeof SdkProfileGetAnswers200ItemTier]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const SdkProfileGetAnswers200ItemTier = {\n Basic: 'Basic',\n Advanced: 'Advanced',\n KYC: 'KYC',\n} as const\n","/**\n * Generated by orval v7.18.0 🍺\n * Do not edit manually.\n * Motif API\n * Motif API provides programmatic access to the Motif platform.\n\n## Authentication\n\nThis API supports two authentication methods:\n\n### API Key Authentication (for SDK/M2M)\nInclude your API key in the `x-api-key` header:\n```\nx-api-key: your_api_key_here\n```\n\n**Important:** API keys MUST be created via the Admin Panel (`POST /api/admin/api-keys`) to work with SDK endpoints.\nKeys created outside the admin panel will not be associated with an organization and will fail authentication.\n\nThe API key system uses a two-table architecture:\n- **Apikey** (Better Auth) - stores the key hash and rate limits\n- **OrganizationApiKey** (linking table) - associates keys with organizations\n\nOnly keys with both records will work with SDK endpoints (`/api/v1/sdk/*`).\n\n### Bearer Token Authentication (for user sessions)\nInclude your JWT token in the `Authorization` header:\n```\nAuthorization: Bearer your_jwt_token\n```\n\n## Rate Limits\n\nAPI requests are rate limited per organization. Contact support for higher limits.\n * OpenAPI spec version: 1.0.0\n */\n\nexport type SdkProfileGetCompletionTier =\n (typeof SdkProfileGetCompletionTier)[keyof typeof SdkProfileGetCompletionTier]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const SdkProfileGetCompletionTier = {\n Basic: 'Basic',\n Advanced: 'Advanced',\n KYC: 'KYC',\n} as const\n","/**\n * Generated by orval v7.18.0 🍺\n * Do not edit manually.\n * Motif API\n * Motif API provides programmatic access to the Motif platform.\n\n## Authentication\n\nThis API supports two authentication methods:\n\n### API Key Authentication (for SDK/M2M)\nInclude your API key in the `x-api-key` header:\n```\nx-api-key: your_api_key_here\n```\n\n**Important:** API keys MUST be created via the Admin Panel (`POST /api/admin/api-keys`) to work with SDK endpoints.\nKeys created outside the admin panel will not be associated with an organization and will fail authentication.\n\nThe API key system uses a two-table architecture:\n- **Apikey** (Better Auth) - stores the key hash and rate limits\n- **OrganizationApiKey** (linking table) - associates keys with organizations\n\nOnly keys with both records will work with SDK endpoints (`/api/v1/sdk/*`).\n\n### Bearer Token Authentication (for user sessions)\nInclude your JWT token in the `Authorization` header:\n```\nAuthorization: Bearer your_jwt_token\n```\n\n## Rate Limits\n\nAPI requests are rate limited per organization. Contact support for higher limits.\n * OpenAPI spec version: 1.0.0\n */\n\nexport type SdkProfileGetQuestions200ItemAction =\n (typeof SdkProfileGetQuestions200ItemAction)[keyof typeof SdkProfileGetQuestions200ItemAction]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const SdkProfileGetQuestions200ItemAction = {\n SingleSelect: 'SingleSelect',\n MultiSelect: 'MultiSelect',\n Matrix: 'Matrix',\n NumberInput: 'NumberInput',\n PercentageSlider: 'PercentageSlider',\n} as const\n","/**\n * Generated by orval v7.18.0 🍺\n * Do not edit manually.\n * Motif API\n * Motif API provides programmatic access to the Motif platform.\n\n## Authentication\n\nThis API supports two authentication methods:\n\n### API Key Authentication (for SDK/M2M)\nInclude your API key in the `x-api-key` header:\n```\nx-api-key: your_api_key_here\n```\n\n**Important:** API keys MUST be created via the Admin Panel (`POST /api/admin/api-keys`) to work with SDK endpoints.\nKeys created outside the admin panel will not be associated with an organization and will fail authentication.\n\nThe API key system uses a two-table architecture:\n- **Apikey** (Better Auth) - stores the key hash and rate limits\n- **OrganizationApiKey** (linking table) - associates keys with organizations\n\nOnly keys with both records will work with SDK endpoints (`/api/v1/sdk/*`).\n\n### Bearer Token Authentication (for user sessions)\nInclude your JWT token in the `Authorization` header:\n```\nAuthorization: Bearer your_jwt_token\n```\n\n## Rate Limits\n\nAPI requests are rate limited per organization. Contact support for higher limits.\n * OpenAPI spec version: 1.0.0\n */\n\nexport type SdkProfileGetQuestions200ItemType =\n (typeof SdkProfileGetQuestions200ItemType)[keyof typeof SdkProfileGetQuestions200ItemType]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const SdkProfileGetQuestions200ItemType = {\n Basic: 'Basic',\n Advanced: 'Advanced',\n KYC: 'KYC',\n} as const\n","/**\n * Generated by orval v7.18.0 🍺\n * Do not edit manually.\n * Motif API\n * Motif API provides programmatic access to the Motif platform.\n\n## Authentication\n\nThis API supports two authentication methods:\n\n### API Key Authentication (for SDK/M2M)\nInclude your API key in the `x-api-key` header:\n```\nx-api-key: your_api_key_here\n```\n\n**Important:** API keys MUST be created via the Admin Panel (`POST /api/admin/api-keys`) to work with SDK endpoints.\nKeys created outside the admin panel will not be associated with an organization and will fail authentication.\n\nThe API key system uses a two-table architecture:\n- **Apikey** (Better Auth) - stores the key hash and rate limits\n- **OrganizationApiKey** (linking table) - associates keys with organizations\n\nOnly keys with both records will work with SDK endpoints (`/api/v1/sdk/*`).\n\n### Bearer Token Authentication (for user sessions)\nInclude your JWT token in the `Authorization` header:\n```\nAuthorization: Bearer your_jwt_token\n```\n\n## Rate Limits\n\nAPI requests are rate limited per organization. Contact support for higher limits.\n * OpenAPI spec version: 1.0.0\n */\n\nexport type SdkProfileGetQuestionsType =\n (typeof SdkProfileGetQuestionsType)[keyof typeof SdkProfileGetQuestionsType]\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const SdkProfileGetQuestionsType = {\n Basic: 'Basic',\n Advanced: 'Advanced',\n KYC: 'KYC',\n} as const\n","/**\n * Motif SDK - Official TypeScript client for B2B Partner API\n *\n * @example\n * ```typescript\n * import { createClient } from '@motif-ai/sdk'\n *\n * // Create client with API key\n * const client = createClient({\n * apiKey: process.env.MOTIF_API_KEY!,\n * })\n *\n * // User management (organization-level operations)\n * const user = await client.users.create({\n * email: 'user@example.com',\n * name: 'John Doe',\n * externalId: 'partner_user_123',\n * })\n *\n * // User-specific operations (profiling and strategies)\n * const userClient = client.forUser(user.id)\n * const questions = await userClient.profile.getQuestions({ type: 'Basic' })\n * const strategy = await userClient.strategies.getRecommended()\n * ```\n */\n\nimport {\n configure as configureAxios,\n type MotifSDKConfig,\n MotifSDKError,\n} from './axios-instance'\nimport { getSdk } from './generated/sdk/sdk'\n\n// Re-export error class and config type\nexport { MotifSDKError }\nexport type { MotifSDKConfig }\n\n// Re-export all generated model types\nexport * from './generated/models'\n\n/**\n * Create a Motif SDK client instance\n *\n * @param config - SDK configuration with API key and optional settings\n * @returns Client instance with structured API namespaces\n *\n * @example\n * ```typescript\n * const client = createClient({\n * apiKey: 'pk_...',\n * baseURL: 'https://api.motifapp.ai/api', // optional\n * })\n * ```\n */\nexport function createClient(config: MotifSDKConfig) {\n // Configure axios instance\n configureAxios(config)\n\n // Get SDK functions\n const sdk = getSdk()\n\n return {\n /**\n * User management operations (organization-level)\n *\n * These operations require only an API key and operate at the\n * organization level. Use these to manage end users within your organization.\n */\n users: {\n /**\n * Create a new end user in the organization\n * @param data - User data (email, name, optional externalId)\n */\n create: sdk.sdkUsersCreate,\n\n /**\n * List all users in the organization with pagination\n * @param params - Optional pagination params (limit, cursor)\n */\n list: sdk.sdkUsersList,\n\n /**\n * Get a user by their internal Motif ID\n * @param id - User ID\n */\n get: sdk.sdkUsersGet,\n\n /**\n * Update user details\n * @param id - User ID\n * @param data - Updated user data\n */\n update: sdk.sdkUsersUpdate,\n\n /**\n * Delete a user permanently\n * @param id - User ID\n */\n delete: sdk.sdkUsersDelete,\n\n /**\n * Get a user by their external ID (partner-defined identifier)\n * @param externalId - External ID\n */\n getByExternalId: sdk.sdkUsersGetByExternalId,\n },\n\n /**\n * Create a user-specific client for profile and strategy operations\n *\n * These operations require both an API key and a user context (x-user-id header).\n * Use this method to perform operations on behalf of a specific user.\n *\n * @param userId - The ID of the user to perform operations for\n * @returns User-scoped client with profile and strategies namespaces\n *\n * @example\n * ```typescript\n * const userClient = client.forUser('user_123')\n * const questions = await userClient.profile.getQuestions({ type: 'Basic' })\n * ```\n */\n forUser: (userId: string) => {\n // Reconfigure with x-user-id header\n configureAxios({\n ...config,\n headers: {\n ...config.headers,\n 'x-user-id': userId,\n },\n })\n\n // Get fresh SDK instance with new headers\n const userSdk = getSdk()\n\n return {\n /**\n * User profiling operations\n *\n * Manage investor profiling questionnaires and computed profiles.\n */\n profile: {\n /**\n * Get profiling questions for a specific tier\n * @param params - Question type (Basic, Advanced, or KYC)\n */\n getQuestions: userSdk.sdkProfileGetQuestions,\n\n /**\n * Save an answer to a profiling question\n * @param data - Question ID and answer\n */\n saveAnswer: userSdk.sdkProfileSaveAnswer,\n\n /**\n * Get all profiling answers for the user\n */\n getAnswers: userSdk.sdkProfileGetAnswers,\n\n /**\n * Get the computed investor profile\n */\n getInvestorProfile: userSdk.sdkProfileGetInvestorProfile,\n\n /**\n * Compute or refresh the investor profile based on current answers\n * @param data - Optional parameters\n */\n computeInvestorProfile: userSdk.sdkProfileComputeInvestorProfile,\n\n /**\n * Get profiling completion status for a tier\n * @param params - Tier to check (Basic, Advanced, or KYC)\n */\n getCompletion: userSdk.sdkProfileGetCompletion,\n },\n\n /**\n * Investment strategy operations\n *\n * Get personalized investment strategy recommendations.\n */\n strategies: {\n /**\n * Get the recommended investment strategy for the user\n */\n getRecommended: userSdk.sdkStrategiesGetRecommended,\n\n /**\n * Generate a new AI-powered investment strategy\n * @param data - Optional generation parameters\n */\n generate: userSdk.sdkStrategiesGenerate,\n },\n }\n },\n }\n}\n"],"mappings":";AAAA,OAAO,WAA8D;AAmB9D,IAAM,gBAAN,cAA4B,MAAM;AAAA,EACvC,YACE,SACgB,YACA,UAChB;AACA,UAAM,OAAO;AAHG;AACA;AAGhB,SAAK,OAAO;AAAA,EACd;AACF;AAGA,IAAI,SAAgC;AAe7B,IAAM,YAAY,CAAC,YAAkC;AAC1D,MAAI,CAAC,QAAQ,QAAQ;AACnB,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AACA,WAAS;AAAA,IACP,GAAG;AAAA,IACH,SAAS,QAAQ,WAAW;AAAA,IAC5B,SAAS,QAAQ,WAAW;AAAA,EAC9B;AACF;AAuBO,IAAM,iBAAiB,OAC5B,kBACe;AACf,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAKA,QAAM,UAAU,OAAO;AACvB,MAAI;AACJ,MAAI;AACJ,MAAI;AACF,UAAM,SAAS,IAAI,IAAI,OAAO;AAC9B,aAAS,OAAO;AAChB,eAAW,OAAO,SAAS,QAAQ,QAAQ,EAAE;AAAA,EAC/C,QAAQ;AAEN,aAAS;AACT,eAAW,QAAQ,QAAQ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AA;AAAA;AAAA,MAOT,QAAQ,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,MAMZ,QAAQ,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,MAMZ,iBAAiB,IAAI;AAAA,IACvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAiBA,SAAS,CAAC,WAAmB;AAE3B,gBAAe;AAAA,QACb,GAAGA;AAAA,QACH,SAAS;AAAA,UACP,GAAGA,QAAO;AAAA,UACV,aAAa;AAAA,QACf;AAAA,MACF,CAAC;AAGD,YAAM,UAAU,OAAO;AAEvB,aAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAML,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,UAKP,cAAc,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,UAMtB,YAAY,QAAQ;AAAA;AAAA;AAAA;AAAA,UAKpB,YAAY,QAAQ;AAAA;AAAA;AAAA;AAAA,UAKpB,oBAAoB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,UAM5B,wBAAwB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,UAMhC,eAAe,QAAQ;AAAA,QACzB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAOA,YAAY;AAAA;AAAA;AAAA;AAAA,UAIV,gBAAgB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,UAMxB,UAAU,QAAQ;AAAA,QACpB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":["config"]}
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@motif-ai/sdk",
3
+ "version": "0.1.0",
4
+ "description": "Official TypeScript SDK for the Motif API — user management, investor profiling, and investment strategies",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
19
+ }
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ "sideEffects": false,
27
+ "scripts": {
28
+ "generate": "orval",
29
+ "build": "pnpm generate && tsup",
30
+ "dev": "tsup --watch",
31
+ "typecheck": "tsc --noEmit",
32
+ "prepublishOnly": "pnpm build",
33
+ "check:exports": "attw --pack .",
34
+ "check:publish": "publint"
35
+ },
36
+ "dependencies": {
37
+ "axios": "^1.7.9"
38
+ },
39
+ "devDependencies": {
40
+ "@arethetypeswrong/cli": "^0.17.3",
41
+ "@motif-app/eslint-config": "workspace:*",
42
+ "@types/node": "^22.10.10",
43
+ "orval": "^7.4.0",
44
+ "publint": "^0.3.5",
45
+ "tsup": "^8.4.0",
46
+ "typescript": "^5.8.2"
47
+ },
48
+ "engines": {
49
+ "node": ">=18"
50
+ },
51
+ "publishConfig": {
52
+ "access": "public",
53
+ "registry": "https://registry.npmjs.org/"
54
+ },
55
+ "keywords": [
56
+ "motif",
57
+ "sdk",
58
+ "api",
59
+ "client",
60
+ "typescript",
61
+ "fintech",
62
+ "investment",
63
+ "profiling"
64
+ ],
65
+ "author": "Motif <hello@motifapp.ai>",
66
+ "license": "SEE LICENSE IN LICENSE"
67
+ }