retell-sdk 2.2.1 → 2.2.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 (71) hide show
  1. package/README.md +3 -433
  2. package/example.d.ts +2 -0
  3. package/example.d.ts.map +1 -0
  4. package/example.js +96 -0
  5. package/example.js.map +1 -0
  6. package/models/components/agent.d.ts +193 -24
  7. package/models/components/agent.d.ts.map +1 -1
  8. package/models/components/agent.js +189 -27
  9. package/models/components/agent.js.map +1 -1
  10. package/models/components/index.d.ts +0 -1
  11. package/models/components/index.d.ts.map +1 -1
  12. package/models/components/index.js +0 -1
  13. package/models/components/index.js.map +1 -1
  14. package/models/operations/createagent.d.ts +14 -34
  15. package/models/operations/createagent.d.ts.map +1 -1
  16. package/models/operations/createagent.js +12 -32
  17. package/models/operations/createagent.js.map +1 -1
  18. package/models/operations/createphonecall.d.ts +12 -6
  19. package/models/operations/createphonecall.d.ts.map +1 -1
  20. package/models/operations/createphonecall.js +8 -8
  21. package/models/operations/createphonecall.js.map +1 -1
  22. package/models/operations/createphonenumber.d.ts +1 -1
  23. package/models/operations/createwebcall.d.ts +16 -0
  24. package/models/operations/createwebcall.d.ts.map +1 -0
  25. package/models/operations/createwebcall.js +3 -0
  26. package/models/operations/createwebcall.js.map +1 -0
  27. package/models/operations/index.d.ts +1 -0
  28. package/models/operations/index.d.ts.map +1 -1
  29. package/models/operations/index.js +1 -0
  30. package/models/operations/index.js.map +1 -1
  31. package/models/operations/listagents.d.ts +3 -3
  32. package/models/operations/listagents.d.ts.map +1 -1
  33. package/models/operations/listagents.js +4 -4
  34. package/models/operations/listagents.js.map +1 -1
  35. package/models/operations/listcalls.d.ts +3 -3
  36. package/models/operations/listcalls.d.ts.map +1 -1
  37. package/models/operations/listcalls.js +4 -4
  38. package/models/operations/listcalls.js.map +1 -1
  39. package/models/operations/listphonenumbers.d.ts +3 -3
  40. package/models/operations/listphonenumbers.d.ts.map +1 -1
  41. package/models/operations/listphonenumbers.js +4 -4
  42. package/models/operations/listphonenumbers.js.map +1 -1
  43. package/models/operations/updateagent.d.ts +42 -3
  44. package/models/operations/updateagent.d.ts.map +1 -1
  45. package/models/operations/updateagent.js +43 -5
  46. package/models/operations/updateagent.js.map +1 -1
  47. package/package.json +1 -1
  48. package/sdk/liveClient.d.ts +2 -4
  49. package/sdk/liveClient.d.ts.map +1 -1
  50. package/sdk/liveClient.js +9 -5
  51. package/sdk/liveClient.js.map +1 -1
  52. package/sdk/sdk.d.ts +2 -6
  53. package/sdk/sdk.d.ts.map +1 -1
  54. package/sdk/sdk.js +10 -10
  55. package/sdk/sdk.js.map +1 -1
  56. package/src/example.ts +102 -0
  57. package/src/models/components/agent.ts +382 -52
  58. package/src/models/components/index.ts +0 -1
  59. package/src/models/operations/createagent.ts +30 -66
  60. package/src/models/operations/createphonecall.ts +20 -14
  61. package/src/models/operations/createphonenumber.ts +1 -1
  62. package/src/models/operations/createwebcall.ts +16 -0
  63. package/src/models/operations/index.ts +1 -0
  64. package/src/models/operations/listagents.ts +7 -7
  65. package/src/models/operations/listcalls.ts +7 -7
  66. package/src/models/operations/listphonenumbers.ts +7 -7
  67. package/src/models/operations/updateagent.ts +87 -7
  68. package/src/sdk/liveClient.ts +11 -8
  69. package/src/sdk/sdk.ts +10 -17
  70. package/docs/sdks/retellclient/README.md +0 -713
  71. package/src/models/components/agentnodefaultnorequired.ts +0 -121
