@l7mp/tivadar-ai-api-sdk 0.1.2 → 0.1.3

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.
Files changed (32) hide show
  1. package/README.md +1213 -172
  2. package/dist/esm/models/OrganizationsOrganizationIdSttProvidersGet200ResponseInner.d.ts +6 -5
  3. package/dist/esm/models/OrganizationsOrganizationIdSttProvidersGet200ResponseInner.js +7 -6
  4. package/dist/esm/models/OrganizationsOrganizationIdSttProvidersGet200ResponseInnerModelsInner.d.ts +56 -0
  5. package/dist/esm/models/OrganizationsOrganizationIdSttProvidersGet200ResponseInnerModelsInner.js +49 -0
  6. package/dist/esm/models/OrganizationsOrganizationIdTtsProvidersGet200ResponseInner.d.ts +6 -6
  7. package/dist/esm/models/OrganizationsOrganizationIdTtsProvidersGet200ResponseInner.js +7 -7
  8. package/dist/esm/models/OrganizationsOrganizationIdTtsProvidersGet200ResponseInnerModelsInner.d.ts +51 -0
  9. package/dist/esm/models/OrganizationsOrganizationIdTtsProvidersGet200ResponseInnerModelsInner.js +48 -0
  10. package/dist/esm/models/OrganizationsOrganizationIdTtsProvidersGet200ResponseInnerModelsInnerVoicesInner.d.ts +50 -0
  11. package/dist/esm/models/OrganizationsOrganizationIdTtsProvidersGet200ResponseInnerModelsInnerVoicesInner.js +47 -0
  12. package/dist/esm/models/index.d.ts +3 -1
  13. package/dist/esm/models/index.js +3 -1
  14. package/dist/models/OrganizationsOrganizationIdSttProvidersGet200ResponseInner.d.ts +6 -5
  15. package/dist/models/OrganizationsOrganizationIdSttProvidersGet200ResponseInner.js +7 -6
  16. package/dist/models/OrganizationsOrganizationIdSttProvidersGet200ResponseInnerModelsInner.d.ts +56 -0
  17. package/dist/models/OrganizationsOrganizationIdSttProvidersGet200ResponseInnerModelsInner.js +56 -0
  18. package/dist/models/OrganizationsOrganizationIdTtsProvidersGet200ResponseInner.d.ts +6 -6
  19. package/dist/models/OrganizationsOrganizationIdTtsProvidersGet200ResponseInner.js +7 -7
  20. package/dist/models/OrganizationsOrganizationIdTtsProvidersGet200ResponseInnerModelsInner.d.ts +51 -0
  21. package/dist/models/OrganizationsOrganizationIdTtsProvidersGet200ResponseInnerModelsInner.js +55 -0
  22. package/dist/models/OrganizationsOrganizationIdTtsProvidersGet200ResponseInnerModelsInnerVoicesInner.d.ts +50 -0
  23. package/dist/models/OrganizationsOrganizationIdTtsProvidersGet200ResponseInnerModelsInnerVoicesInner.js +54 -0
  24. package/dist/models/index.d.ts +3 -1
  25. package/dist/models/index.js +3 -1
  26. package/package.json +1 -1
  27. package/src/models/OrganizationsOrganizationIdSttProvidersGet200ResponseInner.ts +19 -11
  28. package/src/models/OrganizationsOrganizationIdSttProvidersGet200ResponseInnerModelsInner.ts +97 -0
  29. package/src/models/OrganizationsOrganizationIdTtsProvidersGet200ResponseInner.ts +17 -17
  30. package/src/models/OrganizationsOrganizationIdTtsProvidersGet200ResponseInnerModelsInner.ts +97 -0
  31. package/src/models/OrganizationsOrganizationIdTtsProvidersGet200ResponseInnerModelsInnerVoicesInner.ts +89 -0
  32. package/src/models/index.ts +3 -1
package/README.md CHANGED
@@ -1,219 +1,1260 @@
1
- ## @l7mp/tivadar-api-sdk@1.0.0
1
+ # @l7mp/tivadar-ai-api-sdk
2
2
 
3
- This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
3
+ TypeScript/JavaScript SDK for the [Tivadar AI](https://tivadar.ai) Backend API. Provides a fully-typed, tree-shakeable client for managing Voice Agents, Chat Agents, RAG knowledge bases, SIP telephony, subscriptions, and more.
4
4
 
5
- Environment
6
- * Node.js
7
- * Webpack
8
- * Browserify
5
+ - **Package**: `@l7mp/tivadar-ai-api-sdk`
6
+ - **Version**: `0.1.3`
7
+ - **Requires**: Node.js ≥ 20, or any modern browser / edge runtime with native `fetch`
8
+ - **Formats**: CommonJS (`dist/index.js`) + ESM (`dist/esm/index.js`), with TypeScript declarations
9
9
 
10
- Language level
11
- * ES5 - you must have a Promises/A+ library installed
12
- * ES6
10
+ ---
13
11
 
14
- Module system
15
- * CommonJS
16
- * ES6 module system
12
+ ## Table of Contents
17
13
 
18
- It can be used in both TypeScript and JavaScript. In TypeScript, the definition will be automatically resolved via `package.json`. ([Reference](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html))
14
+ 1. [Installation](#installation)
15
+ 2. [Quick Start](#quick-start)
16
+ 3. [Authentication](#authentication)
17
+ 4. [Client Configuration](#client-configuration)
18
+ 5. [API Reference](#api-reference)
19
+ - [Voice Agents](#voice-agents)
20
+ - [Chat Agents](#chat-agents)
21
+ - [RAG (Retrieval-Augmented Generation)](#rag-retrieval-augmented-generation)
22
+ - [Calendar](#calendar)
23
+ - [Conversation History](#conversation-history)
24
+ - [Recordings](#recordings)
25
+ - [SIP / Telephony](#sip--telephony)
26
+ - [Organizations](#organizations)
27
+ - [Members](#members)
28
+ - [Invitations](#invitations)
29
+ - [Playground](#playground)
30
+ - [Providers](#providers)
31
+ - [Subscription](#subscription)
32
+ 6. [Type Reference](#type-reference)
33
+ 7. [Error Handling](#error-handling)
34
+ 8. [Advanced Usage](#advanced-usage)
35
+ 9. [Low-Level API Classes](#low-level-api-classes)
19
36
 
20
- ### Building
37
+ ---
21
38
 
22
- To build and compile the typescript sources to javascript use:
39
+ ## Installation
40
+
41
+ ```bash
42
+ npm install @l7mp/tivadar-ai-api-sdk
43
+ # or
44
+ yarn add @l7mp/tivadar-ai-api-sdk
45
+ # or
46
+ pnpm add @l7mp/tivadar-ai-api-sdk
47
+ ```
48
+
49
+ ---
50
+
51
+ ## Quick Start
52
+
53
+ ```typescript
54
+ import { Api } from '@l7mp/tivadar-ai-api-sdk';
55
+
56
+ const client = new Api({
57
+ baseUrl: 'https://api.tivadar.ai/api/v1',
58
+ options: {
59
+ token: 'your-jwt-token',
60
+ },
61
+ });
62
+
63
+ const ORG_ID = 'org_abc123';
64
+
65
+ // List all voice agents
66
+ const agents = await client.voiceAgents.list(ORG_ID);
67
+ // agents: VoiceAgentWithSipTrunks[]
68
+ for (const agent of agents) {
69
+ console.log(agent.id, agent.name);
70
+ }
71
+
72
+ // Create a voice agent
73
+ const newAgent = await client.voiceAgents.create(ORG_ID, {
74
+ name: 'Support Agent',
75
+ organization_id: ORG_ID,
76
+ instructions: 'You are a helpful customer support agent.',
77
+ greeting: 'Hello! How can I help you today?',
78
+ language: 'en-US',
79
+ stt_provider: 'deepgram',
80
+ stt_model: 'nova-2',
81
+ tts_provider: 'elevenlabs',
82
+ tts_voice: 'Rachel',
83
+ llm_agent: {
84
+ llmProviderName: 'openai/gpt-4o',
85
+ temperature: 0.7,
86
+ maxTokens: 1024,
87
+ },
88
+ });
89
+ console.log('Created:', newAgent.id);
90
+ ```
91
+
92
+ ### Base URL
93
+
94
+ All API endpoints are versioned under `/api/v1`. Set the `baseUrl` accordingly:
95
+
96
+ | Environment | Base URL |
97
+ |---|---|
98
+ | Local development | `http://localhost:3000/api/v1` |
99
+ | Production | `https://your-api-domain.com/api/v1` |
100
+
101
+ ---
102
+
103
+ ## Authentication
104
+
105
+ All organization-scoped endpoints require a JWT Bearer token. Pass it at construction time or update it dynamically.
106
+
107
+ ### At construction time
108
+
109
+ ```typescript
110
+ const client = new Api({
111
+ baseUrl: 'https://api.tivadar.ai/api/v1',
112
+ options: { token: 'eyJhbGci...' },
113
+ });
114
+ ```
115
+
116
+ ### Dynamically (e.g. after login or token refresh)
117
+
118
+ ```typescript
119
+ const client = new Api({ baseUrl: 'https://api.tivadar.ai/api/v1' });
120
+
121
+ // Set / update the Bearer token
122
+ client.setAccessToken('eyJhbGci...');
123
+
124
+ // Or set the full Authorization header value for non-Bearer schemes
125
+ client.setAuthorizationHeader('Basic dXNlcjpwYXNz');
126
+
127
+ // Inspect the current token
128
+ const token = client.getAccessToken(); // string | undefined
129
+
130
+ // Remove authorization entirely (e.g. on logout)
131
+ client.clearAuthorization();
132
+ ```
133
+
134
+ The auth state is **shared by reference** across all internal API instances. Calling `setAccessToken()` once immediately affects every subsequent request — no need to recreate the client.
135
+
136
+ ---
137
+
138
+ ## Client Configuration
139
+
140
+ ```typescript
141
+ export interface ApiClientConfig {
142
+ /** Base URL of the Tivadar AI backend including /api/v1 path. */
143
+ baseUrl: string;
144
+ options?: {
145
+ /** JWT Bearer token (without the "Bearer " prefix). */
146
+ token?: string;
147
+ };
148
+ }
149
+ ```
150
+
151
+ ### Abort / timeout
152
+
153
+ Every method accepts an optional `RequestInit` object as the last parameter. Use it to pass an `AbortSignal` for cancellation or timeouts:
154
+
155
+ ```typescript
156
+ // Abort on demand
157
+ const controller = new AbortController();
158
+ const agents = await client.voiceAgents.list(ORG_ID, {
159
+ signal: controller.signal,
160
+ });
161
+ controller.abort();
162
+
163
+ // Timeout after 10 seconds (Node.js 18+)
164
+ const agents = await client.voiceAgents.list(ORG_ID, {
165
+ signal: AbortSignal.timeout(10_000),
166
+ });
167
+ ```
168
+
169
+ ---
170
+
171
+ ## API Reference
172
+
173
+ Every method returns a **`Promise`** that resolves to the parsed response body. Methods return values directly — they are not wrapped in an envelope object.
174
+
175
+ ---
176
+
177
+ ### Voice Agents
178
+
179
+ Voice agents handle telephony and LiveKit-based real-time voice conversations.
180
+
181
+ #### `voiceAgents.list(organizationId, options?)`
182
+
183
+ Returns all voice agents for an organization, including any linked SIP trunk info.
184
+
185
+ ```typescript
186
+ const agents: VoiceAgentWithSipTrunks[] = await client.voiceAgents.list('org_abc123');
187
+ ```
188
+
189
+ #### `voiceAgents.listBasic(organizationId, options?)`
190
+
191
+ Returns a lightweight list (id + name only) — useful for dropdowns and selectors.
192
+
193
+ ```typescript
194
+ const basic = await client.voiceAgents.listBasic('org_abc123');
195
+ // OrganizationsOrganizationIdVoiceAgentsBasicGet200ResponseInner[]
196
+ for (const item of basic) {
197
+ console.log(item.id, item.name);
198
+ }
199
+ ```
200
+
201
+ #### `voiceAgents.get(organizationId, voiceAgentId, options?)`
202
+
203
+ Fetches a single voice agent by ID, including its linked `llm_agent` config.
204
+
205
+ ```typescript
206
+ const agent: VoiceAgent = await client.voiceAgents.get('org_abc123', 'va_xyz');
207
+ console.log(agent.llm_agent?.llmProviderName); // e.g. "openai/gpt-4o"
208
+ console.log(agent.language); // e.g. "en-US"
209
+ ```
210
+
211
+ #### `voiceAgents.create(organizationId, data, options?)`
212
+
213
+ Creates a new voice agent. Automatically provisions a linked LLM agent in the LangChain service.
214
+
215
+ ```typescript
216
+ const agent: VoiceAgent = await client.voiceAgents.create('org_abc123', {
217
+ name: 'Sales Bot',
218
+ organization_id: 'org_abc123',
219
+ instructions: 'You are a sales assistant for Acme Corp.',
220
+ greeting: 'Hi! Welcome to Acme. How can I assist you?',
221
+ language: 'en-US',
222
+ stt_provider: 'deepgram',
223
+ stt_model: 'nova-2',
224
+ tts_provider: 'elevenlabs',
225
+ tts_model: 'eleven_turbo_v2',
226
+ tts_voice: 'Rachel',
227
+ enable_recording: true,
228
+ llm_agent: {
229
+ llmProviderName: 'openai/gpt-4o-mini',
230
+ temperature: 0.5,
231
+ maxTokens: 512,
232
+ maxConversationTurns: 20,
233
+ ragConfigName: 'my-knowledge-base', // optional RAG integration
234
+ ragTopK: 5,
235
+ ragScoreThreshold: 0.7,
236
+ toolsConfig: [
237
+ { name: 'calendar', enabled: true },
238
+ ],
239
+ },
240
+ });
241
+ console.log('Created agent:', agent.id);
242
+ ```
243
+
244
+ #### `voiceAgents.update(organizationId, voiceAgentId, data, options?)`
245
+
246
+ Partially updates a voice agent. Only provide fields you want to change.
247
+
248
+ ```typescript
249
+ const updated: VoiceAgent = await client.voiceAgents.update(
250
+ 'org_abc123',
251
+ 'va_xyz',
252
+ {
253
+ name: 'Sales Bot v2',
254
+ instructions: 'Updated instructions...',
255
+ llm_agent: {
256
+ llmProviderName: 'openai/gpt-4o',
257
+ temperature: 0.3,
258
+ },
259
+ }
260
+ );
261
+ ```
262
+
263
+ #### `voiceAgents.delete(organizationId, voiceAgentId, options?)`
264
+
265
+ Deletes a voice agent and its linked LLM agent.
266
+
267
+ ```typescript
268
+ await client.voiceAgents.delete('org_abc123', 'va_xyz');
269
+ ```
270
+
271
+ ---
272
+
273
+ ### Chat Agents
274
+
275
+ Chat agents power chat widget integrations for web applications.
276
+
277
+ #### `chatAgents.list(organizationId, options?)`
278
+
279
+ ```typescript
280
+ const agents: ChatAgent[] = await client.chatAgents.list('org_abc123');
281
+ ```
282
+
283
+ #### `chatAgents.get(organizationId, chatAgentId, options?)`
284
+
285
+ ```typescript
286
+ const agent: ChatAgent = await client.chatAgents.get('org_abc123', 'ca_xyz');
287
+ console.log(agent.chat_api_key); // embed this key in your frontend widget
288
+ console.log(agent.allowed_domains); // domain allow-list
289
+ ```
290
+
291
+ #### `chatAgents.create(organizationId, data, options?)`
292
+
293
+ ```typescript
294
+ const agent: ChatAgent = await client.chatAgents.create('org_abc123', {
295
+ name: 'Website Assistant',
296
+ system_prompt: 'You are a helpful assistant for our website visitors.',
297
+ allowed_domains: ['example.com', 'www.example.com'],
298
+ rate_limit: 60, // requests per minute per session
299
+ widget_config: {
300
+ title: 'Chat with us',
301
+ placeholder: 'Type your message...',
302
+ welcome_message: 'Welcome! How can I help?',
303
+ theme: 'light', // 'light' | 'dark'
304
+ position: { side: 'right', alignment: 'bottom' },
305
+ },
306
+ llm_agent: {
307
+ llmProviderName: 'openai/gpt-4o-mini',
308
+ temperature: 0.7,
309
+ maxTokens: 1024,
310
+ ragConfigName: 'product-docs',
311
+ },
312
+ });
313
+ ```
314
+
315
+ #### `chatAgents.update(organizationId, chatAgentId, data, options?)`
316
+
317
+ ```typescript
318
+ await client.chatAgents.update('org_abc123', 'ca_xyz', {
319
+ system_prompt: 'Updated system prompt.',
320
+ rate_limit: 120,
321
+ });
322
+ ```
323
+
324
+ #### `chatAgents.delete(organizationId, chatAgentId, options?)`
325
+
326
+ ```typescript
327
+ await client.chatAgents.delete('org_abc123', 'ca_xyz');
328
+ ```
329
+
330
+ ---
331
+
332
+ ### RAG (Retrieval-Augmented Generation)
333
+
334
+ Manage knowledge bases (RAG configs) that can be attached to any agent via `llm_agent.ragConfigName`.
335
+
336
+ #### `rag.list(organizationId, options?)`
337
+
338
+ ```typescript
339
+ const configs: RagConfig[] = await client.rag.list('org_abc123');
340
+ for (const cfg of configs) {
341
+ console.log(cfg.name, cfg.vectorStoreType, cfg.embeddingProviderName);
342
+ }
343
+ ```
344
+
345
+ #### `rag.create(organizationId, data, options?)`
346
+
347
+ ```typescript
348
+ const config: RagConfig = await client.rag.create('org_abc123', {
349
+ name: 'product-docs',
350
+ embedding_provider_name: 'openai/text-embedding-3-small',
351
+ });
352
+ ```
353
+
354
+ #### `rag.delete(organizationId, ragConfigName, options?)`
355
+
356
+ ```typescript
357
+ await client.rag.delete('org_abc123', 'product-docs');
358
+ ```
359
+
360
+ #### `rag.documents.upload(organizationId, ragConfigName, file, sourceUrl?, metadata?, options?)`
361
+
362
+ Upload a document for indexing. Accepts a `File` (browser) or `Blob` (Node.js).
363
+
364
+ ```typescript
365
+ // Browser
366
+ const file = document.querySelector<HTMLInputElement>('#upload')!.files![0];
367
+ const doc: RagDocument = await client.rag.documents.upload(
368
+ 'org_abc123',
369
+ 'product-docs',
370
+ file
371
+ );
372
+
373
+ // With optional metadata
374
+ const doc = await client.rag.documents.upload(
375
+ 'org_abc123',
376
+ 'product-docs',
377
+ file,
378
+ undefined, // sourceUrl (optional external link)
379
+ JSON.stringify({ category: 'faq' }) // metadata (optional JSON string)
380
+ );
381
+
382
+ // Node.js
383
+ import { readFileSync } from 'fs';
384
+ const buffer = readFileSync('./manual.pdf');
385
+ const blob = new Blob([buffer], { type: 'application/pdf' });
386
+ const doc = await client.rag.documents.upload(
387
+ 'org_abc123',
388
+ 'product-docs',
389
+ blob as unknown as File
390
+ );
391
+ ```
392
+
393
+ #### `rag.documents.list(organizationId, ragConfigName, status?, options?)`
394
+
395
+ ```typescript
396
+ import {
397
+ OrganizationsOrganizationIdRagRagConfigNameDocumentsGetStatusEnum as DocStatus,
398
+ } from '@l7mp/tivadar-ai-api-sdk';
399
+
400
+ // All documents
401
+ const docs: RagDocumentList = await client.rag.documents.list(
402
+ 'org_abc123',
403
+ 'product-docs'
404
+ );
405
+
406
+ // Filter by processing status
407
+ const ready = await client.rag.documents.list(
408
+ 'org_abc123',
409
+ 'product-docs',
410
+ DocStatus.Completed
411
+ );
412
+ ```
413
+
414
+ #### `rag.documents.get(organizationId, ragConfigName, documentId, options?)`
415
+
416
+ ```typescript
417
+ const doc: RagDocument = await client.rag.documents.get(
418
+ 'org_abc123',
419
+ 'product-docs',
420
+ 'doc_abc'
421
+ );
422
+ console.log(doc.status); // 'pending' | 'processing' | 'completed' | 'failed'
423
+ ```
424
+
425
+ #### `rag.documents.replace(organizationId, ragConfigName, documentId, file, sourceUrl?, options?)`
426
+
427
+ Replace the contents of an existing document (re-processes and re-indexes).
428
+
429
+ ```typescript
430
+ await client.rag.documents.replace('org_abc123', 'product-docs', 'doc_abc', newFile);
431
+ ```
432
+
433
+ #### `rag.documents.delete(organizationId, ragConfigName, documentId, options?)`
434
+
435
+ ```typescript
436
+ await client.rag.documents.delete('org_abc123', 'product-docs', 'doc_abc');
437
+ ```
438
+
439
+ ---
440
+
441
+ ### Calendar
442
+
443
+ Manage calendars and events (used by voice agents for scheduling features).
444
+
445
+ #### `calendar.listCalendars(organizationId, options?)`
446
+
447
+ ```typescript
448
+ const response: CalendarListResponse = await client.calendar.listCalendars('org_abc123');
449
+ for (const cal of response.data ?? []) {
450
+ console.log(cal.id, cal.name);
451
+ }
452
+ ```
453
+
454
+ #### `calendar.listEvents(organizationId, start, end, calendarIds?, options?)`
455
+
456
+ ```typescript
457
+ const events = await client.calendar.listEvents(
458
+ 'org_abc123',
459
+ new Date('2025-01-01T00:00:00Z'),
460
+ new Date('2025-01-31T23:59:59Z'),
461
+ 'cal_1,cal_2' // optional: comma-separated calendar IDs to filter
462
+ );
463
+ ```
464
+
465
+ #### `calendar.getEvent(organizationId, eventId, options?)`
466
+
467
+ ```typescript
468
+ const event: CalendarEventResponse = await client.calendar.getEvent(
469
+ 'org_abc123',
470
+ 'evt_xyz'
471
+ );
472
+ console.log(event.name, event.start_time, event.end_time);
473
+ ```
474
+
475
+ #### `calendar.createEvent(organizationId, data, options?)`
476
+
477
+ ```typescript
478
+ const event = await client.calendar.createEvent('org_abc123', {
479
+ name: 'Team Standup',
480
+ description: 'Daily standup meeting',
481
+ start_time: new Date('2025-06-01T09:00:00Z'),
482
+ end_time: new Date('2025-06-01T09:30:00Z'),
483
+ calendar_id: 'cal_abc',
484
+ });
485
+ ```
486
+
487
+ #### `calendar.updateEvent(organizationId, eventId, data, options?)`
488
+
489
+ ```typescript
490
+ await client.calendar.updateEvent('org_abc123', 'evt_xyz', {
491
+ name: 'Updated Meeting Name',
492
+ end_time: new Date('2025-06-01T10:00:00Z'),
493
+ });
494
+ ```
495
+
496
+ #### `calendar.deleteEvent(organizationId, eventId, options?)`
497
+
498
+ ```typescript
499
+ await client.calendar.deleteEvent('org_abc123', 'evt_xyz');
500
+ ```
501
+
502
+ ---
503
+
504
+ ### Conversation History
505
+
506
+ Access conversation history stored by the LangChain service. History is read-only — no local DB.
507
+
508
+ #### `history.list(organizationId, options?)`
509
+
510
+ ```typescript
511
+ const result = await client.history.list('org_abc123');
512
+ // OrganizationsOrganizationIdConversationsGet200Response
513
+ for (const summary of result.conversations ?? []) {
514
+ console.log(summary.id, summary.createdAt);
515
+ }
516
+ ```
517
+
518
+ #### `history.get(organizationId, conversationId, options?)`
519
+
520
+ Returns the full conversation including all messages.
521
+
522
+ ```typescript
523
+ const convo: HistoryConversation = await client.history.get(
524
+ 'org_abc123',
525
+ 'session_xyz'
526
+ );
527
+
528
+ for (const msg of convo.messages ?? []) {
529
+ console.log(`[${msg.role}] ${msg.content}`);
530
+ }
531
+ ```
532
+
533
+ #### `history.delete(organizationId, conversationId, options?)`
534
+
535
+ ```typescript
536
+ await client.history.delete('org_abc123', 'session_xyz');
537
+ ```
538
+
539
+ ---
540
+
541
+ ### Recordings
542
+
543
+ Fetch presigned S3 URLs for call recordings. Requires the voice agent to have `enable_recording: true`.
544
+
545
+ #### `recordings.get(organizationId, conversationId, options?)`
546
+
547
+ ```typescript
548
+ const result: RecordingSignedUrl = await client.recordings.get(
549
+ 'org_abc123',
550
+ 'session_xyz'
551
+ );
552
+ console.log(result.url); // Presigned S3 URL — valid for a limited time
553
+ ```
554
+
555
+ ---
556
+
557
+ ### SIP / Telephony
558
+
559
+ Manage SIP trunks, dispatch rules, and phone numbers for inbound telephony routing.
560
+
561
+ #### `sip.listTrunks(organizationId, options?)`
562
+
563
+ ```typescript
564
+ const trunks: SipTrunkWithAgent[] = await client.sip.listTrunks('org_abc123');
565
+ for (const trunk of trunks) {
566
+ console.log(trunk.number, trunk.dispatch_id);
567
+ }
23
568
  ```
24
- npm install
25
- npm run build
569
+
570
+ #### `sip.createTrunk(organizationId, data, options?)`
571
+
572
+ ```typescript
573
+ const trunk: SipTrunk = await client.sip.createTrunk('org_abc123', {
574
+ number: '+15551234567',
575
+ });
26
576
  ```
27
577
 
28
- ### Publishing
578
+ #### `sip.deleteTrunk(organizationId, trunkId, options?)`
29
579
 
30
- First build the package then run `npm publish`
580
+ ```typescript
581
+ await client.sip.deleteTrunk('org_abc123', 'trunk_xyz');
582
+ ```
583
+
584
+ #### `sip.createDispatchRule(organizationId, data, options?)`
31
585
 
32
- ### Consuming
586
+ Create a SIP dispatch rule that routes inbound calls from a trunk to a voice agent.
33
587
 
34
- navigate to the folder of your consuming project and run one of the following commands.
588
+ ```typescript
589
+ const result = await client.sip.createDispatchRule('org_abc123', {
590
+ trunk_id: 'trunk_xyz',
591
+ agent_id: 'va_xyz',
592
+ });
593
+ ```
35
594
 
36
- _published:_
595
+ #### `sip.deleteDispatchRule(organizationId, dispatchId, options?)`
37
596
 
597
+ ```typescript
598
+ await client.sip.deleteDispatchRule('org_abc123', 'dispatch_xyz');
38
599
  ```
39
- npm install @l7mp/tivadar-api-sdk@1.0.0 --save
600
+
601
+ #### `sip.listPhoneNumbers(options?)`
602
+
603
+ List all available phone numbers (global, not organization-scoped).
604
+
605
+ ```typescript
606
+ const numbers: PhoneNumber[] = await client.sip.listPhoneNumbers();
40
607
  ```
41
608
 
42
- _unPublished (not recommended):_
609
+ ---
610
+
611
+ ### Organizations
612
+
613
+ #### `organizations.list(options?)`
43
614
 
615
+ List all organizations the authenticated user belongs to.
616
+
617
+ ```typescript
618
+ const orgs: Organization[] = await client.organizations.list();
619
+ for (const org of orgs) {
620
+ console.log(org.id, org.name);
621
+ }
622
+ ```
623
+
624
+ #### `organizations.create(data, options?)`
625
+
626
+ ```typescript
627
+ const org: Organization = await client.organizations.create({
628
+ name: 'My Company',
629
+ });
44
630
  ```
45
- npm install PATH_TO_GENERATED_PACKAGE --save
631
+
632
+ ---
633
+
634
+ ### Members
635
+
636
+ #### `members.list(organizationId, options?)`
637
+
638
+ ```typescript
639
+ const members: Member[] = await client.members.list('org_abc123');
640
+ for (const m of members) {
641
+ console.log(m.user_id, m.is_admin ? '[admin]' : '');
642
+ }
46
643
  ```
47
644
 
48
- ### API client
645
+ ---
49
646
 
50
- The SDK exports a convenience `Api` client with grouped methods for each domain. It handles auth headers and base URL for you.
647
+ ### Invitations
51
648
 
52
- ### Base URL and domains
649
+ #### `invitations.list(organizationId, options?)`
53
650
 
54
- All endpoints are under `/api/v1`.
651
+ ```typescript
652
+ const invites: InvitationResponse[] = await client.invitations.list('org_abc123');
653
+ ```
654
+
655
+ #### `invitations.create(organizationId, data, options?)`
55
656
 
56
- Available domains:
57
- - Local development: `http://localhost:3000/api/v1`
58
- - Hosted environments: use your assigned API domain with `/api/v1`
657
+ ```typescript
658
+ const invite: InvitationResponse = await client.invitations.create('org_abc123', {
659
+ email: 'newuser@example.com',
660
+ is_admin: false,
661
+ });
662
+ // Send invite.token to the user via email
663
+ ```
59
664
 
60
- ### Example: basic usage
665
+ #### `invitations.accept(data, options?)`
61
666
 
62
- ```ts
63
- import { Api } from "@l7mp/tivadar-api-sdk";
667
+ Accept an invitation token. This endpoint does **not** require authentication.
64
668
 
65
- const api = new Api({
66
- baseUrl: "http://localhost:3000/api/v1",
67
- options: { token: process.env.TIVADAR_API_TOKEN },
669
+ ```typescript
670
+ await client.invitations.accept({
671
+ token: 'invitation-token-from-email',
672
+ user_id: 'user_xyz',
68
673
  });
674
+ ```
675
+
676
+ ---
677
+
678
+ ### Playground
679
+
680
+ Generate a short-lived LiveKit sandbox token to test a voice agent interactively, without a real phone call.
681
+
682
+ #### `playground.sandboxToken(organizationId, voiceAgentId, options?)`
683
+
684
+ ```typescript
685
+ const result: SandboxToken = await client.playground.sandboxToken(
686
+ 'org_abc123',
687
+ 'va_xyz'
688
+ );
689
+ console.log(result.token); // LiveKit access token
690
+ console.log(result.serverUrl); // LiveKit server URL
691
+ // Use these to connect directly from the LiveKit SDK or Agents Playground
692
+ ```
693
+
694
+ ---
695
+
696
+ ### Providers
697
+
698
+ Discover which LLM, STT, TTS, and embedding providers are enabled for your organization.
699
+
700
+ #### `llmProviders.list(organizationId, options?)`
701
+
702
+ ```typescript
703
+ const providers = await client.llmProviders.list('org_abc123');
704
+ // OrganizationsOrganizationIdLlmProvidersGet200ResponseInner[]
705
+ // e.g. [{ name: 'openai/gpt-4o' }, { name: 'anthropic/claude-3-5-sonnet' }]
706
+ for (const p of providers) {
707
+ console.log(p.name);
708
+ }
709
+ ```
710
+
711
+ #### `sttProviders.list(organizationId, options?)`
712
+
713
+ ```typescript
714
+ const providers = await client.sttProviders.list('org_abc123');
715
+ // OrganizationsOrganizationIdSttProvidersGet200ResponseInner[]
716
+ for (const p of providers) {
717
+ console.log(p.name); // e.g. 'deepgram'
718
+ for (const model of p.models ?? []) {
719
+ console.log(' -', model.id); // e.g. 'nova-2'
720
+ }
721
+ }
722
+ ```
723
+
724
+ #### `ttsProviders.list(organizationId, options?)`
725
+
726
+ ```typescript
727
+ const providers = await client.ttsProviders.list('org_abc123');
728
+ // OrganizationsOrganizationIdTtsProvidersGet200ResponseInner[]
729
+ for (const p of providers) {
730
+ console.log(p.name); // e.g. 'elevenlabs'
731
+ for (const model of p.models ?? []) {
732
+ console.log(' model:', model.id);
733
+ for (const voice of model.voices ?? []) {
734
+ console.log(' voice:', voice.id, voice.name);
735
+ }
736
+ }
737
+ }
738
+ ```
739
+
740
+ #### `embeddingProviders.list(organizationId, options?)`
741
+
742
+ ```typescript
743
+ const providers = await client.embeddingProviders.list('org_abc123');
744
+ // e.g. [{ name: 'openai/text-embedding-3-small' }]
745
+ ```
746
+
747
+ ---
748
+
749
+ ### Subscription
750
+
751
+ Manage billing subscriptions via Stripe integration.
752
+
753
+ #### `subscription.getStatus(organizationId, options?)`
754
+
755
+ ```typescript
756
+ const status: SubscriptionStatus = await client.subscription.getStatus('org_abc123');
757
+
758
+ if (status.isActive) {
759
+ console.log('Plan:', status.plan?.name);
760
+ console.log('Status:', status.subscription?.status);
761
+ // 'active' | 'trialing' | 'past_due' | 'canceled' | 'paused'
762
+ }
763
+ ```
764
+
765
+ #### `subscription.getDetails(organizationId, options?)`
766
+
767
+ Returns full subscription details including plan features and limits.
768
+
769
+ ```typescript
770
+ const details: SubscriptionDetails = await client.subscription.getDetails('org_abc123');
771
+ ```
772
+
773
+ #### `subscription.createCheckout(organizationId, data, options?)`
774
+
775
+ Create a Stripe Checkout session to start or upgrade a subscription.
776
+
777
+ ```typescript
778
+ const session: CheckoutSessionResponse = await client.subscription.createCheckout(
779
+ 'org_abc123',
780
+ {
781
+ plan_slug: 'pro',
782
+ success_url: 'https://myapp.com/billing/success',
783
+ cancel_url: 'https://myapp.com/billing/cancel',
784
+ }
785
+ );
786
+ window.location.href = session.url; // redirect to Stripe Checkout
787
+ ```
788
+
789
+ #### `subscription.cancel(organizationId, data?, options?)`
790
+
791
+ ```typescript
792
+ // Cancel at the end of the current billing period (recommended)
793
+ await client.subscription.cancel('org_abc123', {
794
+ cancel_at_period_end: true,
795
+ });
796
+
797
+ // Cancel immediately
798
+ await client.subscription.cancel('org_abc123', {
799
+ cancel_at_period_end: false,
800
+ });
801
+ ```
802
+
803
+ #### `subscription.resume(organizationId, options?)`
804
+
805
+ Undo a scheduled cancellation (must call before the period ends).
806
+
807
+ ```typescript
808
+ await client.subscription.resume('org_abc123');
809
+ ```
810
+
811
+ #### `subscription.updatePlan(organizationId, data, options?)`
812
+
813
+ Upgrade or downgrade the subscription plan.
814
+
815
+ ```typescript
816
+ const result: UpdatePlanResponse = await client.subscription.updatePlan(
817
+ 'org_abc123',
818
+ { plan_slug: 'enterprise' }
819
+ );
820
+ ```
821
+
822
+ #### `subscription.pause(organizationId, data?, options?)`
823
+
824
+ ```typescript
825
+ await client.subscription.pause('org_abc123', {
826
+ resumes_at: '2025-09-01', // optional ISO date to auto-resume
827
+ });
828
+ ```
829
+
830
+ #### `subscription.unpause(organizationId, options?)`
831
+
832
+ ```typescript
833
+ await client.subscription.unpause('org_abc123');
834
+ ```
835
+
836
+ #### `subscription.billingPortal(organizationId, data, options?)`
837
+
838
+ Generate a Stripe Customer Portal session URL for self-service billing management.
69
839
 
70
- const { data: organizations } = await api.organizations.list();
71
- const organizationId = organizations[0]?.id;
840
+ ```typescript
841
+ const portal: BillingPortalResponse = await client.subscription.billingPortal(
842
+ 'org_abc123',
843
+ { return_url: 'https://myapp.com/settings' }
844
+ );
845
+ window.location.href = portal.url;
846
+ ```
847
+
848
+ #### `subscription.getCredits(organizationId, options?)`
849
+
850
+ ```typescript
851
+ const balance: CreditBalance = await client.subscription.getCredits('org_abc123');
852
+ console.log(balance.balance, balance.currency);
853
+ ```
854
+
855
+ #### `subscription.getTransactions(organizationId, creditType?, limit?, offset?, options?)`
856
+
857
+ ```typescript
858
+ const txns: CreditTransactionsResponse = await client.subscription.getTransactions(
859
+ 'org_abc123',
860
+ 'voice_minutes', // optional: filter by credit type
861
+ 20, // limit (default: 20)
862
+ 0 // offset for pagination
863
+ );
864
+ for (const tx of txns.data ?? []) {
865
+ console.log(tx.amount, tx.description, tx.createdAt);
866
+ }
867
+ ```
868
+
869
+ ---
870
+
871
+ ## Type Reference
872
+
873
+ All types are exported from the package root.
874
+
875
+ ```typescript
876
+ import type {
877
+ // Agents
878
+ VoiceAgent,
879
+ VoiceAgentCreate,
880
+ VoiceAgentUpdate,
881
+ VoiceAgentMetadata,
882
+ VoiceAgentWithSipTrunks,
883
+ ChatAgent,
884
+ ChatAgentCreate,
885
+ ChatAgentUpdate,
886
+
887
+ // LLM
888
+ LlmAgent,
889
+ LlmAgentInput,
890
+ LlmAgentUpdateInput,
891
+ ToolConfig,
892
+
893
+ // RAG
894
+ RagConfig,
895
+ RagConfigCreate,
896
+ RagDocument,
897
+ RagDocumentChunk,
898
+ RagDocumentList,
899
+ RagDocumentChunkList,
900
+
901
+ // Calendar
902
+ Calendar,
903
+ CalendarEvent,
904
+ CalendarEventCreate,
905
+ CalendarEventUpdate,
906
+ CalendarEventResponse,
907
+ CalendarListResponse,
908
+ CalendarWithAgent,
909
+
910
+ // History
911
+ HistoryConversation,
912
+ HistoryMessage,
913
+ HistorySummary,
914
+
915
+ // Recordings
916
+ RecordingSignedUrl,
917
+
918
+ // Organizations & Members
919
+ Organization,
920
+ OrganizationCreate,
921
+ OrganizationUpdate,
922
+ Member,
923
+
924
+ // Invitations
925
+ InvitationCreate,
926
+ InvitationAccept,
927
+ InvitationResponse,
928
+
929
+ // SIP / Telephony
930
+ SipTrunk,
931
+ SipTrunkCreate,
932
+ SipTrunkWithAgent,
933
+ DispatchRuleCreate,
934
+ PhoneNumber,
935
+
936
+ // Playground
937
+ SandboxToken,
938
+
939
+ // Widget (Chat)
940
+ WidgetConfig,
941
+ WidgetPosition,
942
+
943
+ // Subscription
944
+ SubscriptionStatus,
945
+ SubscriptionDetails,
946
+ CreateCheckoutSessionRequest,
947
+ CheckoutSessionResponse,
948
+ CancelSubscriptionRequest,
949
+ UpdatePlanRequest,
950
+ UpdatePlanResponse,
951
+ PauseSubscriptionRequest,
952
+ PauseSubscriptionResponse,
953
+ BillingPortalRequest,
954
+ BillingPortalResponse,
955
+ CreditBalance,
956
+ CreditTransaction,
957
+ CreditTransactionsResponse,
958
+ } from '@l7mp/tivadar-ai-api-sdk';
959
+ ```
960
+
961
+ ### Key type shapes
962
+
963
+ #### `VoiceAgentCreate`
964
+
965
+ ```typescript
966
+ interface VoiceAgentCreate {
967
+ name: string; // required
968
+ organization_id: string; // required
969
+ instructions?: string; // system prompt / persona instructions
970
+ greeting?: string; // first spoken utterance when a call connects
971
+ stt_provider?: string; // e.g. 'deepgram'
972
+ stt_model?: string; // e.g. 'nova-2'
973
+ tts_provider?: string; // e.g. 'elevenlabs'
974
+ tts_model?: string; // e.g. 'eleven_turbo_v2'
975
+ tts_voice?: string; // e.g. 'Rachel'
976
+ language?: string; // BCP-47 code for STT + TTS, e.g. 'en-US', 'hu-HU'
977
+ enable_recording?: boolean;
978
+ metadata?: VoiceAgentMetadata;
979
+ llm_agent?: LlmAgentInput;
980
+ }
981
+ ```
72
982
 
73
- if (organizationId) {
74
- const { data: agents } = await api.voiceAgents.list(organizationId);
75
- console.log(agents);
983
+ #### `VoiceAgentMetadata`
984
+
985
+ ```typescript
986
+ interface VoiceAgentMetadata {
987
+ allowedFunctions?: string[]; // names of callable functions / tools
988
+ rag_index?: string; // legacy: RAG index name
76
989
  }
77
990
  ```
78
991
 
79
- ### Example: direct API class usage
992
+ #### `LlmAgentInput`
993
+
994
+ ```typescript
995
+ interface LlmAgentInput {
996
+ llmProviderName: string; // required — e.g. 'openai/gpt-4o'
997
+ temperature?: number; // 0.0–2.0, controls randomness
998
+ maxTokens?: number; // maximum tokens per response
999
+ maxConversationTurns?: number; // max back-and-forth turns before ending
1000
+ ragConfigName?: string; // name of a RagConfig to attach
1001
+ ragTopK?: number; // top-K documents to retrieve from the RAG
1002
+ ragScoreThreshold?: number; // minimum similarity score (0.0–1.0)
1003
+ toolsConfig?: ToolConfig[]; // tool/function configurations
1004
+ rateLimit?: number; // max requests per minute
1005
+ allowedOrigins?: string[]; // CORS origins for the chat endpoint
1006
+ }
1007
+ ```
80
1008
 
81
- Generated API classes (e.g. `CalendarApi`, `VoiceAgentsApi`) accept the same `{ baseUrl, options }` pattern:
1009
+ #### `ToolConfig`
82
1010
 
83
- ```ts
84
- import { CalendarApi } from "@l7mp/tivadar-api-sdk";
1011
+ ```typescript
1012
+ interface ToolConfig {
1013
+ name: string; // tool identifier, e.g. 'calendar', 'weather'
1014
+ enabled: boolean;
1015
+ config?: Record<string, any>; // tool-specific configuration object
1016
+ }
1017
+ ```
85
1018
 
86
- const calendarApi = new CalendarApi({
87
- baseUrl: "http://localhost:3000/api/v1",
88
- options: { token: "jwt-token" },
1019
+ #### `ChatAgentCreate`
1020
+
1021
+ ```typescript
1022
+ interface ChatAgentCreate {
1023
+ name: string; // required
1024
+ system_prompt?: string; // persona / instructions for the chat agent
1025
+ allowed_domains?: string[]; // domains permitted to use the widget
1026
+ rate_limit?: number; // requests per minute per session
1027
+ widget_config?: WidgetConfig;
1028
+ llm_agent?: LlmAgentInput;
1029
+ }
1030
+ ```
1031
+
1032
+ #### `WidgetConfig`
1033
+
1034
+ ```typescript
1035
+ interface WidgetConfig {
1036
+ position?: WidgetPosition; // { side: 'right'|'left', alignment: 'bottom'|'top' }
1037
+ title?: string; // widget header title
1038
+ placeholder?: string; // input field placeholder
1039
+ theme?: 'light' | 'dark';
1040
+ welcome_message?: string; // greeting shown before the first message
1041
+ }
1042
+ ```
1043
+
1044
+ #### `RagConfig`
1045
+
1046
+ ```typescript
1047
+ interface RagConfig {
1048
+ name: string; // unique name used as ragConfigName in agents
1049
+ organization: string;
1050
+ vectorStoreType: string; // 'memory' | 'qdrant' | 'weaviate'
1051
+ vectorStoreUrl?: string; // required for qdrant/weaviate
1052
+ embeddingProviderName: string; // e.g. 'openai/text-embedding-3-small'
1053
+ chunkSize: number; // tokens per document chunk
1054
+ chunkOverlap: number; // token overlap between chunks
1055
+ maxFileSizeMb: number;
1056
+ processingTimeoutS: number;
1057
+ createdAt: Date;
1058
+ updatedAt: Date;
1059
+ }
1060
+ ```
1061
+
1062
+ #### `SubscriptionStatus`
1063
+
1064
+ ```typescript
1065
+ interface SubscriptionStatus {
1066
+ isActive: boolean; // true when status is 'active' or 'trialing'
1067
+ service?: SubscriptionStatusService;
1068
+ subscription?: SubscriptionStatusSubscription | null;
1069
+ plan?: SubscriptionStatusPlan | null;
1070
+ }
1071
+ ```
1072
+
1073
+ ---
1074
+
1075
+ ## Error Handling
1076
+
1077
+ The SDK throws typed errors for HTTP and network failures.
1078
+
1079
+ ```typescript
1080
+ import { ResponseError, FetchError } from '@l7mp/tivadar-ai-api-sdk';
1081
+
1082
+ async function safeGet(orgId: string, agentId: string) {
1083
+ try {
1084
+ return await client.voiceAgents.get(orgId, agentId);
1085
+ } catch (err) {
1086
+ if (err instanceof ResponseError) {
1087
+ // HTTP error (4xx / 5xx)
1088
+ console.error('HTTP', err.response.status);
1089
+
1090
+ const body = await err.response.json().catch(() => ({}));
1091
+ console.error('Message:', body.error || body.message);
1092
+
1093
+ switch (err.response.status) {
1094
+ case 401:
1095
+ // Token expired — refresh and retry
1096
+ client.setAccessToken(await refreshToken());
1097
+ return client.voiceAgents.get(orgId, agentId);
1098
+ case 403:
1099
+ throw new Error('Not authorized for this organization');
1100
+ case 404:
1101
+ return null; // resource not found
1102
+ default:
1103
+ throw err;
1104
+ }
1105
+ }
1106
+
1107
+ if (err instanceof FetchError) {
1108
+ // Network-level error (DNS, timeout, CORS, offline)
1109
+ console.error('Network error:', err.cause.message);
1110
+ throw err;
1111
+ }
1112
+
1113
+ throw err; // unexpected
1114
+ }
1115
+ }
1116
+ ```
1117
+
1118
+ ---
1119
+
1120
+ ## Advanced Usage
1121
+
1122
+ ### Middleware
1123
+
1124
+ The underlying `BaseAPI` supports pre/post/onError middleware for logging, retry logic, and header injection.
1125
+
1126
+ ```typescript
1127
+ import {
1128
+ Configuration,
1129
+ VoiceAgentsApi,
1130
+ type Middleware,
1131
+ } from '@l7mp/tivadar-ai-api-sdk';
1132
+
1133
+ const loggingMiddleware: Middleware = {
1134
+ pre: async (ctx) => {
1135
+ console.log(`→ ${ctx.init.method} ${ctx.url}`);
1136
+ return ctx; // must return { url, init }
1137
+ },
1138
+ post: async (ctx) => {
1139
+ console.log(`← ${ctx.response.status} ${ctx.url}`);
1140
+ return ctx.response;
1141
+ },
1142
+ onError: async (ctx) => {
1143
+ console.error(`✗ ${ctx.url}`, ctx.error);
1144
+ // return a fallback Response to recover, or undefined to propagate the error
1145
+ },
1146
+ };
1147
+
1148
+ const configuration = new Configuration({
1149
+ basePath: 'https://api.tivadar.ai/api/v1',
1150
+ accessToken: () => getTokenFromStore(), // called on every request
1151
+ middleware: [loggingMiddleware],
1152
+ });
1153
+
1154
+ const voiceAgentsApi = new VoiceAgentsApi(configuration);
1155
+ const agents = await voiceAgentsApi.organizationsOrganizationIdVoiceAgentsGet({
1156
+ organizationId: 'org_abc123',
1157
+ });
1158
+ ```
1159
+
1160
+ ### Retry middleware example
1161
+
1162
+ ```typescript
1163
+ const retryMiddleware: Middleware = {
1164
+ post: async (ctx) => {
1165
+ if (ctx.response.status === 429) {
1166
+ const retryAfter = parseInt(ctx.response.headers.get('Retry-After') ?? '1', 10);
1167
+ await new Promise(r => setTimeout(r, retryAfter * 1000));
1168
+ return fetch(ctx.url, ctx.init);
1169
+ }
1170
+ },
1171
+ };
1172
+ ```
1173
+
1174
+ ### Token refresh middleware example
1175
+
1176
+ ```typescript
1177
+ const authMiddleware: Middleware = {
1178
+ post: async (ctx) => {
1179
+ if (ctx.response.status === 401) {
1180
+ const newToken = await refreshAccessToken();
1181
+ client.setAccessToken(newToken);
1182
+ const retryInit = {
1183
+ ...ctx.init,
1184
+ headers: {
1185
+ ...ctx.init.headers as Record<string, string>,
1186
+ Authorization: `Bearer ${newToken}`,
1187
+ },
1188
+ };
1189
+ return fetch(ctx.url, retryInit);
1190
+ }
1191
+ },
1192
+ };
1193
+ ```
1194
+
1195
+ ### Custom `fetch` (testing / polyfills)
1196
+
1197
+ ```typescript
1198
+ import { Configuration, VoiceAgentsApi } from '@l7mp/tivadar-ai-api-sdk';
1199
+
1200
+ const config = new Configuration({
1201
+ basePath: 'https://api.tivadar.ai/api/v1',
1202
+ fetchApi: myCustomFetch, // any fetch-compatible implementation
89
1203
  });
90
1204
  ```
91
1205
 
92
- ### Example: update auth after login
1206
+ ---
1207
+
1208
+ ## Low-Level API Classes
1209
+
1210
+ The `Api` convenience client wraps these generated classes. Use them directly if you need full control over request construction or want to add per-instance middleware.
93
1211
 
94
- ```ts
95
- import { Api } from "@l7mp/tivadar-api-sdk";
1212
+ | Class | `Api` namespace |
1213
+ |---|---|
1214
+ | `VoiceAgentsApi` | `client.voiceAgents` |
1215
+ | `ChatAgentsApi` | `client.chatAgents` |
1216
+ | `CalendarApi` | `client.calendar` |
1217
+ | `HistoryApi` | `client.history` |
1218
+ | `RecordingsApi` | `client.recordings` |
1219
+ | `RAGApi` | `client.rag` |
1220
+ | `SIPApi` | `client.sip` |
1221
+ | `OrganizationsApi` | `client.organizations` |
1222
+ | `MembersApi` | `client.members` |
1223
+ | `InvitationsApi` | `client.invitations` |
1224
+ | `PlaygroundApi` | `client.playground` |
1225
+ | `LLMProvidersApi` | `client.llmProviders` |
1226
+ | `STTProvidersApi` | `client.sttProviders` |
1227
+ | `TTSProvidersApi` | `client.ttsProviders` |
1228
+ | `EmbeddingProvidersApi` | `client.embeddingProviders` |
1229
+ | `SubscriptionApi` | `client.subscription` |
96
1230
 
97
- const api = new Api({ baseUrl: "http://localhost:3000/api/v1" });
1231
+ All classes extend `BaseAPI` from `./runtime` and accept a `Configuration` instance.
1232
+
1233
+ ```typescript
1234
+ import { Configuration, VoiceAgentsApi } from '@l7mp/tivadar-ai-api-sdk';
1235
+
1236
+ const config = new Configuration({
1237
+ basePath: 'https://api.tivadar.ai/api/v1',
1238
+ accessToken: 'your-jwt-token',
1239
+ });
98
1240
 
99
- api.setAccessToken("jwt-token");
100
- const { data: orgs } = await api.organizations.list();
1241
+ const api = new VoiceAgentsApi(config);
1242
+
1243
+ // Low-level: returns ApiResponse<T> — call .value() to get the parsed body
1244
+ const raw = await api.organizationsOrganizationIdVoiceAgentsGetRaw({
1245
+ organizationId: 'org_abc123',
1246
+ });
1247
+ console.log(raw.raw.status); // HTTP status
1248
+ const agents = await raw.value(); // VoiceAgentWithSipTrunks[]
1249
+
1250
+ // Convenience: resolves directly to the parsed body
1251
+ const agents = await api.organizationsOrganizationIdVoiceAgentsGet({
1252
+ organizationId: 'org_abc123',
1253
+ });
101
1254
  ```
102
1255
 
103
- ### Documentation for API Endpoints
1256
+ ---
1257
+
1258
+ ## License
104
1259
 
105
- All URIs are relative to */api/v1*
106
-
107
- Class | Method | HTTP request | Description
108
- ------------ | ------------- | ------------- | -------------
109
- *AgentsApi* | [**organizationsOrganizationIdAgentsAgentIdDelete**](docs/AgentsApi.md#organizationsorganizationidagentsagentiddelete) | **DELETE** /organizations/{organizationId}/agents/{agentId} | Delete an agent
110
- *AgentsApi* | [**organizationsOrganizationIdAgentsAgentIdGet**](docs/AgentsApi.md#organizationsorganizationidagentsagentidget) | **GET** /organizations/{organizationId}/agents/{agentId} | Get an agent by ID
111
- *AgentsApi* | [**organizationsOrganizationIdAgentsAgentIdPut**](docs/AgentsApi.md#organizationsorganizationidagentsagentidput) | **PUT** /organizations/{organizationId}/agents/{agentId} | Update an agent
112
- *AgentsApi* | [**organizationsOrganizationIdAgentsBasicGet**](docs/AgentsApi.md#organizationsorganizationidagentsbasicget) | **GET** /organizations/{organizationId}/agents/basic | List basic agent info (id and name only)
113
- *AgentsApi* | [**organizationsOrganizationIdAgentsGet**](docs/AgentsApi.md#organizationsorganizationidagentsget) | **GET** /organizations/{organizationId}/agents | List all agents for an organization
114
- *AgentsApi* | [**organizationsOrganizationIdAgentsPost**](docs/AgentsApi.md#organizationsorganizationidagentspost) | **POST** /organizations/{organizationId}/agents | Create a new agent
115
- *CalendarApi* | [**organizationsOrganizationIdEventsEventIdDelete**](docs/CalendarApi.md#organizationsorganizationideventseventiddelete) | **DELETE** /organizations/{organizationId}/events/{eventId} | Delete a calendar event
116
- *CalendarApi* | [**organizationsOrganizationIdEventsEventIdPut**](docs/CalendarApi.md#organizationsorganizationideventseventidput) | **PUT** /organizations/{organizationId}/events/{eventId} | Update a calendar event
117
- *CalendarApi* | [**organizationsOrganizationIdEventsGet**](docs/CalendarApi.md#organizationsorganizationideventsget) | **GET** /organizations/{organizationId}/events | List calendar events within a date range
118
- *CalendarApi* | [**organizationsOrganizationIdEventsPost**](docs/CalendarApi.md#organizationsorganizationideventspost) | **POST** /organizations/{organizationId}/events | Create a new calendar event
119
- *HistoryApi* | [**conversationsConversationIdGet**](docs/HistoryApi.md#conversationsconversationidget) | **GET** /conversations/{conversationId} | Get a conversation by ID
120
- *HistoryApi* | [**organizationsOrganizationIdConversationsGet**](docs/HistoryApi.md#organizationsorganizationidconversationsget) | **GET** /organizations/{organizationId}/conversations | List all conversations for an organization
121
- *IntegrationsApi* | [**organizationsOrganizationIdAgentsAgentIdCalendarDelete**](docs/IntegrationsApi.md#organizationsorganizationidagentsagentidcalendardelete) | **DELETE** /organizations/{organizationId}/agents/{agentId}/calendar | Disable calendar integration for an agent
122
- *IntegrationsApi* | [**organizationsOrganizationIdAgentsAgentIdCalendarGet**](docs/IntegrationsApi.md#organizationsorganizationidagentsagentidcalendarget) | **GET** /organizations/{organizationId}/agents/{agentId}/calendar | Get calendar integration settings for an agent
123
- *IntegrationsApi* | [**organizationsOrganizationIdAgentsAgentIdCalendarPatch**](docs/IntegrationsApi.md#organizationsorganizationidagentsagentidcalendarpatch) | **PATCH** /organizations/{organizationId}/agents/{agentId}/calendar | Reset calendar integration token
124
- *IntegrationsApi* | [**organizationsOrganizationIdAgentsAgentIdCalendarPost**](docs/IntegrationsApi.md#organizationsorganizationidagentsagentidcalendarpost) | **POST** /organizations/{organizationId}/agents/{agentId}/calendar | Enable calendar integration for an agent
125
- *IntegrationsApi* | [**organizationsOrganizationIdAgentsAgentIdChatDelete**](docs/IntegrationsApi.md#organizationsorganizationidagentsagentidchatdelete) | **DELETE** /organizations/{organizationId}/agents/{agentId}/chat | Disable chat integration for an agent
126
- *IntegrationsApi* | [**organizationsOrganizationIdAgentsAgentIdChatGet**](docs/IntegrationsApi.md#organizationsorganizationidagentsagentidchatget) | **GET** /organizations/{organizationId}/agents/{agentId}/chat | Get chat integration settings for an agent
127
- *IntegrationsApi* | [**organizationsOrganizationIdAgentsAgentIdChatPost**](docs/IntegrationsApi.md#organizationsorganizationidagentsagentidchatpost) | **POST** /organizations/{organizationId}/agents/{agentId}/chat | Enable chat integration for an agent
128
- *IntegrationsApi* | [**organizationsOrganizationIdAgentsAgentIdChatPut**](docs/IntegrationsApi.md#organizationsorganizationidagentsagentidchatput) | **PUT** /organizations/{organizationId}/agents/{agentId}/chat | Update chat integration settings
129
- *InvitationsApi* | [**invitationsAcceptPost**](docs/InvitationsApi.md#invitationsacceptpost) | **POST** /invitations/accept | Accept an invitation
130
- *InvitationsApi* | [**organizationsOrganizationIdInvitationsGet**](docs/InvitationsApi.md#organizationsorganizationidinvitationsget) | **GET** /organizations/{organizationId}/invitations | List all invitations for an organization
131
- *InvitationsApi* | [**organizationsOrganizationIdInvitationsPost**](docs/InvitationsApi.md#organizationsorganizationidinvitationspost) | **POST** /organizations/{organizationId}/invitations | Create a new invitation
132
- *LibraryApi* | [**organizationsOrganizationIdContainersGet**](docs/LibraryApi.md#organizationsorganizationidcontainersget) | **GET** /organizations/{organizationId}/containers | List storage containers/blobs
133
- *LibraryApi* | [**organizationsOrganizationIdIndexesGet**](docs/LibraryApi.md#organizationsorganizationidindexesget) | **GET** /organizations/{organizationId}/indexes | List all indexers for an organization
134
- *LibraryApi* | [**organizationsOrganizationIdIndexesIndexNameDelete**](docs/LibraryApi.md#organizationsorganizationidindexesindexnamedelete) | **DELETE** /organizations/{organizationId}/indexes/{indexName} | Delete an indexer
135
- *LibraryApi* | [**organizationsOrganizationIdIndexesIndexNameRunPost**](docs/LibraryApi.md#organizationsorganizationidindexesindexnamerunpost) | **POST** /organizations/{organizationId}/indexes/{indexName}/run | Run an indexer
136
- *MembersApi* | [**organizationsOrganizationIdMembersGet**](docs/MembersApi.md#organizationsorganizationidmembersget) | **GET** /organizations/{organizationId}/members | List all members of an organization
137
- *OrganizationsApi* | [**organizationsGet**](docs/OrganizationsApi.md#organizationsget) | **GET** /organizations | List all organizations for the authenticated user
138
- *OrganizationsApi* | [**organizationsPost**](docs/OrganizationsApi.md#organizationspost) | **POST** /organizations | Create a new organization
139
- *PlaygroundApi* | [**organizationsOrganizationIdAgentsAgentIdSandboxTokenPost**](docs/PlaygroundApi.md#organizationsorganizationidagentsagentidsandboxtokenpost) | **POST** /organizations/{organizationId}/agents/{agentId}/sandbox-token | Get a sandbox token for agent testing
140
- *RAGApi* | [**organizationsOrganizationIdRagGet**](docs/RAGApi.md#organizationsorganizationidragget) | **GET** /organizations/{organizationId}/rag | List all RAG configurations for an organization
141
- *RAGApi* | [**organizationsOrganizationIdRagPost**](docs/RAGApi.md#organizationsorganizationidragpost) | **POST** /organizations/{organizationId}/rag | Create a new RAG configuration
142
- *RAGApi* | [**organizationsOrganizationIdRagRagConfigIdDelete**](docs/RAGApi.md#organizationsorganizationidragragconfigiddelete) | **DELETE** /organizations/{organizationId}/rag/{ragConfigId} | Delete a RAG configuration
143
- *RAGApi* | [**organizationsOrganizationIdRagRagConfigIdRunPost**](docs/RAGApi.md#organizationsorganizationidragragconfigidrunpost) | **POST** /organizations/{organizationId}/rag/{ragConfigId}/run | Run a RAG indexer
144
- *SIPApi* | [**organizationsOrganizationIdSipDispatchRulesDispatchIdDelete**](docs/SIPApi.md#organizationsorganizationidsipdispatchrulesdispatchiddelete) | **DELETE** /organizations/{organizationId}/sip/dispatch-rules/{dispatchId} | Delete a dispatch rule
145
- *SIPApi* | [**organizationsOrganizationIdSipDispatchRulesPost**](docs/SIPApi.md#organizationsorganizationidsipdispatchrulespost) | **POST** /organizations/{organizationId}/sip/dispatch-rules | Create a dispatch rule (assign agent to trunk)
146
- *SIPApi* | [**organizationsOrganizationIdSipTrunksGet**](docs/SIPApi.md#organizationsorganizationidsiptrunksget) | **GET** /organizations/{organizationId}/sip/trunks | List all SIP trunks for an organization
147
- *SIPApi* | [**organizationsOrganizationIdSipTrunksPost**](docs/SIPApi.md#organizationsorganizationidsiptrunkspost) | **POST** /organizations/{organizationId}/sip/trunks | Create a new SIP trunk
148
- *SIPApi* | [**organizationsOrganizationIdSipTrunksTrunkIdDelete**](docs/SIPApi.md#organizationsorganizationidsiptrunkstrunkiddelete) | **DELETE** /organizations/{organizationId}/sip/trunks/{trunkId} | Delete a SIP trunk
149
- *SIPApi* | [**phoneNumbersGet**](docs/SIPApi.md#phonenumbersget) | **GET** /phone-numbers | List available phone numbers (not assigned to any SIP trunk)
150
- *ServicesApi* | [**organizationsOrganizationIdServicesChatChatServiceIdDelete**](docs/ServicesApi.md#organizationsorganizationidserviceschatchatserviceiddelete) | **DELETE** /organizations/{organizationId}/services/chat/{chatServiceId} | Delete a chat service
151
- *ServicesApi* | [**organizationsOrganizationIdServicesChatChatServiceIdGet**](docs/ServicesApi.md#organizationsorganizationidserviceschatchatserviceidget) | **GET** /organizations/{organizationId}/services/chat/{chatServiceId} | Get a chat service by ID
152
- *ServicesApi* | [**organizationsOrganizationIdServicesChatChatServiceIdPut**](docs/ServicesApi.md#organizationsorganizationidserviceschatchatserviceidput) | **PUT** /organizations/{organizationId}/services/chat/{chatServiceId} | Update a chat service
153
- *ServicesApi* | [**organizationsOrganizationIdServicesChatGet**](docs/ServicesApi.md#organizationsorganizationidserviceschatget) | **GET** /organizations/{organizationId}/services/chat | List all chat services for an organization
154
- *ServicesApi* | [**organizationsOrganizationIdServicesChatPost**](docs/ServicesApi.md#organizationsorganizationidserviceschatpost) | **POST** /organizations/{organizationId}/services/chat | Create a new chat service
155
- *StorageApi* | [**containerUploadPost**](docs/StorageApi.md#containeruploadpost) | **POST** /container/upload | Upload files to storage
156
- *StorageApi* | [**organizationsOrganizationIdRecordingsConversationIdGet**](docs/StorageApi.md#organizationsorganizationidrecordingsconversationidget) | **GET** /organizations/{organizationId}/recordings/{conversationId} | Get a signed URL for a conversation recording
157
-
158
-
159
- ### Documentation For Models
160
-
161
- - [Agent](docs/Agent.md)
162
- - [AgentCalendar](docs/AgentCalendar.md)
163
- - [AgentCalendarCalendars](docs/AgentCalendarCalendars.md)
164
- - [AgentCreate](docs/AgentCreate.md)
165
- - [AgentMetadata](docs/AgentMetadata.md)
166
- - [AgentUpdate](docs/AgentUpdate.md)
167
- - [AgentWithSipTrunks](docs/AgentWithSipTrunks.md)
168
- - [AgentWithSipTrunksAllOfSipTrunks](docs/AgentWithSipTrunksAllOfSipTrunks.md)
169
- - [AzureIndexerResult](docs/AzureIndexerResult.md)
170
- - [AzureIndexerStatus](docs/AzureIndexerStatus.md)
171
- - [CalendarEvent](docs/CalendarEvent.md)
172
- - [CalendarEventCreate](docs/CalendarEventCreate.md)
173
- - [CalendarEventResponse](docs/CalendarEventResponse.md)
174
- - [CalendarIntegrationData](docs/CalendarIntegrationData.md)
175
- - [ChatIntegrationData](docs/ChatIntegrationData.md)
176
- - [ChatService](docs/ChatService.md)
177
- - [ChatServiceCreate](docs/ChatServiceCreate.md)
178
- - [Conversation](docs/Conversation.md)
179
- - [ConversationRow](docs/ConversationRow.md)
180
- - [ConversationRowAllOfAgents](docs/ConversationRowAllOfAgents.md)
181
- - [DispatchRuleCreate](docs/DispatchRuleCreate.md)
182
- - [IndexRunResult](docs/IndexRunResult.md)
183
- - [IndexSummary](docs/IndexSummary.md)
184
- - [Indexer](docs/Indexer.md)
185
- - [InvitationAccept](docs/InvitationAccept.md)
186
- - [InvitationCreate](docs/InvitationCreate.md)
187
- - [InvitationResponse](docs/InvitationResponse.md)
188
- - [Member](docs/Member.md)
189
- - [Organization](docs/Organization.md)
190
- - [OrganizationCreate](docs/OrganizationCreate.md)
191
- - [OrganizationData](docs/OrganizationData.md)
192
- - [OrganizationsOrganizationIdAgentsBasicGet200ResponseInner](docs/OrganizationsOrganizationIdAgentsBasicGet200ResponseInner.md)
193
- - [OrganizationsOrganizationIdIndexesIndexNameRunPost200Response](docs/OrganizationsOrganizationIdIndexesIndexNameRunPost200Response.md)
194
- - [OrganizationsOrganizationIdSipDispatchRulesPost200Response](docs/OrganizationsOrganizationIdSipDispatchRulesPost200Response.md)
195
- - [PhoneNumber](docs/PhoneNumber.md)
196
- - [RagConfig](docs/RagConfig.md)
197
- - [RagConfigCreate](docs/RagConfigCreate.md)
198
- - [RecordingSignedUrl](docs/RecordingSignedUrl.md)
199
- - [SandboxToken](docs/SandboxToken.md)
200
- - [SipTrunk](docs/SipTrunk.md)
201
- - [SipTrunkCreate](docs/SipTrunkCreate.md)
202
- - [SipTrunkWithAgent](docs/SipTrunkWithAgent.md)
203
- - [SipTrunkWithAgentAllOfAgents](docs/SipTrunkWithAgentAllOfAgents.md)
204
- - [StorageBlob](docs/StorageBlob.md)
205
- - [StorageBlobListResponse](docs/StorageBlobListResponse.md)
206
- - [UploadResult](docs/UploadResult.md)
207
- - [WidgetConfig](docs/WidgetConfig.md)
208
- - [WidgetPosition](docs/WidgetPosition.md)
209
-
210
-
211
- <a id="documentation-for-authorization"></a>
212
- ## Documentation For Authorization
213
-
214
-
215
- Authentication schemes defined for the API:
216
- <a id="bearerAuth"></a>
217
- ### bearerAuth
218
-
219
- - **Type**: Bearer authentication (JWT)
1260
+ See [LICENSE](./LICENSE) in this package.