@@ -1,713 +0,0 @@
1
- # RetellClient SDK
2
-
3
-
4
- ## Overview
5
-
6
- ### Available Operations
7
-
8
- * [createAgent](#createagent) - Create a new agent
9
- * [createPhoneCall](#createphonecall) - Initiate an outbound phone call.
10
- * [createPhoneNumber](#createphonenumber) - Create a new phone number
11
- * [deleteAgent](#deleteagent) - Delete an existing agent
12
- * [deletePhoneNumber](#deletephonenumber) - Delete a specific phone number
13
- * [getAgent](#getagent) - Retrieve details of a specific agent
14
- * [getCall](#getcall) - Retrieve details of a specific call
15
- * [getPhoneNumber](#getphonenumber) - Retrieve info about a specific number
16
- * [listAgents](#listagents) - List all agents
17
- * [listCalls](#listcalls) - Retrieve call details
18
- * [listPhoneNumbers](#listphonenumbers) - List all purchased and active phone numbers
19
- * [updateAgent](#updateagent) - Update an existing agent
20
- * [updatePhoneAgent](#updatephoneagent) - Update an existing phone number
21
-
22
- ## createAgent
23
-
24
- Create a new agent
25
-
26
- ### Example Usage
27
-
28
- ```typescript
29
- import { RetellClient } from "retell-sdk";
30
-
31
- async function run() {
32
- const sdk = new RetellClient({
33
- apiKey: "YOUR_API_KEY",
34
- });
35
-
36
- const res = await sdk.createAgent({
37
- agentName: "Jarvis",
38
- beginMessage: "Hello there, how can I help you?",
39
- enableBeginMessage: true,
40
- enableEndCall: true,
41
- enableEndMessage: false,
42
- endMessage: "Hope you have a good day, goodbye.",
43
- prompt: "You are a marketing assistant. You help come up with creative content ideas and content like marketing emails, blog posts, tweets, ad copy and product descriptions. You respond concisely, with filler words in it.",
44
- voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
45
- });
46
-
47
- if (res?.statusCode !== 200) {
48
- throw new Error("Unexpected status code: " + res?.statusCode || "-");
49
- }
50
-
51
- // handle response
52
- }
53
-
54
- run();
55
- ```
56
-
57
- ### Parameters
58
-
59
- | Parameter | Type | Required | Description |
60
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
61
- | `request` | [operations.CreateAgentRequestBody](../../models/operations/createagentrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
62
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
63
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
64
-
65
-
66
- ### Response
67
-
68
- **Promise<[operations.CreateAgentResponse](../../models/operations/createagentresponse.md)>**
69
- ### Errors
70
-
71
- | Error Object | Status Code | Content Type |
72
- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- |
73
- | errors.CreateAgentResponseBody | 400 | application/json |
74
- | errors.CreateAgentResponseResponseBody | 401 | application/json |
75
- | errors.CreateAgentResponse422ResponseBody | 422 | application/json |
76
- | errors.CreateAgentResponse500ResponseBody | 500 | application/json |
77
- | errors.SDKError | 4xx-5xx | */* |
78
-
79
- ## createPhoneCall
80
-
81
- Initiate an outbound phone call.
82
-
83
- ### Example Usage
84
-
85
- ```typescript
86
- import { RetellClient } from "retell-sdk";
87
-
88
- async function run() {
89
- const sdk = new RetellClient({
90
- apiKey: "YOUR_API_KEY",
91
- });
92
-
93
- const res = await sdk.createPhoneCall({
94
- agentPromptParams: [
95
- {
96
- name: "username",
97
- value: "Adam",
98
- },
99
- ],
100
- phoneNumber: {
101
- from: "+14159095857",
102
- to: "+14159095858",
103
- },
104
- });
105
-
106
- if (res?.statusCode !== 200) {
107
- throw new Error("Unexpected status code: " + res?.statusCode || "-");
108
- }
109
-
110
- // handle response
111
- }
112
-
113
- run();
114
- ```
115
-
116
- ### Parameters
117
-
118
- | Parameter | Type | Required | Description |
119
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
120
- | `request` | [operations.CreatePhoneCallRequestBody](../../models/operations/createphonecallrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
121
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
122
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
123
-
124
-
125
- ### Response
126
-
127
- **Promise<[operations.CreatePhoneCallResponse](../../models/operations/createphonecallresponse.md)>**
128
- ### Errors
129
-
130
- | Error Object | Status Code | Content Type |
131
- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- |
132
- | errors.CreatePhoneCallResponseBody | 400 | application/json |
133
- | errors.CreatePhoneCallResponseResponseBody | 401 | application/json |
134
- | errors.CreatePhoneCallResponse402ResponseBody | 402 | application/json |
135
- | errors.CreatePhoneCallResponse422ResponseBody | 422 | application/json |
136
- | errors.CreatePhoneCallResponse429ResponseBody | 429 | application/json |
137
- | errors.CreatePhoneCallResponse500ResponseBody | 500 | application/json |
138
- | errors.SDKError | 4xx-5xx | */* |
139
-
140
- ## createPhoneNumber
141
-
142
- Create a new phone number
143
-
144
- ### Example Usage
145
-
146
- ```typescript
147
- import { RetellClient } from "retell-sdk";
148
-
149
- async function run() {
150
- const sdk = new RetellClient({
151
- apiKey: "YOUR_API_KEY",
152
- });
153
-
154
- const res = await sdk.createPhoneNumber({
155
- agentId: "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
156
- areaCode: 415,
157
- });
158
-
159
- if (res?.statusCode !== 200) {
160
- throw new Error("Unexpected status code: " + res?.statusCode || "-");
161
- }
162
-
163
- // handle response
164
- }
165
-
166
- run();
167
- ```
168
-
169
- ### Parameters
170
-
171
- | Parameter | Type | Required | Description |
172
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
173
- | `request` | [operations.CreatePhoneNumberRequestBody](../../models/operations/createphonenumberrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
174
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
175
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
176
-
177
-
178
- ### Response
179
-
180
- **Promise<[operations.CreatePhoneNumberResponse](../../models/operations/createphonenumberresponse.md)>**
181
- ### Errors
182
-
183
- | Error Object | Status Code | Content Type |
184
- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- |
185
- | errors.CreatePhoneNumberResponseBody | 400 | application/json |
186
- | errors.CreatePhoneNumberResponseResponseBody | 401 | application/json |
187
- | errors.CreatePhoneNumberResponse402ResponseBody | 402 | application/json |
188
- | errors.CreatePhoneNumberResponse422ResponseBody | 422 | application/json |
189
- | errors.CreatePhoneNumberResponse500ResponseBody | 500 | application/json |
190
- | errors.SDKError | 4xx-5xx | */* |
191
-
192
- ## deleteAgent
193
-
194
- Delete an existing agent
195
-
196
- ### Example Usage
197
-
198
- ```typescript
199
- import { RetellClient } from "retell-sdk";
200
-
201
- async function run() {
202
- const sdk = new RetellClient({
203
- apiKey: "YOUR_API_KEY",
204
- });
205
-
206
- const agentId = "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD";
207
-
208
- const res = await sdk.deleteAgent(agentId);
209
-
210
- if (res?.statusCode !== 200) {
211
- throw new Error("Unexpected status code: " + res?.statusCode || "-");
212
- }
213
-
214
- // handle response
215
- }
216
-
217
- run();
218
- ```
219
-
220
- ### Parameters
221
-
222
- | Parameter | Type | Required | Description | Example |
223
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
224
- | `agentId` | *string* | :heavy_check_mark: | Unique id of the agent to be deleted. | [object Object] |
225
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | |
226
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | |
227
-
228
-
229
- ### Response
230
-
231
- **Promise<[operations.DeleteAgentResponse](../../models/operations/deleteagentresponse.md)>**
232
- ### Errors
233
-
234
- | Error Object | Status Code | Content Type |
235
- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- |
236
- | errors.DeleteAgentResponseBody | 400 | application/json |
237
- | errors.DeleteAgentResponseResponseBody | 401 | application/json |
238
- | errors.DeleteAgentResponse422ResponseBody | 422 | application/json |
239
- | errors.DeleteAgentResponse500ResponseBody | 500 | application/json |
240
- | errors.SDKError | 4xx-5xx | */* |
241
-
242
- ## deletePhoneNumber
243
-
244
- Delete a specific phone number
245
-
246
- ### Example Usage
247
-
248
- ```typescript
249
- import { RetellClient } from "retell-sdk";
250
-
251
- async function run() {
252
- const sdk = new RetellClient({
253
- apiKey: "YOUR_API_KEY",
254
- });
255
-
256
- const phoneNumber = "string";
257
-
258
- const res = await sdk.deletePhoneNumber(phoneNumber);
259
-
260
- if (res?.statusCode !== 200) {
261
- throw new Error("Unexpected status code: " + res?.statusCode || "-");
262
- }
263
-
264
- // handle response
265
- }
266
-
267
- run();
268
- ```
269
-
270
- ### Parameters
271
-
272
- | Parameter | Type | Required | Description |
273
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
274
- | `phoneNumber` | *string* | :heavy_check_mark: | Phone number to delete in E.164 format. |
275
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
276
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
277
-
278
-
279
- ### Response
280
-
281
- **Promise<[operations.DeletePhoneNumberResponse](../../models/operations/deletephonenumberresponse.md)>**
282
- ### Errors
283
-
284
- | Error Object | Status Code | Content Type |
285
- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- |
286
- | errors.DeletePhoneNumberResponseBody | 400 | application/json |
287
- | errors.DeletePhoneNumberResponseResponseBody | 401 | application/json |
288
- | errors.DeletePhoneNumberResponse422ResponseBody | 422 | application/json |
289
- | errors.DeletePhoneNumberResponse500ResponseBody | 500 | application/json |
290
- | errors.SDKError | 4xx-5xx | */* |
291
-
292
- ## getAgent
293
-
294
- Retrieve details of a specific agent
295
-
296
- ### Example Usage
297
-
298
- ```typescript
299
- import { RetellClient } from "retell-sdk";
300
-
301
- async function run() {
302
- const sdk = new RetellClient({
303
- apiKey: "YOUR_API_KEY",
304
- });
305
-
306
- const agentId = "16b980523634a6dc504898cda492e939";
307
-
308
- const res = await sdk.getAgent(agentId);
309
-
310
- if (res?.statusCode !== 200) {
311
- throw new Error("Unexpected status code: " + res?.statusCode || "-");
312
- }
313
-
314
- // handle response
315
- }
316
-
317
- run();
318
- ```
319
-
320
- ### Parameters
321
-
322
- | Parameter | Type | Required | Description | Example |
323
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
324
- | `agentId` | *string* | :heavy_check_mark: | Unique id of the agent to be retrieved. | [object Object] |
325
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | |
326
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | |
327
-
328
-
329
- ### Response
330
-
331
- **Promise<[operations.GetAgentResponse](../../models/operations/getagentresponse.md)>**
332
- ### Errors
333
-
334
- | Error Object | Status Code | Content Type |
335
- | -------------------------------------- | -------------------------------------- | -------------------------------------- |
336
- | errors.GetAgentResponseBody | 400 | application/json |
337
- | errors.GetAgentResponseResponseBody | 401 | application/json |
338
- | errors.GetAgentResponse422ResponseBody | 422 | application/json |
339
- | errors.GetAgentResponse500ResponseBody | 500 | application/json |
340
- | errors.SDKError | 4xx-5xx | */* |
341
-
342
- ## getCall
343
-
344
- Retrieve details of a specific call
345
-
346
- ### Example Usage
347
-
348
- ```typescript
349
- import { RetellClient } from "retell-sdk";
350
-
351
- async function run() {
352
- const sdk = new RetellClient({
353
- apiKey: "YOUR_API_KEY",
354
- });
355
-
356
- const callId = "119c3f8e47135a29e65947eeb34cf12d";
357
-
358
- const res = await sdk.getCall(callId);
359
-
360
- if (res?.statusCode !== 200) {
361
- throw new Error("Unexpected status code: " + res?.statusCode || "-");
362
- }
363
-
364
- // handle response
365
- }
366
-
367
- run();
368
- ```
369
-
370
- ### Parameters
371
-
372
- | Parameter | Type | Required | Description | Example |
373
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
374
- | `callId` | *string* | :heavy_check_mark: | The call id to retrieve call history for. | [object Object] |
375
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | |
376
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | |
377
-
378
-
379
- ### Response
380
-
381
- **Promise<[operations.GetCallResponse](../../models/operations/getcallresponse.md)>**
382
- ### Errors
383
-
384
- | Error Object | Status Code | Content Type |
385
- | ------------------------------------- | ------------------------------------- | ------------------------------------- |
386
- | errors.GetCallResponseBody | 400 | application/json |
387
- | errors.GetCallResponseResponseBody | 401 | application/json |
388
- | errors.GetCallResponse422ResponseBody | 422 | application/json |
389
- | errors.GetCallResponse500ResponseBody | 500 | application/json |
390
- | errors.SDKError | 4xx-5xx | */* |
391
-
392
- ## getPhoneNumber
393
-
394
- Retrieve info about a specific number
395
-
396
- ### Example Usage
397
-
398
- ```typescript
399
- import { RetellClient } from "retell-sdk";
400
-
401
- async function run() {
402
- const sdk = new RetellClient({
403
- apiKey: "YOUR_API_KEY",
404
- });
405
-
406
- const phoneNumber = "+14159095857";
407
-
408
- const res = await sdk.getPhoneNumber(phoneNumber);
409
-
410
- if (res?.statusCode !== 200) {
411
- throw new Error("Unexpected status code: " + res?.statusCode || "-");
412
- }
413
-
414
- // handle response
415
- }
416
-
417
- run();
418
- ```
419
-
420
- ### Parameters
421
-
422
- | Parameter | Type | Required | Description | Example |
423
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
424
- | `phoneNumber` | *string* | :heavy_check_mark: | Phone number in E.164 format to retreive more information. | [object Object] |
425
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | |
426
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | |
427
-
428
-
429
- ### Response
430
-
431
- **Promise<[operations.GetPhoneNumberResponse](../../models/operations/getphonenumberresponse.md)>**
432
- ### Errors
433
-
434
- | Error Object | Status Code | Content Type |
435
- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- |
436
- | errors.GetPhoneNumberResponseBody | 400 | application/json |
437
- | errors.GetPhoneNumberResponseResponseBody | 401 | application/json |
438
- | errors.GetPhoneNumberResponse422ResponseBody | 422 | application/json |
439
- | errors.GetPhoneNumberResponse500ResponseBody | 500 | application/json |
440
- | errors.SDKError | 4xx-5xx | */* |
441
-
442
- ## listAgents
443
-
444
- List all agents
445
-
446
- ### Example Usage
447
-
448
- ```typescript
449
- import { RetellClient } from "retell-sdk";
450
-
451
- async function run() {
452
- const sdk = new RetellClient({
453
- apiKey: "YOUR_API_KEY",
454
- });
455
-
456
- const res = await sdk.listAgents();
457
-
458
- if (res?.statusCode !== 200) {
459
- throw new Error("Unexpected status code: " + res?.statusCode || "-");
460
- }
461
-
462
- // handle response
463
- }
464
-
465
- run();
466
- ```
467
-
468
- ### Parameters
469
-
470
- | Parameter | Type | Required | Description |
471
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
472
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
473
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
474
-
475
-
476
- ### Response
477
-
478
- **Promise<[operations.ListAgentsResponse](../../models/operations/listagentsresponse.md)>**
479
- ### Errors
480
-
481
- | Error Object | Status Code | Content Type |
482
- | ------------------------------------- | ------------------------------------- | ------------------------------------- |
483
- | errors.ListAgentsResponseBody | 401 | application/json |
484
- | errors.ListAgentsResponseResponseBody | 500 | application/json |
485
- | errors.SDKError | 4xx-5xx | */* |
486
-
487
- ## listCalls
488
-
489
- Retrieve call details
490
-
491
- ### Example Usage
492
-
493
- ```typescript
494
- import { RetellClient } from "retell-sdk";
495
- import { } from "retell-sdk/models";
496
- import { SortOrder } from "retell-sdk/models/operations";
497
-
498
- async function run() {
499
- const sdk = new RetellClient({
500
- apiKey: "YOUR_API_KEY",
501
- });
502
-
503
- const filterCriteria = {
504
- afterEndTimestamp: 1703302428800,
505
- afterStartTimestamp: 1703302407300,
506
- agentId: [
507
- "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
508
- ],
509
- beforeEndTimestamp: 1703302428899,
510
- beforeStartTimestamp: 1703302407399,
511
- callType: [
512
- CallType.InboundPhoneCall,
513
- CallType.OutboundPhoneCall,
514
- ],
515
- };
516
- const limit = 666195;
517
- const sortOrder = SortOrder.Descending;
518
-
519
- const res = await sdk.listCalls(filterCriteria, limit, sortOrder);
520
-
521
- if (res?.statusCode !== 200) {
522
- throw new Error("Unexpected status code: " + res?.statusCode || "-");
523
- }
524
-
525
- // handle response
526
- }
527
-
528
- run();
529
- ```
530
-
531
- ### Parameters
532
-
533
- | Parameter | Type | Required | Description |
534
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
535
- | `filterCriteria` | [operations.FilterCriteria](../../models/operations/filtercriteria.md) | :heavy_minus_sign: | N/A |
536
- | `limit` | *number* | :heavy_minus_sign: | Limit the number of calls returned. |
537
- | `sortOrder` | [operations.SortOrder](../../models/operations/sortorder.md) | :heavy_minus_sign: | The calls will be sorted by `start_timestamp`, whether to return the calls in ascending or descending order. |
538
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
539
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
540
-
541
-
542
- ### Response
543
-
544
- **Promise<[operations.ListCallsResponse](../../models/operations/listcallsresponse.md)>**
545
- ### Errors
546
-
547
- | Error Object | Status Code | Content Type |
548
- | --------------------------------------- | --------------------------------------- | --------------------------------------- |
549
- | errors.ListCallsResponseBody | 400 | application/json |
550
- | errors.ListCallsResponseResponseBody | 401 | application/json |
551
- | errors.ListCallsResponse500ResponseBody | 500 | application/json |
552
- | errors.SDKError | 4xx-5xx | */* |
553
-
554
- ## listPhoneNumbers
555
-
556
- List all purchased and active phone numbers
557
-
558
- ### Example Usage
559
-
560
- ```typescript
561
- import { RetellClient } from "retell-sdk";
562
-
563
- async function run() {
564
- const sdk = new RetellClient({
565
- apiKey: "YOUR_API_KEY",
566
- });
567
-
568
- const res = await sdk.listPhoneNumbers();
569
-
570
- if (res?.statusCode !== 200) {
571
- throw new Error("Unexpected status code: " + res?.statusCode || "-");
572
- }
573
-
574
- // handle response
575
- }
576
-
577
- run();
578
- ```
579
-
580
- ### Parameters
581
-
582
- | Parameter | Type | Required | Description |
583
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
584
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
585
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
586
-
587
-
588
- ### Response
589
-
590
- **Promise<[operations.ListPhoneNumbersResponse](../../models/operations/listphonenumbersresponse.md)>**
591
- ### Errors
592
-
593
- | Error Object | Status Code | Content Type |
594
- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- |
595
- | errors.ListPhoneNumbersResponseBody | 400 | application/json |
596
- | errors.ListPhoneNumbersResponseResponseBody | 401 | application/json |
597
- | errors.ListPhoneNumbersResponse500ResponseBody | 500 | application/json |
598
- | errors.SDKError | 4xx-5xx | */* |
599
-
600
- ## updateAgent
601
-
602
- Update an existing agent
603
-
604
- ### Example Usage
605
-
606
- ```typescript
607
- import { RetellClient } from "retell-sdk";
608
-
609
- async function run() {
610
- const sdk = new RetellClient({
611
- apiKey: "YOUR_API_KEY",
612
- });
613
-
614
- const agentNoDefaultNoRequired = {
615
- agentName: "Jarvis",
616
- beginMessage: "Hello there, how can I help you.",
617
- enableBeginMessage: true,
618
- enableEndCall: true,
619
- enableEndMessage: false,
620
- endMessage: "Hope you have a good day, goodbye.",
621
- prompt: "You are a marketing assistant. You help come up with creative content ideas and content like marketing emails, blog posts, tweets, ad copy and product descriptions. You respond concisely, with filler words in it.",
622
- voiceId: "elevenlabs-xxcrwXReTKMHWjqi7Q27",
623
- };
624
- const agentId = "16b980523634a6dc504898cda492e939";
625
-
626
- const res = await sdk.updateAgent(agentNoDefaultNoRequired, agentId);
627
-
628
- if (res?.statusCode !== 200) {
629
- throw new Error("Unexpected status code: " + res?.statusCode || "-");
630
- }
631
-
632
- // handle response
633
- }
634
-
635
- run();
636
- ```
637
-
638
- ### Parameters
639
-
640
- | Parameter | Type | Required | Description | Example |
641
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
642
- | `agentNoDefaultNoRequired` | [components.AgentNoDefaultNoRequired](../../models/components/agentnodefaultnorequired.md) | :heavy_check_mark: | N/A | |
643
- | `agentId` | *string* | :heavy_check_mark: | Unique id of the agent to be updated. | [object Object] |
644
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | |
645
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | |
646
-
647
-
648
- ### Response
649
-
650
- **Promise<[operations.UpdateAgentResponse](../../models/operations/updateagentresponse.md)>**
651
- ### Errors
652
-
653
- | Error Object | Status Code | Content Type |
654
- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- |
655
- | errors.UpdateAgentResponseBody | 400 | application/json |
656
- | errors.UpdateAgentResponseResponseBody | 401 | application/json |
657
- | errors.UpdateAgentResponse422ResponseBody | 422 | application/json |
658
- | errors.UpdateAgentResponse500ResponseBody | 500 | application/json |
659
- | errors.SDKError | 4xx-5xx | */* |
660
-
661
- ## updatePhoneAgent
662
-
663
- Update an existing phone number
664
-
665
- ### Example Usage
666
-
667
- ```typescript
668
- import { RetellClient } from "retell-sdk";
669
-
670
- async function run() {
671
- const sdk = new RetellClient({
672
- apiKey: "YOUR_API_KEY",
673
- });
674
-
675
- const requestBody = {
676
- agentId: "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
677
- };
678
- const phoneNumber = "+14159095857";
679
-
680
- const res = await sdk.updatePhoneAgent(requestBody, phoneNumber);
681
-
682
- if (res?.statusCode !== 200) {
683
- throw new Error("Unexpected status code: " + res?.statusCode || "-");
684
- }
685
-
686
- // handle response
687
- }
688
-
689
- run();
690
- ```
691
-
692
- ### Parameters
693
-
694
- | Parameter | Type | Required | Description | Example |
695
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
696
- | `requestBody` | [operations.UpdatePhoneAgentRequestBody](../../models/operations/updatephoneagentrequestbody.md) | :heavy_check_mark: | N/A | |
697
- | `phoneNumber` | *string* | :heavy_check_mark: | Phone number in E.164 format that require agent update. | [object Object] |
698
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | |
699
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | |
700
-
701
-
702
- ### Response
703
-
704
- **Promise<[operations.UpdatePhoneAgentResponse](../../models/operations/updatephoneagentresponse.md)>**
705
- ### Errors
706
-
707
- | Error Object | Status Code | Content Type |
708
- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- |
709
- | errors.UpdatePhoneAgentResponseBody | 400 | application/json |
710
- | errors.UpdatePhoneAgentResponseResponseBody | 401 | application/json |
711
- | errors.UpdatePhoneAgentResponse422ResponseBody | 422 | application/json |
712
- | errors.UpdatePhoneAgentResponse500ResponseBody | 500 | application/json |
713
- | errors.SDKError | 4xx-5xx | */* |