@apicity/elevenlabs 0.6.4 → 0.6.6

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.
@@ -1,5 +1,5 @@
1
1
  import { ElevenLabsError, } from "./types.js";
2
- import { ElevenLabsCreatePvcVoiceRequestSchema, ElevenLabsGetVoiceRequestSchema, ElevenLabsListVoicesRequestSchema, ElevenLabsPvcTrainRequestSchema, ElevenLabsPvcVoiceCaptchaRequestSchema, ElevenLabsPvcManualVerificationRequestSchema, ElevenLabsSoundGenerationRequestSchema, ElevenLabsTextToDialogueRequestSchema, ElevenLabsTextToSpeechRequestSchema, ElevenLabsSpeechToTextRequestSchema, ElevenLabsUpdatePvcVoiceSampleRequestSchema, ElevenLabsWorkspaceAnalyticsRequestsRequestSchema, ElevenLabsWorkspaceAnalyticsUsageByProductOverTimeRequestSchema, } from "./zod.js";
2
+ import { ElevenLabsCreatePvcVoiceRequestSchema, ElevenLabsEditPvcVoiceRequestSchema, ElevenLabsAddPvcSamplesRequestSchema, ElevenLabsGetPvcSampleAudioRequestSchema, ElevenLabsGetVoiceRequestSchema, ElevenLabsListVoicesRequestSchema, ElevenLabsPvcTrainRequestSchema, ElevenLabsPvcVoiceCaptchaRequestSchema, ElevenLabsPvcManualVerificationRequestSchema, ElevenLabsSoundGenerationRequestSchema, ElevenLabsAudioIsolationRequestSchema, ElevenLabsAudioIsolationStreamRequestSchema, ElevenLabsAudioIsolationHistoryListRequestSchema, ElevenLabsAudioNativeCreateProjectRequestSchema, ElevenLabsAudioNativeUpdateContentFromUrlRequestSchema, ElevenLabsAudioNativeUpdateProjectContentRequestSchema, ElevenLabsForcedAlignmentRequestSchema, ElevenLabsComposeMusicRequestSchema, ElevenLabsComposeMusicDetailedRequestSchema, ElevenLabsComposeMusicStreamRequestSchema, ElevenLabsMusicPlanRequestSchema, ElevenLabsMusicStemSeparationRequestSchema, ElevenLabsMusicUploadRequestSchema, ElevenLabsVideoToMusicRequestSchema, ElevenLabsListSpeechEnginesRequestSchema, ElevenLabsCreateSpeechEngineRequestSchema, ElevenLabsUpdateSpeechEngineRequestSchema, ElevenLabsListOrdersRequestSchema, ElevenLabsCreateOrderRequestSchema, ElevenLabsUpdateOrderRequestSchema, ElevenLabsUpsertOrderItemRequestSchema, ElevenLabsRegisterOrderMediaRequestSchema, ElevenLabsTextToDialogueRequestSchema, ElevenLabsTextToSpeechRequestSchema, ElevenLabsSpeechToTextRequestSchema, ElevenLabsSpeechToSpeechRequestSchema, ElevenLabsUpdatePvcVoiceSampleRequestSchema, ElevenLabsWorkspaceAnalyticsRequestsRequestSchema, ElevenLabsWorkspaceAnalyticsUsageByProductOverTimeRequestSchema, ElevenLabsListWorkspaceAuditLogsRequestSchema, ElevenLabsSearchWorkspaceGroupsRequestSchema, ElevenLabsAddWorkspaceGroupMemberRequestSchema, ElevenLabsRemoveWorkspaceGroupMemberRequestSchema, ElevenLabsUpdateWorkspaceMemberRequestSchema, ElevenLabsAddWorkspaceInviteRequestSchema, ElevenLabsAddWorkspaceInvitesBulkRequestSchema, ElevenLabsDeleteWorkspaceInviteRequestSchema, ElevenLabsGetWorkspaceResourceRequestSchema, ElevenLabsShareWorkspaceResourceRequestSchema, ElevenLabsUnshareWorkspaceResourceRequestSchema, ElevenLabsListWorkspaceWebhooksRequestSchema, ElevenLabsCreateWorkspaceWebhookRequestSchema, ElevenLabsUpdateWorkspaceWebhookRequestSchema, ElevenLabsCreateWorkspaceAuthConnectionRequestSchema, ElevenLabsUpdateWorkspaceAuthConnectionRequestSchema, ElevenLabsDisableWorkspaceApiKeyRequestSchema, ElevenLabsSetWorkspaceApiKeyThirdPartyDisablingRequestSchema, ElevenLabsCreateServiceAccountApiKeyRequestSchema, ElevenLabsUpdateServiceAccountApiKeyRequestSchema, ElevenLabsCreateAgentRequestSchema, ElevenLabsGetAgentRequestSchema, ElevenLabsListAgentsRequestSchema, ElevenLabsUpdateAgentRequestSchema, ElevenLabsGetAgentWidgetRequestSchema, ElevenLabsListAgentBranchesRequestSchema, ElevenLabsGetAgentSummariesRequestSchema, ElevenLabsDuplicateAgentRequestSchema, ElevenLabsPostAgentAvatarRequestSchema, ElevenLabsSimulateConversationRequestSchema, ElevenLabsGetAgentTopicsRequestSchema, ElevenLabsCalculateAgentLlmUsageRequestSchema, ElevenLabsCreateAgentDraftRequestSchema, ElevenLabsDeleteAgentDraftRequestSchema, ElevenLabsCreateAgentDeploymentRequestSchema, ElevenLabsCreateAgentBranchRequestSchema, ElevenLabsUpdateAgentBranchRequestSchema, ElevenLabsMergeAgentBranchRequestSchema, ElevenLabsPreviewAgentBranchMergeRequestSchema, ElevenLabsGetLiveConversationCountRequestSchema, ElevenLabsListConversationUsersRequestSchema, ElevenLabsCalculateLlmUsageRequestSchema, ElevenLabsListConversationTagsRequestSchema, ElevenLabsCreateConversationTagRequestSchema, ElevenLabsUpdateConversationTagRequestSchema, ElevenLabsUpdateConvaiSettingsRequestSchema, ElevenLabsUpdateConvaiDashboardSettingsRequestSchema, ElevenLabsCreateWorkspaceSecretRequestSchema, ElevenLabsListWorkspaceSecretsRequestSchema, ElevenLabsUpdateWorkspaceSecretRequestSchema, ElevenLabsGetSecretDependenciesRequestSchema, ElevenLabsListEnvironmentVariablesRequestSchema, ElevenLabsCreateEnvironmentVariableRequestSchema, ElevenLabsUpdateEnvironmentVariableRequestSchema, ElevenLabsCreateToolRequestSchema, ElevenLabsListToolsRequestSchema, ElevenLabsUpdateToolRequestSchema, ElevenLabsGetToolDependentAgentsRequestSchema, ElevenLabsGetToolExecutionsRequestSchema, ElevenLabsCreateMcpServerRequestSchema, ElevenLabsUpdateMcpServerRequestSchema, ElevenLabsCreateMcpServerToolApprovalRequestSchema, ElevenLabsCreateMcpToolConfigOverrideRequestSchema, ElevenLabsUpdateMcpToolConfigOverrideRequestSchema, ElevenLabsCreateAgentTestRequestSchema, ElevenLabsListAgentTestsRequestSchema, ElevenLabsUpdateAgentTestRequestSchema, ElevenLabsGetAgentTestSummariesRequestSchema, ElevenLabsBulkMoveAgentTestsRequestSchema, ElevenLabsCreateAgentTestFolderRequestSchema, ElevenLabsUpdateAgentTestFolderRequestSchema, ElevenLabsDeleteAgentTestFolderRequestSchema, ElevenLabsRunAgentTestsRequestSchema, ElevenLabsListTestInvocationsRequestSchema, ElevenLabsResubmitTestsRequestSchema, ElevenLabsCreateKnowledgeBaseDocumentFromUrlRequestSchema, ElevenLabsCreateKnowledgeBaseDocumentFromTextRequestSchema, ElevenLabsCreateKnowledgeBaseDocumentFromFileRequestSchema, ElevenLabsListKnowledgeBaseDocumentsRequestSchema, ElevenLabsGetKnowledgeBaseDocumentRequestSchema, ElevenLabsDeleteKnowledgeBaseDocumentRequestSchema, ElevenLabsGetKnowledgeBaseSummariesRequestSchema, ElevenLabsSearchKnowledgeBaseContentRequestSchema, ElevenLabsUpdateKnowledgeBaseDocumentRequestSchema, ElevenLabsListKnowledgeBaseDocumentChunksRequestSchema, ElevenLabsGetKnowledgeBaseDocumentChunkRequestSchema, ElevenLabsGetKnowledgeBaseDependentAgentsRequestSchema, ElevenLabsUpdateKnowledgeBaseFileDocumentRequestSchema, ElevenLabsComputeKnowledgeBaseRagIndexesRequestSchema, ElevenLabsComputeKnowledgeBaseDocumentRagIndexRequestSchema, ElevenLabsCreateKnowledgeBaseFolderRequestSchema, ElevenLabsBulkMoveKnowledgeBaseDocumentsRequestSchema, ElevenLabsMoveKnowledgeBaseEntityRequestSchema, ElevenLabsListConversationsRequestSchema, ElevenLabsGetConversationRequestSchema, ElevenLabsGetSignedUrlRequestSchema, ElevenLabsGetConversationTokenRequestSchema, ElevenLabsSmartSearchConversationMessagesRequestSchema, ElevenLabsTextSearchConversationMessagesRequestSchema, ElevenLabsConversationFeedbackRequestSchema, ElevenLabsUploadConversationFileRequestSchema, ElevenLabsGetConversationSipMessagesRequestSchema, ElevenLabsAssignConversationTagsRequestSchema, ElevenLabsRunConversationEvaluationsRequestSchema, ElevenLabsSubmitBatchCallRequestSchema, ElevenLabsListWorkspaceBatchCallsRequestSchema, ElevenLabsCreatePhoneNumberRequestSchema, ElevenLabsListPhoneNumbersRequestSchema, ElevenLabsUpdatePhoneNumberRequestSchema, ElevenLabsGetPhoneNumberSipMessagesRequestSchema, ElevenLabsRegisterTwilioCallRequestSchema, ElevenLabsTwilioOutboundCallRequestSchema, ElevenLabsSipTrunkOutboundCallRequestSchema, ElevenLabsExotelOutboundCallRequestSchema, ElevenLabsWhatsAppOutboundCallRequestSchema, ElevenLabsWhatsAppOutboundMessageRequestSchema, ElevenLabsListWhatsAppAccountsRequestSchema, ElevenLabsUpdateWhatsAppAccountRequestSchema, ElevenLabsCreateVoiceFromPreviewRequestSchema, ElevenLabsVoiceDesignRequestSchema, ElevenLabsVoiceRemixRequestSchema, ElevenLabsListV1VoicesRequestSchema, ElevenLabsAddVoiceRequestSchema, ElevenLabsEditVoiceRequestSchema, ElevenLabsEditVoiceSettingsRequestSchema, ElevenLabsAddSharedVoiceRequestSchema, ElevenLabsSharedVoicesRequestSchema, ElevenLabsSimilarVoicesRequestSchema, ElevenLabsHistoryListRequestSchema, ElevenLabsHistoryDownloadRequestSchema, ElevenLabsListDubbingRequestSchema, ElevenLabsCreateDubbingRequestSchema, ElevenLabsStudioCreatePodcastRequestSchema, ElevenLabsStudioGetProjectRequestSchema, ElevenLabsStudioCreateProjectRequestSchema, ElevenLabsStudioUpdateProjectRequestSchema, ElevenLabsStudioUpdateProjectContentRequestSchema, ElevenLabsStudioCreatePronunciationDictionariesRequestSchema, ElevenLabsStudioStreamAudioRequestSchema, ElevenLabsStudioCreateChapterRequestSchema, ElevenLabsStudioUpdateChapterRequestSchema, ElevenLabsListPronunciationDictionariesRequestSchema, ElevenLabsAddPronunciationDictionaryFromFileRequestSchema, ElevenLabsAddPronunciationDictionaryFromRulesRequestSchema, ElevenLabsGetPronunciationDictionaryRequestSchema, ElevenLabsUpdatePronunciationDictionaryRequestSchema, ElevenLabsAddPronunciationDictionaryRulesRequestSchema, ElevenLabsRemovePronunciationDictionaryRulesRequestSchema, ElevenLabsSetPronunciationDictionaryRulesRequestSchema, ElevenLabsDownloadPronunciationDictionaryRequestSchema, } from "./zod.js";
3
3
  import { attachExamples } from "./example.js";
4
4
  export function createElevenLabs(opts) {
5
5
  const baseURL = opts.baseURL ?? "https://api.elevenlabs.io";
@@ -84,6 +84,116 @@ export function createElevenLabs(opts) {
84
84
  throw new ElevenLabsError(`ElevenLabs request failed: ${error}`, 500);
85
85
  }
86
86
  }
87
+ // GET variant of makeBinaryRequest: fetches an endpoint that responds with
88
+ // raw bytes (e.g. the conversation audio recording) and returns the buffer.
89
+ async function makeGetBinaryRequest(path, queryString = "", signal) {
90
+ const controller = new AbortController();
91
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
92
+ if (signal) {
93
+ attachAbortHandler(signal, controller);
94
+ }
95
+ try {
96
+ const res = await doFetch(`${baseURL}${path}${queryString}`, {
97
+ method: "GET",
98
+ headers: {
99
+ "xi-api-key": opts.apiKey,
100
+ },
101
+ signal: controller.signal,
102
+ });
103
+ clearTimeout(timeoutId);
104
+ if (!res.ok) {
105
+ let resBody = null;
106
+ try {
107
+ resBody = await res.json();
108
+ }
109
+ catch {
110
+ // ignore parse errors
111
+ }
112
+ throw new ElevenLabsError(formatErrorMessage(res.status, resBody), res.status, resBody, extractErrorCode(resBody));
113
+ }
114
+ return await res.arrayBuffer();
115
+ }
116
+ catch (error) {
117
+ clearTimeout(timeoutId);
118
+ if (error instanceof ElevenLabsError)
119
+ throw error;
120
+ throw new ElevenLabsError(`ElevenLabs request failed: ${error}`, 500);
121
+ }
122
+ }
123
+ async function makeTextRequest(method, path, signal, queryString = "") {
124
+ const controller = new AbortController();
125
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
126
+ if (signal) {
127
+ attachAbortHandler(signal, controller);
128
+ }
129
+ try {
130
+ const res = await doFetch(`${baseURL}${path}${queryString}`, {
131
+ method,
132
+ headers: {
133
+ "xi-api-key": opts.apiKey,
134
+ },
135
+ signal: controller.signal,
136
+ });
137
+ clearTimeout(timeoutId);
138
+ if (!res.ok) {
139
+ let resBody = null;
140
+ try {
141
+ resBody = await res.json();
142
+ }
143
+ catch {
144
+ // ignore parse errors
145
+ }
146
+ throw new ElevenLabsError(formatErrorMessage(res.status, resBody), res.status, resBody, extractErrorCode(resBody));
147
+ }
148
+ return await res.text();
149
+ }
150
+ catch (error) {
151
+ clearTimeout(timeoutId);
152
+ if (error instanceof ElevenLabsError)
153
+ throw error;
154
+ throw new ElevenLabsError(`ElevenLabs request failed: ${error}`, 500);
155
+ }
156
+ }
157
+ async function makeTextBodyRequest(method, path, body, signal) {
158
+ const controller = new AbortController();
159
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
160
+ if (signal) {
161
+ attachAbortHandler(signal, controller);
162
+ }
163
+ try {
164
+ const headers = {
165
+ "xi-api-key": opts.apiKey,
166
+ };
167
+ const init = {
168
+ method,
169
+ headers,
170
+ signal: controller.signal,
171
+ };
172
+ if (body !== undefined) {
173
+ headers["Content-Type"] = "application/json";
174
+ init.body = JSON.stringify(body);
175
+ }
176
+ const res = await doFetch(`${baseURL}${path}`, init);
177
+ clearTimeout(timeoutId);
178
+ if (!res.ok) {
179
+ let resBody = null;
180
+ try {
181
+ resBody = await res.json();
182
+ }
183
+ catch {
184
+ // ignore parse errors
185
+ }
186
+ throw new ElevenLabsError(formatErrorMessage(res.status, resBody), res.status, resBody, extractErrorCode(resBody));
187
+ }
188
+ return await res.text();
189
+ }
190
+ catch (error) {
191
+ clearTimeout(timeoutId);
192
+ if (error instanceof ElevenLabsError)
193
+ throw error;
194
+ throw new ElevenLabsError(`ElevenLabs request failed: ${error}`, 500);
195
+ }
196
+ }
87
197
  async function makeJsonRequest(method, path, body, signal, queryString = "") {
88
198
  const controller = new AbortController();
89
199
  const timeoutId = setTimeout(() => controller.abort(), timeout);
@@ -124,7 +234,54 @@ export function createElevenLabs(opts) {
124
234
  throw new ElevenLabsError(`ElevenLabs request failed: ${error}`, 500);
125
235
  }
126
236
  }
237
+ // Like makeJsonRequest, but tolerates an empty success body (HTTP 204 / 200
238
+ // with no content), which the agent DELETE endpoint returns. Parses JSON when
239
+ // present, otherwise resolves to an empty object.
240
+ async function makeJsonRequestAllowEmpty(method, path, body, signal, queryString = "") {
241
+ const controller = new AbortController();
242
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
243
+ if (signal) {
244
+ attachAbortHandler(signal, controller);
245
+ }
246
+ try {
247
+ const headers = {
248
+ "xi-api-key": opts.apiKey,
249
+ };
250
+ const init = {
251
+ method,
252
+ headers,
253
+ signal: controller.signal,
254
+ };
255
+ if (body !== undefined) {
256
+ headers["Content-Type"] = "application/json";
257
+ init.body = JSON.stringify(body);
258
+ }
259
+ const res = await doFetch(`${baseURL}${path}${queryString}`, init);
260
+ clearTimeout(timeoutId);
261
+ if (!res.ok) {
262
+ let resBody = null;
263
+ try {
264
+ resBody = await res.json();
265
+ }
266
+ catch {
267
+ // ignore parse errors
268
+ }
269
+ throw new ElevenLabsError(formatErrorMessage(res.status, resBody), res.status, resBody, extractErrorCode(resBody));
270
+ }
271
+ const text = await res.text();
272
+ return (text ? JSON.parse(text) : {});
273
+ }
274
+ catch (error) {
275
+ clearTimeout(timeoutId);
276
+ if (error instanceof ElevenLabsError)
277
+ throw error;
278
+ throw new ElevenLabsError(`ElevenLabs request failed: ${error}`, 500);
279
+ }
280
+ }
127
281
  async function makeMultipartJsonRequest(path, form, query, signal) {
282
+ return makeMultipartJsonRequestWithMethod("POST", path, form, query, signal);
283
+ }
284
+ async function makeMultipartJsonRequestWithMethod(method, path, form, query, signal) {
128
285
  const controller = new AbortController();
129
286
  const timeoutId = setTimeout(() => controller.abort(), timeout);
130
287
  if (signal) {
@@ -133,7 +290,7 @@ export function createElevenLabs(opts) {
133
290
  const qs = query ? `?${new URLSearchParams(query).toString()}` : "";
134
291
  try {
135
292
  const res = await doFetch(`${baseURL}${path}${qs}`, {
136
- method: "POST",
293
+ method,
137
294
  headers: {
138
295
  "xi-api-key": opts.apiKey,
139
296
  },
@@ -160,6 +317,45 @@ export function createElevenLabs(opts) {
160
317
  throw new ElevenLabsError(`ElevenLabs request failed: ${error}`, 500);
161
318
  }
162
319
  }
320
+ // Like makeMultipartJsonRequest, but for endpoints that respond with raw
321
+ // audio bytes (e.g. the speech-to-speech voice changer) — uploads a multipart
322
+ // form and returns the response buffer.
323
+ async function makeMultipartBinaryRequest(path, form, query, signal) {
324
+ const controller = new AbortController();
325
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
326
+ if (signal) {
327
+ attachAbortHandler(signal, controller);
328
+ }
329
+ const qs = query ? `?${new URLSearchParams(query).toString()}` : "";
330
+ try {
331
+ const res = await doFetch(`${baseURL}${path}${qs}`, {
332
+ method: "POST",
333
+ headers: {
334
+ "xi-api-key": opts.apiKey,
335
+ },
336
+ body: form,
337
+ signal: controller.signal,
338
+ });
339
+ clearTimeout(timeoutId);
340
+ if (!res.ok) {
341
+ let resBody = null;
342
+ try {
343
+ resBody = await res.json();
344
+ }
345
+ catch {
346
+ // ignore parse errors
347
+ }
348
+ throw new ElevenLabsError(formatErrorMessage(res.status, resBody), res.status, resBody, extractErrorCode(resBody));
349
+ }
350
+ return await res.arrayBuffer();
351
+ }
352
+ catch (error) {
353
+ clearTimeout(timeoutId);
354
+ if (error instanceof ElevenLabsError)
355
+ throw error;
356
+ throw new ElevenLabsError(`ElevenLabs request failed: ${error}`, 500);
357
+ }
358
+ }
163
359
  async function makeRedirectRequest(method, path, signal) {
164
360
  const controller = new AbortController();
165
361
  const timeoutId = setTimeout(() => controller.abort(), timeout);
@@ -224,6 +420,17 @@ export function createElevenLabs(opts) {
224
420
  }
225
421
  return Object.keys(query).length > 0 ? query : undefined;
226
422
  }
423
+ // Parse a newline-delimited JSON (NDJSON) response body into an array of
424
+ // chunk objects. The streaming text-to-speech-with-timestamps endpoint emits
425
+ // one JSON object per line as audio is generated.
426
+ function decodeNdjson(buffer) {
427
+ const text = new TextDecoder().decode(buffer);
428
+ return text
429
+ .split("\n")
430
+ .map((line) => line.trim())
431
+ .filter((line) => line.length > 0)
432
+ .map((line) => JSON.parse(line));
433
+ }
227
434
  function buildQueryString(params) {
228
435
  const query = new URLSearchParams();
229
436
  for (const [key, value] of Object.entries(params)) {
@@ -242,6 +449,59 @@ export function createElevenLabs(opts) {
242
449
  const serialized = query.toString();
243
450
  return serialized ? `?${serialized}` : "";
244
451
  }
452
+ // GET https://api.elevenlabs.io/v1/pronunciation-dictionaries
453
+ // Docs: https://elevenlabs.io/docs/api-reference/pronunciation-dictionaries/list
454
+ const listPronunciationDictionaries = Object.assign(async (req = {}, signal) => {
455
+ return makeJsonRequest("GET", "/v1/pronunciation-dictionaries", undefined, signal, buildQueryString(req));
456
+ }, { schema: ElevenLabsListPronunciationDictionariesRequestSchema });
457
+ // POST https://api.elevenlabs.io/v1/pronunciation-dictionaries/add-from-file
458
+ // Docs: https://elevenlabs.io/docs/api-reference/pronunciation-dictionaries/create-from-file
459
+ const addPronunciationDictionaryFromFile = Object.assign(async (req, signal) => {
460
+ const form = new FormData();
461
+ appendFormField(form, "name", req.name);
462
+ if (req.file)
463
+ appendFormField(form, "file", req.file);
464
+ if (req.description)
465
+ appendFormField(form, "description", req.description);
466
+ if (req.workspace_access)
467
+ appendFormField(form, "workspace_access", req.workspace_access);
468
+ return makeMultipartJsonRequest("/v1/pronunciation-dictionaries/add-from-file", form, undefined, signal);
469
+ }, { schema: ElevenLabsAddPronunciationDictionaryFromFileRequestSchema });
470
+ // POST https://api.elevenlabs.io/v1/pronunciation-dictionaries/add-from-rules
471
+ // Docs: https://elevenlabs.io/docs/api-reference/pronunciation-dictionaries/create-from-rules
472
+ const addPronunciationDictionaryFromRules = Object.assign(async (req, signal) => {
473
+ return makeJsonRequest("POST", "/v1/pronunciation-dictionaries/add-from-rules", req, signal);
474
+ }, { schema: ElevenLabsAddPronunciationDictionaryFromRulesRequestSchema });
475
+ // GET https://api.elevenlabs.io/v1/pronunciation-dictionaries/{id}
476
+ // Docs: https://elevenlabs.io/docs/api-reference/pronunciation-dictionaries/get
477
+ const getPronunciationDictionary = Object.assign(async (id, req = {}, signal) => {
478
+ return makeJsonRequest("GET", `/v1/pronunciation-dictionaries/${encodeURIComponent(id)}`, undefined, signal, buildQueryString(req));
479
+ }, { schema: ElevenLabsGetPronunciationDictionaryRequestSchema });
480
+ // PATCH https://api.elevenlabs.io/v1/pronunciation-dictionaries/{id}
481
+ // Docs: https://elevenlabs.io/docs/api-reference/pronunciation-dictionaries/update
482
+ const updatePronunciationDictionary = Object.assign(async (id, req = {}, signal) => {
483
+ return makeJsonRequest("PATCH", `/v1/pronunciation-dictionaries/${encodeURIComponent(id)}`, req, signal);
484
+ }, { schema: ElevenLabsUpdatePronunciationDictionaryRequestSchema });
485
+ // POST https://api.elevenlabs.io/v1/pronunciation-dictionaries/{id}/add-rules
486
+ // Docs: https://elevenlabs.io/docs/api-reference/pronunciation-dictionaries/rules/add
487
+ const addPronunciationDictionaryRules = Object.assign(async (id, req, signal) => {
488
+ return makeJsonRequest("POST", `/v1/pronunciation-dictionaries/${encodeURIComponent(id)}/add-rules`, req, signal);
489
+ }, { schema: ElevenLabsAddPronunciationDictionaryRulesRequestSchema });
490
+ // POST https://api.elevenlabs.io/v1/pronunciation-dictionaries/{id}/remove-rules
491
+ // Docs: https://elevenlabs.io/docs/api-reference/pronunciation-dictionaries/rules/remove
492
+ const removePronunciationDictionaryRules = Object.assign(async (id, req, signal) => {
493
+ return makeJsonRequest("POST", `/v1/pronunciation-dictionaries/${encodeURIComponent(id)}/remove-rules`, req, signal);
494
+ }, { schema: ElevenLabsRemovePronunciationDictionaryRulesRequestSchema });
495
+ // POST https://api.elevenlabs.io/v1/pronunciation-dictionaries/{id}/set-rules
496
+ // Docs: https://elevenlabs.io/docs/api-reference/pronunciation-dictionaries/rules/set
497
+ const setPronunciationDictionaryRules = Object.assign(async (id, req, signal) => {
498
+ return makeJsonRequest("POST", `/v1/pronunciation-dictionaries/${encodeURIComponent(id)}/set-rules`, req, signal);
499
+ }, { schema: ElevenLabsSetPronunciationDictionaryRulesRequestSchema });
500
+ // GET https://api.elevenlabs.io/v1/pronunciation-dictionaries/{id}/{versionId}/download
501
+ // Docs: https://elevenlabs.io/docs/api-reference/pronunciation-dictionaries/download
502
+ const downloadPronunciationDictionary = Object.assign(async (id, versionId, req = {}, signal) => {
503
+ return makeGetBinaryRequest(`/v1/pronunciation-dictionaries/${encodeURIComponent(id)}/${encodeURIComponent(versionId)}/download`, buildQueryString(req), signal);
504
+ }, { schema: ElevenLabsDownloadPronunciationDictionaryRequestSchema });
245
505
  // -- Endpoints -------------------------------------------------------------
246
506
  // GET https://api.elevenlabs.io/docs
247
507
  // Docs: https://elevenlabs.io/docs/api-reference/text-to-speech
@@ -263,11 +523,93 @@ export function createElevenLabs(opts) {
263
523
  const getVoiceSettings = Object.assign(async (voiceId, signal) => {
264
524
  return makeJsonRequest("GET", `/v1/voices/${encodeURIComponent(voiceId)}/settings`, undefined, signal);
265
525
  }, { schema: undefined });
526
+ // GET https://api.elevenlabs.io/v1/voices
527
+ // Docs: https://elevenlabs.io/docs/api-reference/voices/get-all
528
+ const listV1Voices = Object.assign(async (req = {}, signal) => {
529
+ return makeJsonRequest("GET", "/v1/voices", undefined, signal, buildQueryString(req));
530
+ }, { schema: ElevenLabsListV1VoicesRequestSchema });
531
+ // DELETE https://api.elevenlabs.io/v1/voices/{voiceId}
532
+ // Docs: https://elevenlabs.io/docs/api-reference/voices/delete
533
+ const deleteVoice = Object.assign(async (voiceId, signal) => {
534
+ return makeJsonRequest("DELETE", `/v1/voices/${encodeURIComponent(voiceId)}`, undefined, signal);
535
+ }, { schema: undefined });
536
+ // POST https://api.elevenlabs.io/v1/voices/add
537
+ // Docs: https://elevenlabs.io/docs/api-reference/voices/ivc/create
538
+ const addVoice = async (req, signal) => {
539
+ const { files, ...rest } = req;
540
+ const form = new FormData();
541
+ for (const file of files) {
542
+ form.append("files", file);
543
+ }
544
+ for (const [key, value] of Object.entries(rest)) {
545
+ appendFormField(form, key, value);
546
+ }
547
+ return makeMultipartJsonRequest("/v1/voices/add", form, undefined, signal);
548
+ };
549
+ // POST https://api.elevenlabs.io/v1/voices/add/{publicUserId}/{voiceId}
550
+ // Docs: https://elevenlabs.io/docs/api-reference/voices/share
551
+ const addSharedVoice = Object.assign(async (publicUserId, voiceId, req, signal) => {
552
+ return makeJsonRequest("POST", `/v1/voices/add/${encodeURIComponent(publicUserId)}/${encodeURIComponent(voiceId)}`, req, signal);
553
+ }, { schema: ElevenLabsAddSharedVoiceRequestSchema });
554
+ // POST https://api.elevenlabs.io/v1/voices/{voiceId}/edit
555
+ // Docs: https://elevenlabs.io/docs/api-reference/voices/edit
556
+ const editVoice = Object.assign(async (voiceId, req, signal) => {
557
+ const { files, ...rest } = req;
558
+ const form = new FormData();
559
+ if (files) {
560
+ for (const file of files) {
561
+ form.append("files", file);
562
+ }
563
+ }
564
+ for (const [key, value] of Object.entries(rest)) {
565
+ appendFormField(form, key, value);
566
+ }
567
+ return makeMultipartJsonRequest(`/v1/voices/${encodeURIComponent(voiceId)}/edit`, form, undefined, signal);
568
+ }, { schema: ElevenLabsEditVoiceRequestSchema });
569
+ // POST https://api.elevenlabs.io/v1/voices/{voiceId}/settings/edit
570
+ // Docs: https://elevenlabs.io/docs/api-reference/voices/settings/update
571
+ const editVoiceSettings = Object.assign(async (voiceId, req, signal) => {
572
+ return makeJsonRequest("POST", `/v1/voices/${encodeURIComponent(voiceId)}/settings/edit`, req, signal);
573
+ }, { schema: ElevenLabsEditVoiceSettingsRequestSchema });
574
+ // GET https://api.elevenlabs.io/v1/voices/settings/default
575
+ // Docs: https://elevenlabs.io/docs/api-reference/voices/settings/get-default
576
+ const getDefaultVoiceSettings = Object.assign(async (signal) => {
577
+ return makeJsonRequest("GET", "/v1/voices/settings/default", undefined, signal);
578
+ }, { schema: undefined });
579
+ // DELETE https://api.elevenlabs.io/v1/voices/{voiceId}/samples/{sampleId}
580
+ // Docs: https://elevenlabs.io/docs/api-reference/samples/delete
581
+ const deleteVoiceSample = Object.assign(async (voiceId, sampleId, signal) => {
582
+ return makeJsonRequest("DELETE", `/v1/voices/${encodeURIComponent(voiceId)}/samples/${encodeURIComponent(sampleId)}`, undefined, signal);
583
+ }, { schema: undefined });
584
+ // GET https://api.elevenlabs.io/v1/voices/{voiceId}/samples/{sampleId}/audio
585
+ // Docs: https://elevenlabs.io/docs/api-reference/samples/audio
586
+ const getVoiceSampleAudio = Object.assign(async (voiceId, sampleId, signal) => {
587
+ return makeGetBinaryRequest(`/v1/voices/${encodeURIComponent(voiceId)}/samples/${encodeURIComponent(sampleId)}/audio`, "", signal);
588
+ }, { schema: undefined });
589
+ // GET https://api.elevenlabs.io/v1/shared-voices
590
+ // Docs: https://elevenlabs.io/docs/api-reference/voices/get-shared
591
+ const getSharedVoices = Object.assign(async (req = {}, signal) => {
592
+ return makeJsonRequest("GET", "/v1/shared-voices", undefined, signal, buildQueryString(req));
593
+ }, { schema: ElevenLabsSharedVoicesRequestSchema });
594
+ // POST https://api.elevenlabs.io/v1/similar-voices
595
+ // Docs: https://elevenlabs.io/docs/api-reference/voices/find-similar-voices
596
+ const getSimilarVoices = Object.assign(async (req = {}, signal) => {
597
+ const form = new FormData();
598
+ for (const [key, value] of Object.entries(req)) {
599
+ appendFormField(form, key, value);
600
+ }
601
+ return makeMultipartJsonRequest("/v1/similar-voices", form, undefined, signal);
602
+ }, { schema: ElevenLabsSimilarVoicesRequestSchema });
266
603
  // POST https://api.elevenlabs.io/v1/voices/pvc
267
604
  // Docs: https://elevenlabs.io/docs/api-reference/voices/pvc/create
268
605
  const createPvcVoice = Object.assign(async (req, signal) => {
269
606
  return makeJsonRequest("POST", "/v1/voices/pvc", req, signal);
270
607
  }, { schema: ElevenLabsCreatePvcVoiceRequestSchema });
608
+ // POST https://api.elevenlabs.io/v1/voices/pvc/{voiceId}
609
+ // Docs: https://elevenlabs.io/docs/api-reference/voices/pvc/edit
610
+ const editPvcVoice = Object.assign(async (voiceId, req, signal) => {
611
+ return makeJsonRequestAllowEmpty("POST", `/v1/voices/pvc/${encodeURIComponent(voiceId)}`, req, signal);
612
+ }, { schema: ElevenLabsEditPvcVoiceRequestSchema });
271
613
  // POST https://api.elevenlabs.io/v1/voices/pvc/{voiceId}/captcha
272
614
  // Docs: https://elevenlabs.io/docs/api-reference/voices/pvc/verification/captcha/verify
273
615
  const pvcVoiceCaptcha = Object.assign(async (voiceId, req, signal) => {
@@ -285,6 +627,29 @@ export function createElevenLabs(opts) {
285
627
  const updatePvcVoiceSample = Object.assign(async (voiceId, sampleId, req = {}, signal) => {
286
628
  return makeJsonRequest("POST", `/v1/voices/pvc/${encodeURIComponent(voiceId)}/samples/${encodeURIComponent(sampleId)}`, req, signal);
287
629
  }, { schema: ElevenLabsUpdatePvcVoiceSampleRequestSchema });
630
+ // POST https://api.elevenlabs.io/v1/voices/pvc/{voiceId}/samples
631
+ // Docs: https://elevenlabs.io/docs/api-reference/voices/pvc/samples/create
632
+ const addPvcSamples = Object.assign(async (voiceId, req, signal) => {
633
+ const { files, ...rest } = req;
634
+ const form = new FormData();
635
+ for (const file of files) {
636
+ form.append("files", file);
637
+ }
638
+ for (const [key, value] of Object.entries(rest)) {
639
+ appendFormField(form, key, value);
640
+ }
641
+ return makeMultipartJsonRequest(`/v1/voices/pvc/${encodeURIComponent(voiceId)}/samples`, form, undefined, signal);
642
+ }, { schema: ElevenLabsAddPvcSamplesRequestSchema });
643
+ // GET https://api.elevenlabs.io/v1/voices/pvc/{voiceId}/samples/{sampleId}/audio
644
+ // Docs: https://elevenlabs.io/docs/api-reference/voices/pvc/samples/audio
645
+ const getPvcSampleAudio = Object.assign(async (voiceId, sampleId, req = {}, signal) => {
646
+ return makeJsonRequest("GET", `/v1/voices/pvc/${encodeURIComponent(voiceId)}/samples/${encodeURIComponent(sampleId)}/audio`, undefined, signal, buildQueryString(req));
647
+ }, { schema: ElevenLabsGetPvcSampleAudioRequestSchema });
648
+ // GET https://api.elevenlabs.io/v1/voices/pvc/{voiceId}/samples/{sampleId}/speakers
649
+ // Docs: https://elevenlabs.io/docs/api-reference/voices/pvc/samples/speakers
650
+ const getPvcSampleSpeakers = Object.assign(async (voiceId, sampleId, signal) => {
651
+ return makeJsonRequest("GET", `/v1/voices/pvc/${encodeURIComponent(voiceId)}/samples/${encodeURIComponent(sampleId)}/speakers`, undefined, signal);
652
+ }, { schema: undefined });
288
653
  // POST https://api.elevenlabs.io/v1/voices/pvc/{voiceId}/samples/{sampleId}/separate-speakers
289
654
  // Docs: https://elevenlabs.io/docs/api-reference/voices/pvc/samples/separate-speakers
290
655
  const startSpeakerSeparation = Object.assign(async (voiceId, sampleId, signal) => {
@@ -322,98 +687,1950 @@ export function createElevenLabs(opts) {
322
687
  const query = output_format ? { output_format } : undefined;
323
688
  return makeBinaryRequest("/v1/sound-generation", body, query, signal);
324
689
  }, { schema: ElevenLabsSoundGenerationRequestSchema });
325
- // POST https://api.elevenlabs.io/v1/text-to-speech/{voiceId}
326
- // Docs: https://elevenlabs.io/docs/api-reference/text-to-speech/convert
327
- const textToSpeech = Object.assign(async (voiceId, req, signal) => {
328
- const { output_format, enable_logging, ...body } = req;
329
- const query = optionalQuery({
330
- output_format,
331
- enable_logging: enable_logging === undefined ? undefined : String(enable_logging),
332
- });
333
- return makeBinaryRequest(`/v1/text-to-speech/${encodeURIComponent(voiceId)}`, body, query, signal);
334
- }, { schema: ElevenLabsTextToSpeechRequestSchema });
335
- // POST https://api.elevenlabs.io/v1/text-to-dialogue
336
- // Docs: https://elevenlabs.io/docs/api-reference/text-to-dialogue/convert
337
- const textToDialogue = Object.assign(async (req, signal) => {
338
- const { output_format, ...body } = req;
339
- const query = optionalQuery({ output_format });
340
- return makeBinaryRequest("/v1/text-to-dialogue", body, query, signal);
341
- }, { schema: ElevenLabsTextToDialogueRequestSchema });
342
- // POST https://api.elevenlabs.io/v1/speech-to-text
343
- // Docs: https://elevenlabs.io/docs/api-reference/speech-to-text/convert
344
- const speechToText = Object.assign(async (req, signal) => {
345
- const { enable_logging, ...body } = req;
346
- const query = enable_logging !== undefined
347
- ? { enable_logging: String(enable_logging) }
348
- : undefined;
690
+ // POST https://api.elevenlabs.io/v1/audio-isolation/stream
691
+ // Docs: https://elevenlabs.io/docs/api-reference/audio-isolation/stream
692
+ const audioIsolationStream = Object.assign(async (req, signal) => {
349
693
  const form = new FormData();
350
- for (const [key, value] of Object.entries(body)) {
694
+ for (const [key, value] of Object.entries(req)) {
351
695
  appendFormField(form, key, value);
352
696
  }
353
- return makeMultipartJsonRequest("/v1/speech-to-text", form, query, signal);
354
- }, { schema: ElevenLabsSpeechToTextRequestSchema });
355
- // POST https://api.elevenlabs.io/v1/workspace/analytics/query/usage-by-product-over-time
356
- // Docs: https://elevenlabs.io/docs/api-reference/workspace/usage/get-usage-by-product-over-time
357
- const usageByProductOverTime = Object.assign(async (req, signal) => {
358
- return makeJsonRequest("POST", "/v1/workspace/analytics/query/usage-by-product-over-time", req, signal);
697
+ return makeMultipartBinaryRequest("/v1/audio-isolation/stream", form, undefined, signal);
698
+ }, { schema: ElevenLabsAudioIsolationStreamRequestSchema });
699
+ // GET https://api.elevenlabs.io/v1/audio-isolation/history
700
+ // Docs: https://elevenlabs.io/docs/api-reference/audio-isolation/list
701
+ const listAudioIsolationHistory = Object.assign(async (req = {}, signal) => {
702
+ return makeJsonRequest("GET", "/v1/audio-isolation/history", undefined, signal, buildQueryString(req));
703
+ }, { schema: ElevenLabsAudioIsolationHistoryListRequestSchema });
704
+ // DELETE https://api.elevenlabs.io/v1/audio-isolation/history/{historyItemId}
705
+ // Docs: https://elevenlabs.io/docs/api-reference/audio-isolation/delete
706
+ const deleteAudioIsolationHistoryItem = Object.assign(async (historyItemId, signal) => {
707
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/audio-isolation/history/${encodeURIComponent(historyItemId)}`, undefined, signal);
708
+ }, { schema: undefined });
709
+ // POST https://api.elevenlabs.io/v1/audio-isolation
710
+ // Docs: https://elevenlabs.io/docs/api-reference/audio-isolation/convert
711
+ const audioIsolation = Object.assign(async (req, signal) => {
712
+ const form = new FormData();
713
+ for (const [key, value] of Object.entries(req)) {
714
+ appendFormField(form, key, value);
715
+ }
716
+ return makeMultipartBinaryRequest("/v1/audio-isolation", form, undefined, signal);
359
717
  }, {
360
- schema: ElevenLabsWorkspaceAnalyticsUsageByProductOverTimeRequestSchema,
718
+ schema: ElevenLabsAudioIsolationRequestSchema,
719
+ stream: audioIsolationStream,
720
+ history: {
721
+ list: listAudioIsolationHistory,
722
+ delete: deleteAudioIsolationHistoryItem,
723
+ },
361
724
  });
362
- // POST https://api.elevenlabs.io/v1/voices/pvc/{voiceId}/verification
363
- // Docs: https://elevenlabs.io/docs/api-reference/voices/pvc/verification/request
364
- const pvcManualVerification = Object.assign(async (voiceId, req, signal) => {
725
+ // POST https://api.elevenlabs.io/v1/audio-native/content
726
+ // Docs: https://elevenlabs.io/docs/api-reference/audio-native/update-content
727
+ const updateAudioNativeContentFromUrl = Object.assign(async (req, signal) => {
728
+ return makeJsonRequest("POST", "/v1/audio-native/content", req, signal);
729
+ }, { schema: ElevenLabsAudioNativeUpdateContentFromUrlRequestSchema });
730
+ // POST https://api.elevenlabs.io/v1/audio-native/{projectId}/content
731
+ // Docs: https://elevenlabs.io/docs/api-reference/audio-native/update-content
732
+ const updateAudioNativeProjectContent = Object.assign(async (projectId, req = {}, signal) => {
365
733
  const form = new FormData();
366
- for (const file of req.files) {
367
- form.append("files", file);
734
+ for (const [key, value] of Object.entries(req)) {
735
+ appendFormField(form, key, value);
368
736
  }
369
- appendFormField(form, "extra_text", req.extra_text);
370
- return makeMultipartJsonRequest(`/v1/voices/pvc/${encodeURIComponent(voiceId)}/verification`, form, undefined, signal);
371
- }, { schema: ElevenLabsPvcManualVerificationRequestSchema });
372
- // GET https://api.elevenlabs.io/v1/user/subscription
373
- // Docs: https://elevenlabs.io/docs/api-reference/user/subscription/get
374
- const userSubscription = Object.assign(async (signal) => {
375
- const subscription = await makeJsonRequest("GET", "/v1/user/subscription", undefined, signal);
376
- return {
377
- ...subscription,
378
- remaining_character_count: Math.max(0, subscription.character_limit - subscription.character_count),
379
- };
737
+ return makeMultipartJsonRequest(`/v1/audio-native/${encodeURIComponent(projectId)}/content`, form, undefined, signal);
738
+ }, { schema: ElevenLabsAudioNativeUpdateProjectContentRequestSchema });
739
+ // GET https://api.elevenlabs.io/v1/audio-native/{projectId}/settings
740
+ // Docs: https://elevenlabs.io/docs/api-reference/audio-native/get-settings
741
+ const getAudioNativeProjectSettings = Object.assign(async (projectId, signal) => {
742
+ return makeJsonRequest("GET", `/v1/audio-native/${encodeURIComponent(projectId)}/settings`, undefined, signal);
380
743
  }, { schema: undefined });
381
- // POST https://api.elevenlabs.io/v1/workspace/analytics/requests
382
- // Docs: https://elevenlabs.io/docs/api-reference/workspace/analytics/requests/get
744
+ // POST https://api.elevenlabs.io/v1/audio-native
745
+ // Docs: https://elevenlabs.io/docs/api-reference/audio-native/create
746
+ const audioNative = Object.assign(async (req, signal) => {
747
+ const form = new FormData();
748
+ for (const [key, value] of Object.entries(req)) {
749
+ appendFormField(form, key, value);
750
+ }
751
+ return makeMultipartJsonRequest("/v1/audio-native", form, undefined, signal);
752
+ }, {
753
+ schema: ElevenLabsAudioNativeCreateProjectRequestSchema,
754
+ content: {
755
+ fromUrl: updateAudioNativeContentFromUrl,
756
+ update: updateAudioNativeProjectContent,
757
+ },
758
+ settings: getAudioNativeProjectSettings,
759
+ });
760
+ // POST https://api.elevenlabs.io/v1/forced-alignment
761
+ // Docs: https://elevenlabs.io/docs/api-reference/forced-alignment/create
762
+ const forcedAlignment = Object.assign(async (req, signal) => {
763
+ const form = new FormData();
764
+ for (const [key, value] of Object.entries(req)) {
765
+ appendFormField(form, key, value);
766
+ }
767
+ return makeMultipartJsonRequest("/v1/forced-alignment", form, undefined, signal);
768
+ }, { schema: ElevenLabsForcedAlignmentRequestSchema });
769
+ // POST https://api.elevenlabs.io/v1/music/detailed
770
+ // Docs: https://elevenlabs.io/docs/api-reference/music/compose-detailed
771
+ const composeMusicDetailed = Object.assign(async (req, signal) => {
772
+ const { output_format, ...body } = req;
773
+ const query = output_format ? { output_format } : undefined;
774
+ return makeBinaryRequest("/v1/music/detailed", body, query, signal);
775
+ }, { schema: ElevenLabsComposeMusicDetailedRequestSchema });
776
+ // POST https://api.elevenlabs.io/v1/music/plan
777
+ // Docs: https://elevenlabs.io/docs/api-reference/music/compose-plan
778
+ const musicPlan = Object.assign(async (req, signal) => {
779
+ return makeJsonRequest("POST", "/v1/music/plan", req, signal);
780
+ }, { schema: ElevenLabsMusicPlanRequestSchema });
781
+ // POST https://api.elevenlabs.io/v1/music/stream
782
+ // Docs: https://elevenlabs.io/docs/api-reference/music/compose-stream
783
+ const composeMusicStream = Object.assign(async (req, signal) => {
784
+ const { output_format, ...body } = req;
785
+ const query = output_format ? { output_format } : undefined;
786
+ return makeBinaryRequest("/v1/music/stream", body, query, signal);
787
+ }, { schema: ElevenLabsComposeMusicStreamRequestSchema });
788
+ // POST https://api.elevenlabs.io/v1/music/stem-separation
789
+ // Docs: https://elevenlabs.io/docs/api-reference/music/stem-separation
790
+ const musicStemSeparation = Object.assign(async (req, signal) => {
791
+ const { output_format, ...body } = req;
792
+ const form = new FormData();
793
+ for (const [key, value] of Object.entries(body)) {
794
+ appendFormField(form, key, value);
795
+ }
796
+ const query = output_format ? { output_format } : undefined;
797
+ return makeMultipartBinaryRequest("/v1/music/stem-separation", form, query, signal);
798
+ }, { schema: ElevenLabsMusicStemSeparationRequestSchema });
799
+ // POST https://api.elevenlabs.io/v1/music/upload
800
+ // Docs: https://elevenlabs.io/docs/api-reference/music/upload
801
+ const musicUpload = Object.assign(async (req, signal) => {
802
+ const form = new FormData();
803
+ for (const [key, value] of Object.entries(req)) {
804
+ appendFormField(form, key, value);
805
+ }
806
+ return makeMultipartJsonRequest("/v1/music/upload", form, undefined, signal);
807
+ }, { schema: ElevenLabsMusicUploadRequestSchema });
808
+ // POST https://api.elevenlabs.io/v1/music/video-to-music
809
+ // Docs: https://elevenlabs.io/docs/api-reference/music/video-to-music
810
+ const videoToMusic = Object.assign(async (req, signal) => {
811
+ const { output_format, videos, tags, ...rest } = req;
812
+ const form = new FormData();
813
+ for (const video of videos) {
814
+ form.append("videos", video);
815
+ }
816
+ if (tags) {
817
+ for (const tag of tags) {
818
+ form.append("tags", tag);
819
+ }
820
+ }
821
+ for (const [key, value] of Object.entries(rest)) {
822
+ appendFormField(form, key, value);
823
+ }
824
+ const query = output_format ? { output_format } : undefined;
825
+ return makeMultipartBinaryRequest("/v1/music/video-to-music", form, query, signal);
826
+ }, { schema: ElevenLabsVideoToMusicRequestSchema });
827
+ // POST https://api.elevenlabs.io/v1/music
828
+ // Docs: https://elevenlabs.io/docs/api-reference/music/compose
829
+ const music = Object.assign(async (req, signal) => {
830
+ const { output_format, ...body } = req;
831
+ const query = output_format ? { output_format } : undefined;
832
+ return makeBinaryRequest("/v1/music", body, query, signal);
833
+ }, {
834
+ schema: ElevenLabsComposeMusicRequestSchema,
835
+ detailed: composeMusicDetailed,
836
+ plan: musicPlan,
837
+ stream: composeMusicStream,
838
+ stemSeparation: musicStemSeparation,
839
+ upload: musicUpload,
840
+ videoToMusic: videoToMusic,
841
+ });
842
+ // GET https://api.elevenlabs.io/v1/speech-engine
843
+ // Docs: https://elevenlabs.io/docs/api-reference/speech-engine/list
844
+ const listSpeechEngines = Object.assign(async (req = {}, signal) => {
845
+ return makeJsonRequest("GET", "/v1/speech-engine", undefined, signal, buildQueryString(req));
846
+ }, { schema: ElevenLabsListSpeechEnginesRequestSchema });
847
+ // POST https://api.elevenlabs.io/v1/speech-engine
848
+ // Docs: https://elevenlabs.io/docs/api-reference/speech-engine/create
849
+ const createSpeechEngine = Object.assign(async (req, signal) => {
850
+ return makeJsonRequest("POST", "/v1/speech-engine", req, signal);
851
+ }, { schema: ElevenLabsCreateSpeechEngineRequestSchema });
852
+ // GET https://api.elevenlabs.io/v1/speech-engine/{speechEngineId}
853
+ // Docs: https://elevenlabs.io/docs/api-reference/speech-engine/get
854
+ const getSpeechEngine = Object.assign(async (speechEngineId, signal) => {
855
+ return makeJsonRequest("GET", `/v1/speech-engine/${encodeURIComponent(speechEngineId)}`, undefined, signal);
856
+ }, { schema: undefined });
857
+ // PATCH https://api.elevenlabs.io/v1/speech-engine/{speechEngineId}
858
+ // Docs: https://elevenlabs.io/docs/api-reference/speech-engine/update
859
+ const updateSpeechEngine = Object.assign(async (speechEngineId, req, signal) => {
860
+ return makeJsonRequest("PATCH", `/v1/speech-engine/${encodeURIComponent(speechEngineId)}`, req, signal);
861
+ }, { schema: ElevenLabsUpdateSpeechEngineRequestSchema });
862
+ // DELETE https://api.elevenlabs.io/v1/speech-engine/{speechEngineId}
863
+ // Docs: https://elevenlabs.io/docs/api-reference/speech-engine/delete
864
+ const deleteSpeechEngine = Object.assign(async (speechEngineId, signal) => {
865
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/speech-engine/${encodeURIComponent(speechEngineId)}`, undefined, signal);
866
+ }, { schema: undefined });
867
+ const speechEngine = {
868
+ list: listSpeechEngines,
869
+ create: createSpeechEngine,
870
+ get: getSpeechEngine,
871
+ update: updateSpeechEngine,
872
+ delete: deleteSpeechEngine,
873
+ };
874
+ // GET https://api.elevenlabs.io/v1/productions/orders
875
+ // Docs: https://elevenlabs.io/docs/api-reference/productions/orders/list
876
+ const listOrders = Object.assign(async (req = {}, signal) => {
877
+ return makeJsonRequest("GET", "/v1/productions/orders", undefined, signal, buildQueryString(req));
878
+ }, { schema: ElevenLabsListOrdersRequestSchema });
879
+ // POST https://api.elevenlabs.io/v1/productions/orders
880
+ // Docs: https://elevenlabs.io/docs/api-reference/productions/orders/create
881
+ const createOrder = Object.assign(async (req = {}, signal) => {
882
+ return makeJsonRequest("POST", "/v1/productions/orders", req, signal);
883
+ }, { schema: ElevenLabsCreateOrderRequestSchema });
884
+ // GET https://api.elevenlabs.io/v1/productions/orders/{orderId}
885
+ // Docs: https://elevenlabs.io/docs/api-reference/productions/orders/get
886
+ const getOrder = Object.assign(async (orderId, signal) => {
887
+ return makeJsonRequest("GET", `/v1/productions/orders/${encodeURIComponent(orderId)}`, undefined, signal);
888
+ }, { schema: undefined });
889
+ // PATCH https://api.elevenlabs.io/v1/productions/orders/{orderId}
890
+ // Docs: https://elevenlabs.io/docs/api-reference/productions/orders/update
891
+ const updateOrder = Object.assign(async (orderId, req, signal) => {
892
+ return makeJsonRequest("PATCH", `/v1/productions/orders/${encodeURIComponent(orderId)}`, { request: req }, signal);
893
+ }, { schema: ElevenLabsUpdateOrderRequestSchema });
894
+ // POST https://api.elevenlabs.io/v1/productions/orders/{orderId}/submit
895
+ // Docs: https://elevenlabs.io/docs/api-reference/productions/orders/submit
896
+ const submitOrder = Object.assign(async (orderId, signal) => {
897
+ return makeJsonRequest("POST", `/v1/productions/orders/${encodeURIComponent(orderId)}/submit`, undefined, signal);
898
+ }, { schema: undefined });
899
+ // GET https://api.elevenlabs.io/v1/productions/orders/{orderId}/deliverables
900
+ // Docs: https://elevenlabs.io/docs/api-reference/productions/orders/deliverables
901
+ const getOrderDeliverables = Object.assign(async (orderId, signal) => {
902
+ return makeJsonRequest("GET", `/v1/productions/orders/${encodeURIComponent(orderId)}/deliverables`, undefined, signal);
903
+ }, { schema: undefined });
904
+ // POST https://api.elevenlabs.io/v1/productions/orders/{orderId}/items
905
+ // Docs: https://elevenlabs.io/docs/api-reference/productions/orders/items/upsert
906
+ const upsertOrderItem = Object.assign(async (orderId, req, signal) => {
907
+ return makeJsonRequest("POST", `/v1/productions/orders/${encodeURIComponent(orderId)}/items`, { request: req }, signal);
908
+ }, { schema: ElevenLabsUpsertOrderItemRequestSchema });
909
+ // DELETE https://api.elevenlabs.io/v1/productions/orders/{orderId}/items/{itemId}
910
+ // Docs: https://elevenlabs.io/docs/api-reference/productions/orders/items/remove
911
+ const removeOrderItem = Object.assign(async (orderId, itemId, signal) => {
912
+ return makeJsonRequest("DELETE", `/v1/productions/orders/${encodeURIComponent(orderId)}/items/${encodeURIComponent(itemId)}`, undefined, signal);
913
+ }, { schema: undefined });
914
+ // POST https://api.elevenlabs.io/v1/productions/orders/{orderId}/media
915
+ // Docs: https://elevenlabs.io/docs/api-reference/productions/orders/media/register
916
+ const registerOrderMedia = Object.assign(async (orderId, req, signal) => {
917
+ const form = new FormData();
918
+ for (const [key, value] of Object.entries(req)) {
919
+ appendFormField(form, key, value);
920
+ }
921
+ return makeMultipartJsonRequest(`/v1/productions/orders/${encodeURIComponent(orderId)}/media`, form, undefined, signal);
922
+ }, { schema: ElevenLabsRegisterOrderMediaRequestSchema });
923
+ // GET https://api.elevenlabs.io/v1/productions/orders/{orderId}/media/{mediaId}
924
+ // Docs: https://elevenlabs.io/docs/api-reference/productions/orders/media/get
925
+ const getOrderMedia = Object.assign(async (orderId, mediaId, signal) => {
926
+ return makeJsonRequest("GET", `/v1/productions/orders/${encodeURIComponent(orderId)}/media/${encodeURIComponent(mediaId)}`, undefined, signal);
927
+ }, { schema: undefined });
928
+ // GET https://api.elevenlabs.io/v1/productions/orders/languages/{orderItemKind}
929
+ // Docs: https://elevenlabs.io/docs/api-reference/productions/orders/languages
930
+ const getOrderLanguages = Object.assign(async (orderItemKind, signal) => {
931
+ return makeJsonRequest("GET", `/v1/productions/orders/languages/${encodeURIComponent(orderItemKind)}`, undefined, signal);
932
+ }, { schema: undefined });
933
+ const productionsOrders = {
934
+ list: listOrders,
935
+ create: createOrder,
936
+ get: getOrder,
937
+ update: updateOrder,
938
+ submit: submitOrder,
939
+ deliverables: getOrderDeliverables,
940
+ items: {
941
+ upsert: upsertOrderItem,
942
+ remove: removeOrderItem,
943
+ },
944
+ media: {
945
+ register: registerOrderMedia,
946
+ get: getOrderMedia,
947
+ },
948
+ languages: getOrderLanguages,
949
+ };
950
+ const productions = {
951
+ orders: productionsOrders,
952
+ };
953
+ // POST https://api.elevenlabs.io/v1/text-to-speech/{voiceId}/stream/with-timestamps
954
+ // Docs: https://elevenlabs.io/docs/api-reference/text-to-speech/stream-with-timestamps
955
+ const textToSpeechStreamWithTimestamps = Object.assign(async (voiceId, req, signal) => {
956
+ const { output_format, enable_logging, ...body } = req;
957
+ const query = optionalQuery({
958
+ output_format,
959
+ enable_logging: enable_logging === undefined ? undefined : String(enable_logging),
960
+ });
961
+ const buffer = await makeBinaryRequest(`/v1/text-to-speech/${encodeURIComponent(voiceId)}/stream/with-timestamps`, body, query, signal);
962
+ return decodeNdjson(buffer);
963
+ }, { schema: ElevenLabsTextToSpeechRequestSchema });
964
+ // POST https://api.elevenlabs.io/v1/text-to-speech/{voiceId}/stream
965
+ // Docs: https://elevenlabs.io/docs/api-reference/text-to-speech/stream
966
+ const textToSpeechStream = Object.assign(async (voiceId, req, signal) => {
967
+ const { output_format, enable_logging, ...body } = req;
968
+ const query = optionalQuery({
969
+ output_format,
970
+ enable_logging: enable_logging === undefined ? undefined : String(enable_logging),
971
+ });
972
+ return makeBinaryRequest(`/v1/text-to-speech/${encodeURIComponent(voiceId)}/stream`, body, query, signal);
973
+ }, {
974
+ schema: ElevenLabsTextToSpeechRequestSchema,
975
+ withTimestamps: textToSpeechStreamWithTimestamps,
976
+ });
977
+ // POST https://api.elevenlabs.io/v1/text-to-speech/{voiceId}/with-timestamps
978
+ // Docs: https://elevenlabs.io/docs/api-reference/text-to-speech/convert-with-timestamps
979
+ const textToSpeechWithTimestamps = Object.assign(async (voiceId, req, signal) => {
980
+ const { output_format, enable_logging, ...body } = req;
981
+ const query = buildQueryString({ output_format, enable_logging });
982
+ return makeJsonRequest("POST", `/v1/text-to-speech/${encodeURIComponent(voiceId)}/with-timestamps`, body, signal, query);
983
+ }, { schema: ElevenLabsTextToSpeechRequestSchema });
984
+ // POST https://api.elevenlabs.io/v1/text-to-speech/{voiceId}
985
+ // Docs: https://elevenlabs.io/docs/api-reference/text-to-speech/convert
986
+ const textToSpeech = Object.assign(async (voiceId, req, signal) => {
987
+ const { output_format, enable_logging, ...body } = req;
988
+ const query = optionalQuery({
989
+ output_format,
990
+ enable_logging: enable_logging === undefined ? undefined : String(enable_logging),
991
+ });
992
+ return makeBinaryRequest(`/v1/text-to-speech/${encodeURIComponent(voiceId)}`, body, query, signal);
993
+ }, {
994
+ schema: ElevenLabsTextToSpeechRequestSchema,
995
+ stream: textToSpeechStream,
996
+ withTimestamps: textToSpeechWithTimestamps,
997
+ });
998
+ // POST https://api.elevenlabs.io/v1/text-to-dialogue/stream/with-timestamps
999
+ // Docs: https://elevenlabs.io/docs/api-reference/text-to-dialogue/stream-with-timestamps
1000
+ const textToDialogueStreamWithTimestamps = Object.assign(async (req, signal) => {
1001
+ const { output_format, enable_logging, ...body } = req;
1002
+ const query = optionalQuery({
1003
+ output_format,
1004
+ enable_logging: enable_logging === undefined ? undefined : String(enable_logging),
1005
+ });
1006
+ const buffer = await makeBinaryRequest("/v1/text-to-dialogue/stream/with-timestamps", body, query, signal);
1007
+ return decodeNdjson(buffer);
1008
+ }, { schema: ElevenLabsTextToDialogueRequestSchema });
1009
+ // POST https://api.elevenlabs.io/v1/text-to-dialogue/stream
1010
+ // Docs: https://elevenlabs.io/docs/api-reference/text-to-dialogue/stream
1011
+ const textToDialogueStream = Object.assign(async (req, signal) => {
1012
+ const { output_format, enable_logging, ...body } = req;
1013
+ const query = optionalQuery({
1014
+ output_format,
1015
+ enable_logging: enable_logging === undefined ? undefined : String(enable_logging),
1016
+ });
1017
+ return makeBinaryRequest("/v1/text-to-dialogue/stream", body, query, signal);
1018
+ }, {
1019
+ schema: ElevenLabsTextToDialogueRequestSchema,
1020
+ withTimestamps: textToDialogueStreamWithTimestamps,
1021
+ });
1022
+ // POST https://api.elevenlabs.io/v1/text-to-dialogue/with-timestamps
1023
+ // Docs: https://elevenlabs.io/docs/api-reference/text-to-dialogue/convert-with-timestamps
1024
+ const textToDialogueWithTimestamps = Object.assign(async (req, signal) => {
1025
+ const { output_format, enable_logging, ...body } = req;
1026
+ const query = buildQueryString({ output_format, enable_logging });
1027
+ return makeJsonRequest("POST", "/v1/text-to-dialogue/with-timestamps", body, signal, query);
1028
+ }, { schema: ElevenLabsTextToDialogueRequestSchema });
1029
+ // POST https://api.elevenlabs.io/v1/text-to-dialogue
1030
+ // Docs: https://elevenlabs.io/docs/api-reference/text-to-dialogue/convert
1031
+ const textToDialogue = Object.assign(async (req, signal) => {
1032
+ const { output_format, enable_logging, ...body } = req;
1033
+ const query = optionalQuery({
1034
+ output_format,
1035
+ enable_logging: enable_logging === undefined ? undefined : String(enable_logging),
1036
+ });
1037
+ return makeBinaryRequest("/v1/text-to-dialogue", body, query, signal);
1038
+ }, {
1039
+ schema: ElevenLabsTextToDialogueRequestSchema,
1040
+ stream: textToDialogueStream,
1041
+ withTimestamps: textToDialogueWithTimestamps,
1042
+ });
1043
+ // POST https://api.elevenlabs.io/v1/text-to-voice
1044
+ // Docs: https://elevenlabs.io/docs/api-reference/text-to-voice/create
1045
+ const textToVoiceCreateVoice = Object.assign(async (req, signal) => {
1046
+ return makeJsonRequest("POST", "/v1/text-to-voice", req, signal);
1047
+ }, { schema: ElevenLabsCreateVoiceFromPreviewRequestSchema });
1048
+ // POST https://api.elevenlabs.io/v1/text-to-voice/design
1049
+ // Docs: https://elevenlabs.io/docs/api-reference/text-to-voice/design
1050
+ const textToVoiceDesign = Object.assign(async (req, signal) => {
1051
+ const { output_format, ...body } = req;
1052
+ const query = optionalQuery({ output_format });
1053
+ return makeJsonRequest("POST", "/v1/text-to-voice/design", Object.keys(body).length > 0 ? body : undefined, signal, query ? buildQueryString(query) : "");
1054
+ }, { schema: ElevenLabsVoiceDesignRequestSchema });
1055
+ // POST https://api.elevenlabs.io/v1/text-to-voice/{voiceId}/remix
1056
+ // Docs: https://elevenlabs.io/docs/api-reference/text-to-voice/remix
1057
+ const textToVoiceRemix = Object.assign(async (voiceId, req, signal) => {
1058
+ const { output_format, ...body } = req;
1059
+ const query = optionalQuery({ output_format });
1060
+ return makeJsonRequest("POST", `/v1/text-to-voice/${encodeURIComponent(voiceId)}/remix`, Object.keys(body).length > 0 ? body : undefined, signal, query ? buildQueryString(query) : "");
1061
+ }, { schema: ElevenLabsVoiceRemixRequestSchema });
1062
+ // GET https://api.elevenlabs.io/v1/text-to-voice/{generatedVoiceId}/stream
1063
+ // Docs: https://elevenlabs.io/docs/api-reference/text-to-voice/stream
1064
+ const textToVoiceStream = Object.assign(async (generatedVoiceId, signal) => {
1065
+ return makeGetBinaryRequest(`/v1/text-to-voice/${encodeURIComponent(generatedVoiceId)}/stream`, "", signal);
1066
+ }, { schema: undefined });
1067
+ // Callable text-to-voice namespace: create (POST) is the base call, with
1068
+ // design/remix (POST) and stream (GET) attached as sub-methods.
1069
+ const textToVoice = Object.assign(textToVoiceCreateVoice, {
1070
+ design: textToVoiceDesign,
1071
+ remix: textToVoiceRemix,
1072
+ stream: textToVoiceStream,
1073
+ });
1074
+ // GET https://api.elevenlabs.io/v1/speech-to-text/transcripts/{transcriptionId}
1075
+ // Docs: https://elevenlabs.io/docs/api-reference/speech-to-text/transcripts/get
1076
+ const getTranscript = Object.assign(async (transcriptionId, signal) => {
1077
+ return makeJsonRequest("GET", `/v1/speech-to-text/transcripts/${encodeURIComponent(transcriptionId)}`, undefined, signal);
1078
+ }, { schema: undefined });
1079
+ // DELETE https://api.elevenlabs.io/v1/speech-to-text/transcripts/{transcriptionId}
1080
+ // Docs: https://elevenlabs.io/docs/api-reference/speech-to-text/transcripts/delete
1081
+ const deleteTranscript = Object.assign(async (transcriptionId, signal) => {
1082
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/speech-to-text/transcripts/${encodeURIComponent(transcriptionId)}`, undefined, signal);
1083
+ }, { schema: undefined });
1084
+ // POST https://api.elevenlabs.io/v1/speech-to-text
1085
+ // Docs: https://elevenlabs.io/docs/api-reference/speech-to-text/convert
1086
+ const speechToText = Object.assign(async (req, signal) => {
1087
+ const { enable_logging, ...body } = req;
1088
+ const query = enable_logging !== undefined
1089
+ ? { enable_logging: String(enable_logging) }
1090
+ : undefined;
1091
+ const form = new FormData();
1092
+ for (const [key, value] of Object.entries(body)) {
1093
+ appendFormField(form, key, value);
1094
+ }
1095
+ return makeMultipartJsonRequest("/v1/speech-to-text", form, query, signal);
1096
+ }, {
1097
+ schema: ElevenLabsSpeechToTextRequestSchema,
1098
+ transcripts: {
1099
+ get: getTranscript,
1100
+ delete: deleteTranscript,
1101
+ },
1102
+ });
1103
+ // GET https://api.elevenlabs.io/v1/dubbing
1104
+ // Docs: https://elevenlabs.io/docs/api-reference/dubbing/list
1105
+ const listDubbing = Object.assign(async (req = {}, signal) => {
1106
+ return makeJsonRequest("GET", "/v1/dubbing", undefined, signal, buildQueryString(req));
1107
+ }, { schema: ElevenLabsListDubbingRequestSchema });
1108
+ // POST https://api.elevenlabs.io/v1/dubbing
1109
+ // Docs: https://elevenlabs.io/docs/api-reference/dubbing/create
1110
+ const createDubbing = Object.assign(async (req, signal) => {
1111
+ const form = new FormData();
1112
+ for (const [key, value] of Object.entries(req)) {
1113
+ appendFormField(form, key, value);
1114
+ }
1115
+ return makeMultipartJsonRequest("/v1/dubbing", form, undefined, signal);
1116
+ }, { schema: ElevenLabsCreateDubbingRequestSchema });
1117
+ // GET https://api.elevenlabs.io/v1/dubbing/{dubbingId}
1118
+ // Docs: https://elevenlabs.io/docs/api-reference/dubbing/get
1119
+ const getDubbing = Object.assign(async (dubbingId, signal) => {
1120
+ return makeJsonRequest("GET", `/v1/dubbing/${encodeURIComponent(dubbingId)}`, undefined, signal);
1121
+ }, { schema: undefined });
1122
+ // DELETE https://api.elevenlabs.io/v1/dubbing/{dubbingId}
1123
+ // Docs: https://elevenlabs.io/docs/api-reference/dubbing/delete
1124
+ const deleteDubbing = Object.assign(async (dubbingId, signal) => {
1125
+ return makeJsonRequest("DELETE", `/v1/dubbing/${encodeURIComponent(dubbingId)}`, undefined, signal);
1126
+ }, { schema: undefined });
1127
+ // GET https://api.elevenlabs.io/v1/dubbing/{dubbingId}/audio/{languageCode}
1128
+ // Docs: https://elevenlabs.io/docs/api-reference/dubbing/audio/get
1129
+ const getDubbingAudio = Object.assign(async (dubbingId, languageCode, signal) => {
1130
+ return makeGetBinaryRequest(`/v1/dubbing/${encodeURIComponent(dubbingId)}/audio/${encodeURIComponent(languageCode)}`, "", signal);
1131
+ }, { schema: undefined });
1132
+ // GET https://api.elevenlabs.io/v1/dubbing/{dubbingId}/transcripts/{languageCode}/format/{formatType}
1133
+ // Docs: https://elevenlabs.io/docs/api-reference/dubbing/transcripts/get
1134
+ const getDubbingTranscript = Object.assign(async (dubbingId, languageCode, formatType, signal) => {
1135
+ return makeJsonRequest("GET", `/v1/dubbing/${encodeURIComponent(dubbingId)}/transcripts/${encodeURIComponent(languageCode)}/format/${encodeURIComponent(formatType)}`, undefined, signal);
1136
+ }, { schema: undefined });
1137
+ const dubbing = {
1138
+ list: listDubbing,
1139
+ create: createDubbing,
1140
+ get: getDubbing,
1141
+ delete: deleteDubbing,
1142
+ audio: {
1143
+ get: getDubbingAudio,
1144
+ },
1145
+ transcripts: {
1146
+ get: getDubbingTranscript,
1147
+ },
1148
+ };
1149
+ // Append a multipart form body for the Studio project endpoints, expanding
1150
+ // array-valued fields (e.g. pronunciation_dictionary_locators, genres) into
1151
+ // one repeated form line per item as the upstream API expects.
1152
+ function appendStudioForm(form, req) {
1153
+ for (const [key, value] of Object.entries(req)) {
1154
+ if (Array.isArray(value)) {
1155
+ for (const item of value) {
1156
+ appendFormField(form, key, item);
1157
+ }
1158
+ }
1159
+ else {
1160
+ appendFormField(form, key, value);
1161
+ }
1162
+ }
1163
+ }
1164
+ // POST https://api.elevenlabs.io/v1/studio/podcasts
1165
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/create-podcast
1166
+ const studioCreatePodcast = Object.assign(async (req, signal) => {
1167
+ return makeJsonRequest("POST", "/v1/studio/podcasts", req, signal);
1168
+ }, { schema: ElevenLabsStudioCreatePodcastRequestSchema });
1169
+ // GET https://api.elevenlabs.io/v1/studio/projects
1170
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/get-projects
1171
+ const studioListProjects = Object.assign(async (signal) => {
1172
+ return makeJsonRequest("GET", "/v1/studio/projects", undefined, signal);
1173
+ }, { schema: undefined });
1174
+ // POST https://api.elevenlabs.io/v1/studio/projects
1175
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/add-project
1176
+ const studioCreateProject = Object.assign(async (req, signal) => {
1177
+ const form = new FormData();
1178
+ appendStudioForm(form, req);
1179
+ return makeMultipartJsonRequest("/v1/studio/projects", form, undefined, signal);
1180
+ }, { schema: ElevenLabsStudioCreateProjectRequestSchema });
1181
+ // GET https://api.elevenlabs.io/v1/studio/projects/{projectId}
1182
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/get-project
1183
+ const studioGetProject = Object.assign(async (projectId, req = {}, signal) => {
1184
+ return makeJsonRequest("GET", `/v1/studio/projects/${encodeURIComponent(projectId)}`, undefined, signal, buildQueryString(req));
1185
+ }, { schema: ElevenLabsStudioGetProjectRequestSchema });
1186
+ // POST https://api.elevenlabs.io/v1/studio/projects/{projectId}
1187
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/edit-project
1188
+ const studioUpdateProject = Object.assign(async (projectId, req, signal) => {
1189
+ return makeJsonRequest("POST", `/v1/studio/projects/${encodeURIComponent(projectId)}`, req, signal);
1190
+ }, { schema: ElevenLabsStudioUpdateProjectRequestSchema });
1191
+ // DELETE https://api.elevenlabs.io/v1/studio/projects/{projectId}
1192
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/delete-project
1193
+ const studioDeleteProject = Object.assign(async (projectId, signal) => {
1194
+ return makeJsonRequest("DELETE", `/v1/studio/projects/${encodeURIComponent(projectId)}`, undefined, signal);
1195
+ }, { schema: undefined });
1196
+ // POST https://api.elevenlabs.io/v1/studio/projects/{projectId}/convert
1197
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/convert-project
1198
+ const studioConvertProject = Object.assign(async (projectId, signal) => {
1199
+ return makeJsonRequest("POST", `/v1/studio/projects/${encodeURIComponent(projectId)}/convert`, undefined, signal);
1200
+ }, { schema: undefined });
1201
+ // POST https://api.elevenlabs.io/v1/studio/projects/{projectId}/content
1202
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/edit-project-content
1203
+ const studioUpdateProjectContent = Object.assign(async (projectId, req = {}, signal) => {
1204
+ const form = new FormData();
1205
+ appendStudioForm(form, req);
1206
+ return makeMultipartJsonRequest(`/v1/studio/projects/${encodeURIComponent(projectId)}/content`, form, undefined, signal);
1207
+ }, { schema: ElevenLabsStudioUpdateProjectContentRequestSchema });
1208
+ // GET https://api.elevenlabs.io/v1/studio/projects/{projectId}/muted-tracks
1209
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/get-project-muted-tracks
1210
+ const studioGetMutedTracks = Object.assign(async (projectId, signal) => {
1211
+ return makeJsonRequest("GET", `/v1/studio/projects/${encodeURIComponent(projectId)}/muted-tracks`, undefined, signal);
1212
+ }, { schema: undefined });
1213
+ // POST https://api.elevenlabs.io/v1/studio/projects/{projectId}/pronunciation-dictionaries
1214
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/create-pronunciation-dictionaries
1215
+ const studioCreatePronunciationDictionaries = Object.assign(async (projectId, req, signal) => {
1216
+ return makeJsonRequest("POST", `/v1/studio/projects/${encodeURIComponent(projectId)}/pronunciation-dictionaries`, req, signal);
1217
+ }, { schema: ElevenLabsStudioCreatePronunciationDictionariesRequestSchema });
1218
+ // GET https://api.elevenlabs.io/v1/studio/projects/{projectId}/snapshots
1219
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/get-project-snapshots
1220
+ const studioListProjectSnapshots = Object.assign(async (projectId, signal) => {
1221
+ return makeJsonRequest("GET", `/v1/studio/projects/${encodeURIComponent(projectId)}/snapshots`, undefined, signal);
1222
+ }, { schema: undefined });
1223
+ // GET https://api.elevenlabs.io/v1/studio/projects/{projectId}/snapshots/{snapshotId}
1224
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/get-project-snapshot
1225
+ const studioGetProjectSnapshot = Object.assign(async (projectId, snapshotId, signal) => {
1226
+ return makeJsonRequest("GET", `/v1/studio/projects/${encodeURIComponent(projectId)}/snapshots/${encodeURIComponent(snapshotId)}`, undefined, signal);
1227
+ }, { schema: undefined });
1228
+ // POST https://api.elevenlabs.io/v1/studio/projects/{projectId}/snapshots/{snapshotId}/stream
1229
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/stream-project-audio
1230
+ const studioStreamProjectSnapshot = Object.assign(async (projectId, snapshotId, req = {}, signal) => {
1231
+ return makeBinaryRequest(`/v1/studio/projects/${encodeURIComponent(projectId)}/snapshots/${encodeURIComponent(snapshotId)}/stream`, req, undefined, signal);
1232
+ }, { schema: ElevenLabsStudioStreamAudioRequestSchema });
1233
+ // POST https://api.elevenlabs.io/v1/studio/projects/{projectId}/snapshots/{snapshotId}/archive
1234
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/archive-project-snapshot
1235
+ const studioArchiveProjectSnapshot = Object.assign(async (projectId, snapshotId, signal) => {
1236
+ return makeBinaryRequest(`/v1/studio/projects/${encodeURIComponent(projectId)}/snapshots/${encodeURIComponent(snapshotId)}/archive`, undefined, undefined, signal);
1237
+ }, { schema: undefined });
1238
+ // GET https://api.elevenlabs.io/v1/studio/projects/{projectId}/chapters
1239
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/get-chapters
1240
+ const studioListChapters = Object.assign(async (projectId, signal) => {
1241
+ return makeJsonRequest("GET", `/v1/studio/projects/${encodeURIComponent(projectId)}/chapters`, undefined, signal);
1242
+ }, { schema: undefined });
1243
+ // POST https://api.elevenlabs.io/v1/studio/projects/{projectId}/chapters
1244
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/create-chapter
1245
+ const studioCreateChapter = Object.assign(async (projectId, req, signal) => {
1246
+ return makeJsonRequest("POST", `/v1/studio/projects/${encodeURIComponent(projectId)}/chapters`, req, signal);
1247
+ }, { schema: ElevenLabsStudioCreateChapterRequestSchema });
1248
+ // GET https://api.elevenlabs.io/v1/studio/projects/{projectId}/chapters/{chapterId}
1249
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/get-chapter
1250
+ const studioGetChapter = Object.assign(async (projectId, chapterId, signal) => {
1251
+ return makeJsonRequest("GET", `/v1/studio/projects/${encodeURIComponent(projectId)}/chapters/${encodeURIComponent(chapterId)}`, undefined, signal);
1252
+ }, { schema: undefined });
1253
+ // POST https://api.elevenlabs.io/v1/studio/projects/{projectId}/chapters/{chapterId}
1254
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/edit-chapter
1255
+ const studioUpdateChapter = Object.assign(async (projectId, chapterId, req, signal) => {
1256
+ return makeJsonRequest("POST", `/v1/studio/projects/${encodeURIComponent(projectId)}/chapters/${encodeURIComponent(chapterId)}`, req, signal);
1257
+ }, { schema: ElevenLabsStudioUpdateChapterRequestSchema });
1258
+ // DELETE https://api.elevenlabs.io/v1/studio/projects/{projectId}/chapters/{chapterId}
1259
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/delete-chapter
1260
+ const studioDeleteChapter = Object.assign(async (projectId, chapterId, signal) => {
1261
+ return makeJsonRequest("DELETE", `/v1/studio/projects/${encodeURIComponent(projectId)}/chapters/${encodeURIComponent(chapterId)}`, undefined, signal);
1262
+ }, { schema: undefined });
1263
+ // POST https://api.elevenlabs.io/v1/studio/projects/{projectId}/chapters/{chapterId}/convert
1264
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/convert-chapter
1265
+ const studioConvertChapter = Object.assign(async (projectId, chapterId, signal) => {
1266
+ return makeJsonRequest("POST", `/v1/studio/projects/${encodeURIComponent(projectId)}/chapters/${encodeURIComponent(chapterId)}/convert`, undefined, signal);
1267
+ }, { schema: undefined });
1268
+ // GET https://api.elevenlabs.io/v1/studio/projects/{projectId}/chapters/{chapterId}/snapshots
1269
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/get-chapter-snapshots
1270
+ const studioListChapterSnapshots = Object.assign(async (projectId, chapterId, signal) => {
1271
+ return makeJsonRequest("GET", `/v1/studio/projects/${encodeURIComponent(projectId)}/chapters/${encodeURIComponent(chapterId)}/snapshots`, undefined, signal);
1272
+ }, { schema: undefined });
1273
+ // GET https://api.elevenlabs.io/v1/studio/projects/{projectId}/chapters/{chapterId}/snapshots/{chapterSnapshotId}
1274
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/get-chapter-snapshot
1275
+ const studioGetChapterSnapshot = Object.assign(async (projectId, chapterId, chapterSnapshotId, signal) => {
1276
+ return makeJsonRequest("GET", `/v1/studio/projects/${encodeURIComponent(projectId)}/chapters/${encodeURIComponent(chapterId)}/snapshots/${encodeURIComponent(chapterSnapshotId)}`, undefined, signal);
1277
+ }, { schema: undefined });
1278
+ // POST https://api.elevenlabs.io/v1/studio/projects/{projectId}/chapters/{chapterId}/snapshots/{chapterSnapshotId}/stream
1279
+ // Docs: https://elevenlabs.io/docs/api-reference/studio/stream-chapter-audio
1280
+ const studioStreamChapterSnapshot = Object.assign(async (projectId, chapterId, chapterSnapshotId, req = {}, signal) => {
1281
+ return makeBinaryRequest(`/v1/studio/projects/${encodeURIComponent(projectId)}/chapters/${encodeURIComponent(chapterId)}/snapshots/${encodeURIComponent(chapterSnapshotId)}/stream`, req, undefined, signal);
1282
+ }, { schema: ElevenLabsStudioStreamAudioRequestSchema });
1283
+ const studio = {
1284
+ podcasts: {
1285
+ create: studioCreatePodcast,
1286
+ },
1287
+ projects: {
1288
+ list: studioListProjects,
1289
+ create: studioCreateProject,
1290
+ get: studioGetProject,
1291
+ update: studioUpdateProject,
1292
+ delete: studioDeleteProject,
1293
+ convert: studioConvertProject,
1294
+ content: {
1295
+ update: studioUpdateProjectContent,
1296
+ },
1297
+ mutedTracks: {
1298
+ get: studioGetMutedTracks,
1299
+ },
1300
+ pronunciationDictionaries: {
1301
+ create: studioCreatePronunciationDictionaries,
1302
+ },
1303
+ snapshots: {
1304
+ list: studioListProjectSnapshots,
1305
+ get: studioGetProjectSnapshot,
1306
+ stream: studioStreamProjectSnapshot,
1307
+ archive: studioArchiveProjectSnapshot,
1308
+ },
1309
+ chapters: {
1310
+ list: studioListChapters,
1311
+ create: studioCreateChapter,
1312
+ get: studioGetChapter,
1313
+ update: studioUpdateChapter,
1314
+ delete: studioDeleteChapter,
1315
+ convert: studioConvertChapter,
1316
+ snapshots: {
1317
+ list: studioListChapterSnapshots,
1318
+ get: studioGetChapterSnapshot,
1319
+ stream: studioStreamChapterSnapshot,
1320
+ },
1321
+ },
1322
+ },
1323
+ };
1324
+ // POST https://api.elevenlabs.io/v1/speech-to-speech/{voiceId}/stream
1325
+ // Docs: https://elevenlabs.io/docs/api-reference/speech-to-speech/stream
1326
+ const speechToSpeechStream = Object.assign(async (voiceId, req, signal) => {
1327
+ const { output_format, enable_logging, ...body } = req;
1328
+ const query = optionalQuery({
1329
+ output_format,
1330
+ enable_logging: enable_logging === undefined ? undefined : String(enable_logging),
1331
+ });
1332
+ const form = new FormData();
1333
+ for (const [key, value] of Object.entries(body)) {
1334
+ appendFormField(form, key, value);
1335
+ }
1336
+ return makeMultipartBinaryRequest(`/v1/speech-to-speech/${encodeURIComponent(voiceId)}/stream`, form, query, signal);
1337
+ }, { schema: ElevenLabsSpeechToSpeechRequestSchema });
1338
+ // POST https://api.elevenlabs.io/v1/speech-to-speech/{voiceId}
1339
+ // Docs: https://elevenlabs.io/docs/api-reference/speech-to-speech/convert
1340
+ const speechToSpeech = Object.assign(async (voiceId, req, signal) => {
1341
+ const { output_format, enable_logging, ...body } = req;
1342
+ const query = optionalQuery({
1343
+ output_format,
1344
+ enable_logging: enable_logging === undefined ? undefined : String(enable_logging),
1345
+ });
1346
+ const form = new FormData();
1347
+ for (const [key, value] of Object.entries(body)) {
1348
+ appendFormField(form, key, value);
1349
+ }
1350
+ return makeMultipartBinaryRequest(`/v1/speech-to-speech/${encodeURIComponent(voiceId)}`, form, query, signal);
1351
+ }, {
1352
+ schema: ElevenLabsSpeechToSpeechRequestSchema,
1353
+ stream: speechToSpeechStream,
1354
+ });
1355
+ // POST https://api.elevenlabs.io/v1/workspace/analytics/query/usage-by-product-over-time
1356
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/usage/get-usage-by-product-over-time
1357
+ const usageByProductOverTime = Object.assign(async (req, signal) => {
1358
+ return makeJsonRequest("POST", "/v1/workspace/analytics/query/usage-by-product-over-time", req, signal);
1359
+ }, {
1360
+ schema: ElevenLabsWorkspaceAnalyticsUsageByProductOverTimeRequestSchema,
1361
+ });
1362
+ // POST https://api.elevenlabs.io/v1/voices/pvc/{voiceId}/verification
1363
+ // Docs: https://elevenlabs.io/docs/api-reference/voices/pvc/verification/request
1364
+ const pvcManualVerification = Object.assign(async (voiceId, req, signal) => {
1365
+ const form = new FormData();
1366
+ for (const file of req.files) {
1367
+ form.append("files", file);
1368
+ }
1369
+ appendFormField(form, "extra_text", req.extra_text);
1370
+ return makeMultipartJsonRequest(`/v1/voices/pvc/${encodeURIComponent(voiceId)}/verification`, form, undefined, signal);
1371
+ }, { schema: ElevenLabsPvcManualVerificationRequestSchema });
1372
+ // GET https://api.elevenlabs.io/v1/user
1373
+ // Docs: https://elevenlabs.io/docs/api-reference/user/get
1374
+ const getUser = Object.assign(async (signal) => {
1375
+ return makeJsonRequest("GET", "/v1/user", undefined, signal);
1376
+ }, { schema: undefined });
1377
+ // GET https://api.elevenlabs.io/v1/user/subscription
1378
+ // Docs: https://elevenlabs.io/docs/api-reference/user/subscription/get
1379
+ const userSubscription = Object.assign(async (signal) => {
1380
+ const subscription = await makeJsonRequest("GET", "/v1/user/subscription", undefined, signal);
1381
+ return {
1382
+ ...subscription,
1383
+ remaining_character_count: Math.max(0, subscription.character_limit - subscription.character_count),
1384
+ };
1385
+ }, { schema: undefined });
1386
+ // POST https://api.elevenlabs.io/v1/single-use-token/{tokenType}
1387
+ // Docs: https://elevenlabs.io/docs/api-reference/tokens/create
1388
+ const singleUseToken = Object.assign(async (tokenType, signal) => {
1389
+ return makeJsonRequest("POST", `/v1/single-use-token/${encodeURIComponent(tokenType)}`, undefined, signal);
1390
+ }, { schema: undefined });
1391
+ // POST https://api.elevenlabs.io/v1/workspace/analytics/requests
1392
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/analytics/requests/get
383
1393
  const workspaceAnalyticsRequests = Object.assign(async (req, signal) => {
384
1394
  return makeJsonRequest("POST", "/v1/workspace/analytics/requests", req, signal);
385
1395
  }, { schema: ElevenLabsWorkspaceAnalyticsRequestsRequestSchema });
386
- const user = {
387
- subscription: userSubscription,
1396
+ // GET https://api.elevenlabs.io/v1/workspace/audit-logs
1397
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/audit-logs/list
1398
+ const listWorkspaceAuditLogs = Object.assign(async (req = {}, signal) => {
1399
+ return makeJsonRequest("GET", "/v1/workspace/audit-logs", undefined, signal, buildQueryString(req));
1400
+ }, { schema: ElevenLabsListWorkspaceAuditLogsRequestSchema });
1401
+ // GET https://api.elevenlabs.io/v1/workspace/groups
1402
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/groups/list
1403
+ const listWorkspaceGroups = Object.assign(async (signal) => {
1404
+ return makeJsonRequest("GET", "/v1/workspace/groups", undefined, signal);
1405
+ }, { schema: undefined });
1406
+ // GET https://api.elevenlabs.io/v1/workspace/groups/search
1407
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/groups/search
1408
+ const searchWorkspaceGroups = Object.assign(async (req, signal) => {
1409
+ return makeJsonRequest("GET", "/v1/workspace/groups/search", undefined, signal, buildQueryString(req));
1410
+ }, { schema: ElevenLabsSearchWorkspaceGroupsRequestSchema });
1411
+ // POST https://api.elevenlabs.io/v1/workspace/groups/{groupId}/members
1412
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/groups/members/add
1413
+ const addWorkspaceGroupMember = Object.assign(async (groupId, req, signal) => {
1414
+ return makeJsonRequest("POST", `/v1/workspace/groups/${encodeURIComponent(groupId)}/members`, req, signal);
1415
+ }, { schema: ElevenLabsAddWorkspaceGroupMemberRequestSchema });
1416
+ // POST https://api.elevenlabs.io/v1/workspace/groups/{groupId}/members/remove
1417
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/groups/members/remove
1418
+ const removeWorkspaceGroupMember = Object.assign(async (groupId, req, signal) => {
1419
+ return makeJsonRequest("POST", `/v1/workspace/groups/${encodeURIComponent(groupId)}/members/remove`, req, signal);
1420
+ }, { schema: ElevenLabsRemoveWorkspaceGroupMemberRequestSchema });
1421
+ // POST https://api.elevenlabs.io/v1/workspace/members
1422
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/members/update
1423
+ const updateWorkspaceMember = Object.assign(async (req, signal) => {
1424
+ return makeJsonRequest("POST", "/v1/workspace/members", req, signal);
1425
+ }, { schema: ElevenLabsUpdateWorkspaceMemberRequestSchema });
1426
+ // POST https://api.elevenlabs.io/v1/workspace/invites/add
1427
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/invites/create
1428
+ const addWorkspaceInvite = Object.assign(async (req, signal) => {
1429
+ return makeJsonRequest("POST", "/v1/workspace/invites/add", req, signal);
1430
+ }, { schema: ElevenLabsAddWorkspaceInviteRequestSchema });
1431
+ // POST https://api.elevenlabs.io/v1/workspace/invites/add-bulk
1432
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/invites/create-batch
1433
+ const addWorkspaceInvitesBulk = Object.assign(async (req, signal) => {
1434
+ return makeJsonRequest("POST", "/v1/workspace/invites/add-bulk", req, signal);
1435
+ }, { schema: ElevenLabsAddWorkspaceInvitesBulkRequestSchema });
1436
+ // DELETE https://api.elevenlabs.io/v1/workspace/invites
1437
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/invites/delete
1438
+ const deleteWorkspaceInvite = Object.assign(async (req, signal) => {
1439
+ return makeJsonRequest("DELETE", "/v1/workspace/invites", req, signal);
1440
+ }, { schema: ElevenLabsDeleteWorkspaceInviteRequestSchema });
1441
+ // GET https://api.elevenlabs.io/v1/workspace/resources/{resourceId}
1442
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/resources/get
1443
+ const getWorkspaceResource = Object.assign(async (resourceId, req, signal) => {
1444
+ return makeJsonRequest("GET", `/v1/workspace/resources/${encodeURIComponent(resourceId)}`, undefined, signal, buildQueryString(req));
1445
+ }, { schema: ElevenLabsGetWorkspaceResourceRequestSchema });
1446
+ // POST https://api.elevenlabs.io/v1/workspace/resources/{resourceId}/share
1447
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/resources/share
1448
+ const shareWorkspaceResource = Object.assign(async (resourceId, req, signal) => {
1449
+ return makeJsonRequestAllowEmpty("POST", `/v1/workspace/resources/${encodeURIComponent(resourceId)}/share`, req, signal);
1450
+ }, { schema: ElevenLabsShareWorkspaceResourceRequestSchema });
1451
+ // POST https://api.elevenlabs.io/v1/workspace/resources/{resourceId}/unshare
1452
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/resources/unshare
1453
+ const unshareWorkspaceResource = Object.assign(async (resourceId, req, signal) => {
1454
+ return makeJsonRequestAllowEmpty("POST", `/v1/workspace/resources/${encodeURIComponent(resourceId)}/unshare`, req, signal);
1455
+ }, { schema: ElevenLabsUnshareWorkspaceResourceRequestSchema });
1456
+ // GET https://api.elevenlabs.io/v1/workspace/webhooks
1457
+ // Docs: https://elevenlabs.io/docs/api-reference/webhooks/list
1458
+ const listWorkspaceWebhooks = Object.assign(async (req = {}, signal) => {
1459
+ return makeJsonRequest("GET", "/v1/workspace/webhooks", undefined, signal, buildQueryString(req));
1460
+ }, { schema: ElevenLabsListWorkspaceWebhooksRequestSchema });
1461
+ // POST https://api.elevenlabs.io/v1/workspace/webhooks
1462
+ // Docs: https://elevenlabs.io/docs/api-reference/webhooks/create
1463
+ const createWorkspaceWebhook = Object.assign(async (req, signal) => {
1464
+ return makeJsonRequest("POST", "/v1/workspace/webhooks", req, signal);
1465
+ }, { schema: ElevenLabsCreateWorkspaceWebhookRequestSchema });
1466
+ // PATCH https://api.elevenlabs.io/v1/workspace/webhooks/{webhookId}
1467
+ // Docs: https://elevenlabs.io/docs/api-reference/webhooks/update
1468
+ const updateWorkspaceWebhook = Object.assign(async (webhookId, req, signal) => {
1469
+ return makeJsonRequest("PATCH", `/v1/workspace/webhooks/${encodeURIComponent(webhookId)}`, req, signal);
1470
+ }, { schema: ElevenLabsUpdateWorkspaceWebhookRequestSchema });
1471
+ // DELETE https://api.elevenlabs.io/v1/workspace/webhooks/{webhookId}
1472
+ // Docs: https://elevenlabs.io/docs/api-reference/webhooks/delete
1473
+ const deleteWorkspaceWebhook = Object.assign(async (webhookId, signal) => {
1474
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/workspace/webhooks/${encodeURIComponent(webhookId)}`, undefined, signal);
1475
+ }, { schema: undefined });
1476
+ // GET https://api.elevenlabs.io/v1/workspace/auth-connections
1477
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/auth-connections/list
1478
+ const listWorkspaceAuthConnections = Object.assign(async (signal) => {
1479
+ return makeJsonRequest("GET", "/v1/workspace/auth-connections", undefined, signal);
1480
+ }, { schema: undefined });
1481
+ // POST https://api.elevenlabs.io/v1/workspace/auth-connections
1482
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/auth-connections/create
1483
+ const createWorkspaceAuthConnection = Object.assign(async (req, signal) => {
1484
+ return makeJsonRequest("POST", "/v1/workspace/auth-connections", req, signal);
1485
+ }, { schema: ElevenLabsCreateWorkspaceAuthConnectionRequestSchema });
1486
+ // PATCH https://api.elevenlabs.io/v1/workspace/auth-connections/{authConnectionId}
1487
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/auth-connections/update
1488
+ const updateWorkspaceAuthConnection = Object.assign(async (authConnectionId, req, signal) => {
1489
+ return makeJsonRequest("PATCH", `/v1/workspace/auth-connections/${encodeURIComponent(authConnectionId)}`, req, signal);
1490
+ }, { schema: ElevenLabsUpdateWorkspaceAuthConnectionRequestSchema });
1491
+ // DELETE https://api.elevenlabs.io/v1/workspace/auth-connections/{authConnectionId}
1492
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/auth-connections/delete
1493
+ const deleteWorkspaceAuthConnection = Object.assign(async (authConnectionId, signal) => {
1494
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/workspace/auth-connections/${encodeURIComponent(authConnectionId)}`, undefined, signal);
1495
+ }, { schema: undefined });
1496
+ // GET https://api.elevenlabs.io/v1/service-accounts
1497
+ // Docs: https://elevenlabs.io/docs/api-reference/service-accounts/list
1498
+ const listServiceAccounts = Object.assign(async (signal) => {
1499
+ return makeJsonRequest("GET", "/v1/service-accounts", undefined, signal);
1500
+ }, { schema: undefined });
1501
+ // GET https://api.elevenlabs.io/v1/service-accounts/{serviceAccountUserId}/api-keys
1502
+ // Docs: https://elevenlabs.io/docs/api-reference/service-accounts/api-keys/list
1503
+ const listServiceAccountApiKeys = Object.assign(async (serviceAccountUserId, signal) => {
1504
+ return makeJsonRequest("GET", `/v1/service-accounts/${encodeURIComponent(serviceAccountUserId)}/api-keys`, undefined, signal);
1505
+ }, { schema: undefined });
1506
+ // POST https://api.elevenlabs.io/v1/service-accounts/{serviceAccountUserId}/api-keys
1507
+ // Docs: https://elevenlabs.io/docs/api-reference/service-accounts/api-keys/create
1508
+ const createServiceAccountApiKey = Object.assign(async (serviceAccountUserId, req, signal) => {
1509
+ return makeJsonRequest("POST", `/v1/service-accounts/${encodeURIComponent(serviceAccountUserId)}/api-keys`, req, signal);
1510
+ }, { schema: ElevenLabsCreateServiceAccountApiKeyRequestSchema });
1511
+ // PATCH https://api.elevenlabs.io/v1/service-accounts/{serviceAccountUserId}/api-keys/{apiKeyId}
1512
+ // Docs: https://elevenlabs.io/docs/api-reference/service-accounts/api-keys/update
1513
+ const updateServiceAccountApiKey = Object.assign(async (serviceAccountUserId, apiKeyId, req = {}, signal) => {
1514
+ return makeJsonRequestAllowEmpty("PATCH", `/v1/service-accounts/${encodeURIComponent(serviceAccountUserId)}/api-keys/${encodeURIComponent(apiKeyId)}`, Object.keys(req).length > 0 ? req : undefined, signal);
1515
+ }, { schema: ElevenLabsUpdateServiceAccountApiKeyRequestSchema });
1516
+ // DELETE https://api.elevenlabs.io/v1/service-accounts/{serviceAccountUserId}/api-keys/{apiKeyId}
1517
+ // Docs: https://elevenlabs.io/docs/api-reference/service-accounts/api-keys/delete
1518
+ const deleteServiceAccountApiKey = Object.assign(async (serviceAccountUserId, apiKeyId, signal) => {
1519
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/service-accounts/${encodeURIComponent(serviceAccountUserId)}/api-keys/${encodeURIComponent(apiKeyId)}`, undefined, signal);
1520
+ }, { schema: undefined });
1521
+ // POST https://api.elevenlabs.io/v1/workspaces/api-keys/disable
1522
+ // Docs: https://elevenlabs.io/docs/api-reference/workspaces/api-keys/disable
1523
+ const disableWorkspaceApiKey = Object.assign(async (req, signal) => {
1524
+ return makeJsonRequestAllowEmpty("POST", "/v1/workspaces/api-keys/disable", undefined, signal, buildQueryString(req));
1525
+ }, { schema: ElevenLabsDisableWorkspaceApiKeyRequestSchema });
1526
+ // POST https://api.elevenlabs.io/v1/workspaces/api-keys/third-party-disabling
1527
+ // Docs: https://elevenlabs.io/docs/api-reference/workspaces/api-keys/third-party-disabling
1528
+ const setWorkspaceApiKeyThirdPartyDisabling = Object.assign(async (req, signal) => {
1529
+ return makeJsonRequestAllowEmpty("POST", "/v1/workspaces/api-keys/third-party-disabling", req, signal);
1530
+ }, { schema: ElevenLabsSetWorkspaceApiKeyThirdPartyDisablingRequestSchema });
1531
+ // POST https://api.elevenlabs.io/v1/convai/agents/create
1532
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/create
1533
+ const createAgent = Object.assign(async (req, signal) => {
1534
+ const { enable_versioning, ...body } = req;
1535
+ const query = buildQueryString({ enable_versioning });
1536
+ return makeJsonRequest("POST", "/v1/convai/agents/create", body, signal, query);
1537
+ }, { schema: ElevenLabsCreateAgentRequestSchema });
1538
+ // GET https://api.elevenlabs.io/v1/convai/agents
1539
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/list
1540
+ const listAgents = Object.assign(async (req = {}, signal) => {
1541
+ return makeJsonRequest("GET", "/v1/convai/agents", undefined, signal, buildQueryString(req));
1542
+ }, { schema: ElevenLabsListAgentsRequestSchema });
1543
+ // GET https://api.elevenlabs.io/v1/convai/agents/{agentId}
1544
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/get
1545
+ const getAgent = Object.assign(async (agentId, req = {}, signal) => {
1546
+ return makeJsonRequest("GET", `/v1/convai/agents/${encodeURIComponent(agentId)}`, undefined, signal, buildQueryString(req));
1547
+ }, { schema: ElevenLabsGetAgentRequestSchema });
1548
+ // PATCH https://api.elevenlabs.io/v1/convai/agents/{agentId}
1549
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/update
1550
+ const updateAgent = Object.assign(async (agentId, req = {}, signal) => {
1551
+ const { enable_versioning_if_not_enabled, branch_id, ...body } = req;
1552
+ const query = buildQueryString({
1553
+ enable_versioning_if_not_enabled,
1554
+ branch_id,
1555
+ });
1556
+ return makeJsonRequest("PATCH", `/v1/convai/agents/${encodeURIComponent(agentId)}`, body, signal, query);
1557
+ }, { schema: ElevenLabsUpdateAgentRequestSchema });
1558
+ // DELETE https://api.elevenlabs.io/v1/convai/agents/{agentId}
1559
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/delete
1560
+ const deleteAgent = Object.assign(async (agentId, signal) => {
1561
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/convai/agents/${encodeURIComponent(agentId)}`, undefined, signal);
1562
+ }, { schema: undefined });
1563
+ // GET https://api.elevenlabs.io/v1/convai/agents/{agentId}/widget
1564
+ // Docs: https://elevenlabs.io/docs/api-reference/widget/get
1565
+ const getAgentWidget = Object.assign(async (agentId, req = {}, signal) => {
1566
+ return makeJsonRequest("GET", `/v1/convai/agents/${encodeURIComponent(agentId)}/widget`, undefined, signal, buildQueryString(req));
1567
+ }, { schema: ElevenLabsGetAgentWidgetRequestSchema });
1568
+ // GET https://api.elevenlabs.io/v1/convai/agents/{agentId}/link
1569
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/get-link
1570
+ const getAgentLink = Object.assign(async (agentId, signal) => {
1571
+ return makeJsonRequest("GET", `/v1/convai/agents/${encodeURIComponent(agentId)}/link`, undefined, signal);
1572
+ }, { schema: undefined });
1573
+ // GET https://api.elevenlabs.io/v1/convai/agents/{agentId}/branches
1574
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/branches
1575
+ const listAgentBranches = Object.assign(async (agentId, req = {}, signal) => {
1576
+ return makeJsonRequest("GET", `/v1/convai/agents/${encodeURIComponent(agentId)}/branches`, undefined, signal, buildQueryString(req));
1577
+ }, { schema: ElevenLabsListAgentBranchesRequestSchema });
1578
+ // GET https://api.elevenlabs.io/v1/convai/agents/summaries
1579
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/get-summaries
1580
+ const getAgentSummaries = Object.assign(async (req, signal) => {
1581
+ return makeJsonRequest("GET", "/v1/convai/agents/summaries", undefined, signal, buildQueryString(req));
1582
+ }, { schema: ElevenLabsGetAgentSummariesRequestSchema });
1583
+ // POST https://api.elevenlabs.io/v1/convai/agents/{agentId}/duplicate
1584
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/duplicate
1585
+ const duplicateAgent = Object.assign(async (agentId, req = {}, signal) => {
1586
+ return makeJsonRequest("POST", `/v1/convai/agents/${encodeURIComponent(agentId)}/duplicate`, Object.keys(req).length > 0 ? req : undefined, signal);
1587
+ }, { schema: ElevenLabsDuplicateAgentRequestSchema });
1588
+ // POST https://api.elevenlabs.io/v1/convai/agents/{agentId}/avatar
1589
+ // Docs: https://elevenlabs.io/docs/api-reference/widget/create
1590
+ const postAgentAvatar = Object.assign(async (agentId, req, signal) => {
1591
+ const form = new FormData();
1592
+ appendFormField(form, "avatar_file", req.avatar_file);
1593
+ return makeMultipartJsonRequest(`/v1/convai/agents/${encodeURIComponent(agentId)}/avatar`, form, undefined, signal);
1594
+ }, { schema: ElevenLabsPostAgentAvatarRequestSchema });
1595
+ // GET https://api.elevenlabs.io/v1/convai/agents/{agentId}/versions/{versionId}
1596
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/versions/get
1597
+ const getAgentVersion = Object.assign(async (agentId, versionId, signal) => {
1598
+ return makeJsonRequest("GET", `/v1/convai/agents/${encodeURIComponent(agentId)}/versions/${encodeURIComponent(versionId)}`, undefined, signal);
1599
+ }, { schema: undefined });
1600
+ // POST https://api.elevenlabs.io/v1/convai/agents/{agentId}/simulate-conversation/stream
1601
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/simulate-conversation-stream
1602
+ const simulateConversationStream = Object.assign(async (agentId, req, signal) => {
1603
+ return makeBinaryRequest(`/v1/convai/agents/${encodeURIComponent(agentId)}/simulate-conversation/stream`, req, undefined, signal);
1604
+ }, { schema: ElevenLabsSimulateConversationRequestSchema });
1605
+ // POST https://api.elevenlabs.io/v1/convai/agents/{agentId}/simulate-conversation
1606
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/simulate-conversation
1607
+ const simulateConversation = Object.assign(async (agentId, req, signal) => {
1608
+ return makeJsonRequest("POST", `/v1/convai/agents/${encodeURIComponent(agentId)}/simulate-conversation`, req, signal);
1609
+ }, {
1610
+ schema: ElevenLabsSimulateConversationRequestSchema,
1611
+ stream: simulateConversationStream,
1612
+ });
1613
+ // GET https://api.elevenlabs.io/v1/convai/agents/{agentId}/topics
1614
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/topics/get
1615
+ const getAgentTopics = Object.assign(async (agentId, req = {}, signal) => {
1616
+ return makeJsonRequest("GET", `/v1/convai/agents/${encodeURIComponent(agentId)}/topics`, undefined, signal, buildQueryString(req));
1617
+ }, { schema: ElevenLabsGetAgentTopicsRequestSchema });
1618
+ // GET https://api.elevenlabs.io/v1/convai/agent/{agentId}/knowledge-base/size
1619
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/size
1620
+ const getAgentKnowledgeBaseSize = Object.assign(async (agentId, signal) => {
1621
+ return makeJsonRequest("GET", `/v1/convai/agent/${encodeURIComponent(agentId)}/knowledge-base/size`, undefined, signal);
1622
+ }, { schema: undefined });
1623
+ // POST https://api.elevenlabs.io/v1/convai/agent/{agentId}/llm-usage/calculate
1624
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/calculate
1625
+ const calculateAgentLlmUsage = Object.assign(async (agentId, req = {}, signal) => {
1626
+ return makeJsonRequest("POST", `/v1/convai/agent/${encodeURIComponent(agentId)}/llm-usage/calculate`, Object.keys(req).length > 0 ? req : undefined, signal);
1627
+ }, { schema: ElevenLabsCalculateAgentLlmUsageRequestSchema });
1628
+ // POST https://api.elevenlabs.io/v1/convai/agents/{agentId}/drafts
1629
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/drafts/create
1630
+ const createAgentDraft = Object.assign(async (agentId, req, signal) => {
1631
+ const { branch_id, ...body } = req;
1632
+ return makeJsonRequest("POST", `/v1/convai/agents/${encodeURIComponent(agentId)}/drafts`, body, signal, buildQueryString({ branch_id }));
1633
+ }, { schema: ElevenLabsCreateAgentDraftRequestSchema });
1634
+ // DELETE https://api.elevenlabs.io/v1/convai/agents/{agentId}/drafts
1635
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/drafts/delete
1636
+ const deleteAgentDraft = Object.assign(async (agentId, req, signal) => {
1637
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/convai/agents/${encodeURIComponent(agentId)}/drafts`, undefined, signal, buildQueryString(req));
1638
+ }, { schema: ElevenLabsDeleteAgentDraftRequestSchema });
1639
+ // POST https://api.elevenlabs.io/v1/convai/agents/{agentId}/deployments
1640
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/deployments/create
1641
+ const createAgentDeployment = Object.assign(async (agentId, req, signal) => {
1642
+ return makeJsonRequest("POST", `/v1/convai/agents/${encodeURIComponent(agentId)}/deployments`, req, signal);
1643
+ }, { schema: ElevenLabsCreateAgentDeploymentRequestSchema });
1644
+ // POST https://api.elevenlabs.io/v1/convai/agents/{agentId}/branches
1645
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/branches/create
1646
+ const createAgentBranch = Object.assign(async (agentId, req, signal) => {
1647
+ return makeJsonRequest("POST", `/v1/convai/agents/${encodeURIComponent(agentId)}/branches`, req, signal);
1648
+ }, { schema: ElevenLabsCreateAgentBranchRequestSchema });
1649
+ // GET https://api.elevenlabs.io/v1/convai/agents/{agentId}/branches/{branchId}
1650
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/branches/get
1651
+ const getAgentBranch = Object.assign(async (agentId, branchId, signal) => {
1652
+ return makeJsonRequest("GET", `/v1/convai/agents/${encodeURIComponent(agentId)}/branches/${encodeURIComponent(branchId)}`, undefined, signal);
1653
+ }, { schema: undefined });
1654
+ // PATCH https://api.elevenlabs.io/v1/convai/agents/{agentId}/branches/{branchId}
1655
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/branches/update
1656
+ const updateAgentBranch = Object.assign(async (agentId, branchId, req = {}, signal) => {
1657
+ return makeJsonRequest("PATCH", `/v1/convai/agents/${encodeURIComponent(agentId)}/branches/${encodeURIComponent(branchId)}`, Object.keys(req).length > 0 ? req : undefined, signal);
1658
+ }, { schema: ElevenLabsUpdateAgentBranchRequestSchema });
1659
+ // POST https://api.elevenlabs.io/v1/convai/agents/{agentId}/branches/{branchId}/rebase
1660
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/branches/rebase
1661
+ const rebaseAgentBranch = Object.assign(async (agentId, branchId, signal) => {
1662
+ return makeJsonRequestAllowEmpty("POST", `/v1/convai/agents/${encodeURIComponent(agentId)}/branches/${encodeURIComponent(branchId)}/rebase`, undefined, signal);
1663
+ }, { schema: undefined });
1664
+ // GET https://api.elevenlabs.io/v1/convai/agents/{agentId}/branches/{branchId}/rebase-preview
1665
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/branches/preview
1666
+ const previewAgentBranchRebase = Object.assign(async (agentId, branchId, signal) => {
1667
+ return makeJsonRequest("GET", `/v1/convai/agents/${encodeURIComponent(agentId)}/branches/${encodeURIComponent(branchId)}/rebase-preview`, undefined, signal);
1668
+ }, { schema: undefined });
1669
+ // POST https://api.elevenlabs.io/v1/convai/agents/{agentId}/branches/{sourceBranchId}/merge
1670
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/branches/merge
1671
+ const mergeAgentBranch = Object.assign(async (agentId, sourceBranchId, req, signal) => {
1672
+ const { target_branch_id, ...body } = req;
1673
+ return makeJsonRequestAllowEmpty("POST", `/v1/convai/agents/${encodeURIComponent(agentId)}/branches/${encodeURIComponent(sourceBranchId)}/merge`, Object.keys(body).length > 0 ? body : undefined, signal, buildQueryString({ target_branch_id }));
1674
+ }, { schema: ElevenLabsMergeAgentBranchRequestSchema });
1675
+ // GET https://api.elevenlabs.io/v1/convai/agents/{agentId}/branches/{sourceBranchId}/merge-preview
1676
+ // Docs: https://elevenlabs.io/docs/api-reference/agents/branches/preview
1677
+ const previewAgentBranchMerge = Object.assign(async (agentId, sourceBranchId, req, signal) => {
1678
+ return makeJsonRequest("GET", `/v1/convai/agents/${encodeURIComponent(agentId)}/branches/${encodeURIComponent(sourceBranchId)}/merge-preview`, undefined, signal, buildQueryString(req));
1679
+ }, { schema: ElevenLabsPreviewAgentBranchMergeRequestSchema });
1680
+ // GET https://api.elevenlabs.io/v1/convai/analytics/live-count
1681
+ // Docs: https://elevenlabs.io/docs/api-reference/analytics/get
1682
+ const getLiveConversationCount = Object.assign(async (req = {}, signal) => {
1683
+ return makeJsonRequest("GET", "/v1/convai/analytics/live-count", undefined, signal, buildQueryString(req));
1684
+ }, { schema: ElevenLabsGetLiveConversationCountRequestSchema });
1685
+ // GET https://api.elevenlabs.io/v1/convai/users
1686
+ // Docs: https://elevenlabs.io/docs/api-reference/users/list
1687
+ const listConversationUsers = Object.assign(async (req = {}, signal) => {
1688
+ return makeJsonRequest("GET", "/v1/convai/users", undefined, signal, buildQueryString(req));
1689
+ }, { schema: ElevenLabsListConversationUsersRequestSchema });
1690
+ // POST https://api.elevenlabs.io/v1/convai/llm-usage/calculate
1691
+ // Docs: https://elevenlabs.io/docs/api-reference/llm/calculate
1692
+ const calculateLlmUsage = Object.assign(async (req, signal) => {
1693
+ return makeJsonRequest("POST", "/v1/convai/llm-usage/calculate", req, signal);
1694
+ }, { schema: ElevenLabsCalculateLlmUsageRequestSchema });
1695
+ // GET https://api.elevenlabs.io/v1/convai/llm/list
1696
+ // Docs: https://elevenlabs.io/docs/api-reference/llm/list
1697
+ const listLlms = Object.assign(async (signal) => {
1698
+ return makeJsonRequest("GET", "/v1/convai/llm/list", undefined, signal);
1699
+ }, { schema: undefined });
1700
+ // POST https://api.elevenlabs.io/v1/convai/agent-testing/create
1701
+ // Docs: https://elevenlabs.io/docs/api-reference/tests/create
1702
+ const createAgentTest = Object.assign(async (req, signal) => {
1703
+ return makeJsonRequest("POST", "/v1/convai/agent-testing/create", req, signal);
1704
+ }, { schema: ElevenLabsCreateAgentTestRequestSchema });
1705
+ // GET https://api.elevenlabs.io/v1/convai/agent-testing
1706
+ // Docs: https://elevenlabs.io/docs/api-reference/tests/list
1707
+ const listAgentTests = Object.assign(async (req = {}, signal) => {
1708
+ return makeJsonRequest("GET", "/v1/convai/agent-testing", undefined, signal, buildQueryString(req));
1709
+ }, { schema: ElevenLabsListAgentTestsRequestSchema });
1710
+ // GET https://api.elevenlabs.io/v1/convai/agent-testing/{testId}
1711
+ // Docs: https://elevenlabs.io/docs/api-reference/tests/get
1712
+ const getAgentTest = Object.assign(async (testId, signal) => {
1713
+ return makeJsonRequest("GET", `/v1/convai/agent-testing/${encodeURIComponent(testId)}`, undefined, signal);
1714
+ }, { schema: undefined });
1715
+ // PUT https://api.elevenlabs.io/v1/convai/agent-testing/{testId}
1716
+ // Docs: https://elevenlabs.io/docs/api-reference/tests/update
1717
+ const updateAgentTest = Object.assign(async (testId, req, signal) => {
1718
+ return makeJsonRequest("PUT", `/v1/convai/agent-testing/${encodeURIComponent(testId)}`, req, signal);
1719
+ }, { schema: ElevenLabsUpdateAgentTestRequestSchema });
1720
+ // DELETE https://api.elevenlabs.io/v1/convai/agent-testing/{testId}
1721
+ // Docs: https://elevenlabs.io/docs/api-reference/tests/delete
1722
+ const deleteAgentTest = Object.assign(async (testId, signal) => {
1723
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/convai/agent-testing/${encodeURIComponent(testId)}`, undefined, signal);
1724
+ }, { schema: undefined });
1725
+ // POST https://api.elevenlabs.io/v1/convai/agent-testing/summaries
1726
+ // Docs: https://elevenlabs.io/docs/api-reference/tests/summaries
1727
+ const getAgentTestSummaries = Object.assign(async (req, signal) => {
1728
+ return makeJsonRequest("POST", "/v1/convai/agent-testing/summaries", req, signal);
1729
+ }, { schema: ElevenLabsGetAgentTestSummariesRequestSchema });
1730
+ // POST https://api.elevenlabs.io/v1/convai/agent-testing/bulk-move
1731
+ // Docs: https://elevenlabs.io/docs/api-reference/tests/move
1732
+ const bulkMoveAgentTests = Object.assign(async (req, signal) => {
1733
+ return makeJsonRequestAllowEmpty("POST", "/v1/convai/agent-testing/bulk-move", req, signal);
1734
+ }, { schema: ElevenLabsBulkMoveAgentTestsRequestSchema });
1735
+ // POST https://api.elevenlabs.io/v1/convai/agent-testing/folders
1736
+ // Docs: https://elevenlabs.io/docs/api-reference/tests/test-folders/create
1737
+ const createAgentTestFolder = Object.assign(async (req, signal) => {
1738
+ return makeJsonRequest("POST", "/v1/convai/agent-testing/folders", req, signal);
1739
+ }, { schema: ElevenLabsCreateAgentTestFolderRequestSchema });
1740
+ // GET https://api.elevenlabs.io/v1/convai/agent-testing/folders/{folderId}
1741
+ // Docs: https://elevenlabs.io/docs/api-reference/tests/test-folders/get
1742
+ const getAgentTestFolder = Object.assign(async (folderId, signal) => {
1743
+ return makeJsonRequest("GET", `/v1/convai/agent-testing/folders/${encodeURIComponent(folderId)}`, undefined, signal);
1744
+ }, { schema: undefined });
1745
+ // PATCH https://api.elevenlabs.io/v1/convai/agent-testing/folders/{folderId}
1746
+ // Docs: https://elevenlabs.io/docs/api-reference/tests/test-folders/update
1747
+ const updateAgentTestFolder = Object.assign(async (folderId, req, signal) => {
1748
+ return makeJsonRequest("PATCH", `/v1/convai/agent-testing/folders/${encodeURIComponent(folderId)}`, req, signal);
1749
+ }, { schema: ElevenLabsUpdateAgentTestFolderRequestSchema });
1750
+ // DELETE https://api.elevenlabs.io/v1/convai/agent-testing/folders/{folderId}
1751
+ // Docs: https://elevenlabs.io/docs/api-reference/tests/test-folders/delete
1752
+ const deleteAgentTestFolder = Object.assign(async (folderId, req = {}, signal) => {
1753
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/convai/agent-testing/folders/${encodeURIComponent(folderId)}`, undefined, signal, buildQueryString(req));
1754
+ }, { schema: ElevenLabsDeleteAgentTestFolderRequestSchema });
1755
+ // POST https://api.elevenlabs.io/v1/convai/agents/{agentId}/run-tests
1756
+ // Docs: https://elevenlabs.io/docs/api-reference/tests/run-tests
1757
+ const runAgentTests = Object.assign(async (agentId, req, signal) => {
1758
+ return makeJsonRequest("POST", `/v1/convai/agents/${encodeURIComponent(agentId)}/run-tests`, req, signal);
1759
+ }, { schema: ElevenLabsRunAgentTestsRequestSchema });
1760
+ // GET https://api.elevenlabs.io/v1/convai/test-invocations
1761
+ // Docs: https://elevenlabs.io/docs/api-reference/tests/test-invocations/list
1762
+ const listTestInvocations = Object.assign(async (req = {}, signal) => {
1763
+ return makeJsonRequest("GET", "/v1/convai/test-invocations", undefined, signal, buildQueryString(req));
1764
+ }, { schema: ElevenLabsListTestInvocationsRequestSchema });
1765
+ // GET https://api.elevenlabs.io/v1/convai/test-invocations/{testInvocationId}
1766
+ // Docs: https://elevenlabs.io/docs/api-reference/tests/test-invocations/get
1767
+ const getTestInvocation = Object.assign(async (testInvocationId, signal) => {
1768
+ return makeJsonRequest("GET", `/v1/convai/test-invocations/${encodeURIComponent(testInvocationId)}`, undefined, signal);
1769
+ }, { schema: undefined });
1770
+ // POST https://api.elevenlabs.io/v1/convai/test-invocations/{testInvocationId}/resubmit
1771
+ // Docs: https://elevenlabs.io/docs/api-reference/tests/test-invocations/resubmit
1772
+ const resubmitTests = Object.assign(async (testInvocationId, req, signal) => {
1773
+ return makeJsonRequestAllowEmpty("POST", `/v1/convai/test-invocations/${encodeURIComponent(testInvocationId)}/resubmit`, req, signal);
1774
+ }, { schema: ElevenLabsResubmitTestsRequestSchema });
1775
+ // POST https://api.elevenlabs.io/v1/convai/phone-numbers
1776
+ // Docs: https://elevenlabs.io/docs/api-reference/phone-numbers/create
1777
+ const createPhoneNumber = Object.assign(async (req, signal) => {
1778
+ return makeJsonRequest("POST", "/v1/convai/phone-numbers", req, signal);
1779
+ }, { schema: ElevenLabsCreatePhoneNumberRequestSchema });
1780
+ // GET https://api.elevenlabs.io/v1/convai/phone-numbers
1781
+ // Docs: https://elevenlabs.io/docs/api-reference/phone-numbers/list
1782
+ const listPhoneNumbers = Object.assign(async (req = {}, signal) => {
1783
+ return makeJsonRequest("GET", "/v1/convai/phone-numbers", undefined, signal, buildQueryString(req));
1784
+ }, { schema: ElevenLabsListPhoneNumbersRequestSchema });
1785
+ // GET https://api.elevenlabs.io/v1/convai/phone-numbers/{phoneNumberId}
1786
+ // Docs: https://elevenlabs.io/docs/api-reference/phone-numbers/get
1787
+ const getPhoneNumber = Object.assign(async (phoneNumberId, signal) => {
1788
+ return makeJsonRequest("GET", `/v1/convai/phone-numbers/${encodeURIComponent(phoneNumberId)}`, undefined, signal);
1789
+ }, { schema: undefined });
1790
+ // PATCH https://api.elevenlabs.io/v1/convai/phone-numbers/{phoneNumberId}
1791
+ // Docs: https://elevenlabs.io/docs/api-reference/phone-numbers/update
1792
+ const updatePhoneNumber = Object.assign(async (phoneNumberId, req = {}, signal) => {
1793
+ return makeJsonRequest("PATCH", `/v1/convai/phone-numbers/${encodeURIComponent(phoneNumberId)}`, req, signal);
1794
+ }, { schema: ElevenLabsUpdatePhoneNumberRequestSchema });
1795
+ // DELETE https://api.elevenlabs.io/v1/convai/phone-numbers/{phoneNumberId}
1796
+ // Docs: https://elevenlabs.io/docs/api-reference/phone-numbers/delete
1797
+ const deletePhoneNumber = Object.assign(async (phoneNumberId, signal) => {
1798
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/convai/phone-numbers/${encodeURIComponent(phoneNumberId)}`, undefined, signal);
1799
+ }, { schema: undefined });
1800
+ // GET https://api.elevenlabs.io/v1/convai/phone-numbers/{phoneNumberId}/sip-messages
1801
+ // Docs: https://elevenlabs.io/docs/api-reference/phone-numbers/get-sip-messages
1802
+ const getPhoneNumberSipMessages = Object.assign(async (phoneNumberId, req = {}, signal) => {
1803
+ return makeJsonRequest("GET", `/v1/convai/phone-numbers/${encodeURIComponent(phoneNumberId)}/sip-messages`, undefined, signal, buildQueryString(req));
1804
+ }, { schema: ElevenLabsGetPhoneNumberSipMessagesRequestSchema });
1805
+ // POST https://api.elevenlabs.io/v1/convai/twilio/register-call
1806
+ // Docs: https://elevenlabs.io/docs/api-reference/twilio/register-call
1807
+ const registerTwilioCall = Object.assign(async (req, signal) => {
1808
+ return makeTextBodyRequest("POST", "/v1/convai/twilio/register-call", req, signal);
1809
+ }, { schema: ElevenLabsRegisterTwilioCallRequestSchema });
1810
+ // POST https://api.elevenlabs.io/v1/convai/twilio/outbound-call
1811
+ // Docs: https://elevenlabs.io/docs/api-reference/twilio/outbound-call
1812
+ const twilioOutboundCall = Object.assign(async (req, signal) => {
1813
+ return makeJsonRequest("POST", "/v1/convai/twilio/outbound-call", req, signal);
1814
+ }, { schema: ElevenLabsTwilioOutboundCallRequestSchema });
1815
+ // POST https://api.elevenlabs.io/v1/convai/sip-trunk/outbound-call
1816
+ // Docs: https://elevenlabs.io/docs/api-reference/sip-trunk/outbound-call
1817
+ const sipTrunkOutboundCall = Object.assign(async (req, signal) => {
1818
+ return makeJsonRequest("POST", "/v1/convai/sip-trunk/outbound-call", req, signal);
1819
+ }, { schema: ElevenLabsSipTrunkOutboundCallRequestSchema });
1820
+ // POST https://api.elevenlabs.io/v1/convai/exotel/outbound-call
1821
+ // Docs: https://elevenlabs.io/docs/api-reference/exotel/outbound-call
1822
+ const exotelOutboundCall = Object.assign(async (req, signal) => {
1823
+ return makeJsonRequest("POST", "/v1/convai/exotel/outbound-call", req, signal);
1824
+ }, { schema: ElevenLabsExotelOutboundCallRequestSchema });
1825
+ // POST https://api.elevenlabs.io/v1/convai/whatsapp/outbound-call
1826
+ // Docs: https://elevenlabs.io/docs/api-reference/whats-app/outbound-call
1827
+ const whatsAppOutboundCall = Object.assign(async (req, signal) => {
1828
+ return makeJsonRequest("POST", "/v1/convai/whatsapp/outbound-call", req, signal);
1829
+ }, { schema: ElevenLabsWhatsAppOutboundCallRequestSchema });
1830
+ // POST https://api.elevenlabs.io/v1/convai/whatsapp/outbound-message
1831
+ // Docs: https://elevenlabs.io/docs/api-reference/whats-app/outbound-message
1832
+ const whatsAppOutboundMessage = Object.assign(async (req, signal) => {
1833
+ return makeJsonRequest("POST", "/v1/convai/whatsapp/outbound-message", req, signal);
1834
+ }, { schema: ElevenLabsWhatsAppOutboundMessageRequestSchema });
1835
+ // GET https://api.elevenlabs.io/v1/convai/whatsapp-accounts
1836
+ // Docs: https://elevenlabs.io/docs/api-reference/whats-app/accounts/list
1837
+ const listWhatsAppAccounts = Object.assign(async (req = {}, signal) => {
1838
+ return makeJsonRequest("GET", "/v1/convai/whatsapp-accounts", undefined, signal, buildQueryString(req));
1839
+ }, { schema: ElevenLabsListWhatsAppAccountsRequestSchema });
1840
+ // GET https://api.elevenlabs.io/v1/convai/whatsapp-accounts/{phoneNumberId}
1841
+ // Docs: https://elevenlabs.io/docs/api-reference/whats-app/accounts/get
1842
+ const getWhatsAppAccount = Object.assign(async (phoneNumberId, signal) => {
1843
+ return makeJsonRequest("GET", `/v1/convai/whatsapp-accounts/${encodeURIComponent(phoneNumberId)}`, undefined, signal);
1844
+ }, { schema: undefined });
1845
+ // PATCH https://api.elevenlabs.io/v1/convai/whatsapp-accounts/{phoneNumberId}
1846
+ // Docs: https://elevenlabs.io/docs/api-reference/whats-app/accounts/update
1847
+ const updateWhatsAppAccount = Object.assign(async (phoneNumberId, req, signal) => {
1848
+ return makeJsonRequestAllowEmpty("PATCH", `/v1/convai/whatsapp-accounts/${encodeURIComponent(phoneNumberId)}`, req, signal);
1849
+ }, { schema: ElevenLabsUpdateWhatsAppAccountRequestSchema });
1850
+ // DELETE https://api.elevenlabs.io/v1/convai/whatsapp-accounts/{phoneNumberId}
1851
+ // Docs: https://elevenlabs.io/docs/api-reference/whats-app/accounts/delete
1852
+ const deleteWhatsAppAccount = Object.assign(async (phoneNumberId, signal) => {
1853
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/convai/whatsapp-accounts/${encodeURIComponent(phoneNumberId)}`, undefined, signal);
1854
+ }, { schema: undefined });
1855
+ const convaiAgentBranches = Object.assign(listAgentBranches, {
1856
+ create: createAgentBranch,
1857
+ get: getAgentBranch,
1858
+ update: updateAgentBranch,
1859
+ rebase: rebaseAgentBranch,
1860
+ rebasePreview: previewAgentBranchRebase,
1861
+ merge: mergeAgentBranch,
1862
+ mergePreview: previewAgentBranchMerge,
1863
+ });
1864
+ const convaiAgents = {
1865
+ create: createAgent,
1866
+ list: listAgents,
1867
+ get: getAgent,
1868
+ update: updateAgent,
1869
+ delete: deleteAgent,
1870
+ widget: getAgentWidget,
1871
+ link: getAgentLink,
1872
+ branches: convaiAgentBranches,
1873
+ summaries: getAgentSummaries,
1874
+ duplicate: duplicateAgent,
1875
+ avatar: postAgentAvatar,
1876
+ versions: { get: getAgentVersion },
1877
+ simulateConversation,
1878
+ topics: getAgentTopics,
1879
+ drafts: {
1880
+ create: createAgentDraft,
1881
+ delete: deleteAgentDraft,
1882
+ },
1883
+ deployments: createAgentDeployment,
1884
+ runTests: runAgentTests,
388
1885
  };
389
- const pvcSamplesSpeakers = {
390
- audio: getSeparatedSpeakerAudio,
1886
+ const convaiAgentTestFolders = {
1887
+ create: createAgentTestFolder,
1888
+ get: getAgentTestFolder,
1889
+ update: updateAgentTestFolder,
1890
+ delete: deleteAgentTestFolder,
1891
+ };
1892
+ const convaiAgentTesting = {
1893
+ create: createAgentTest,
1894
+ list: listAgentTests,
1895
+ get: getAgentTest,
1896
+ update: updateAgentTest,
1897
+ delete: deleteAgentTest,
1898
+ summaries: getAgentTestSummaries,
1899
+ bulkMove: bulkMoveAgentTests,
1900
+ folders: convaiAgentTestFolders,
1901
+ };
1902
+ const convaiTestInvocations = {
1903
+ list: listTestInvocations,
1904
+ get: getTestInvocation,
1905
+ resubmit: resubmitTests,
1906
+ };
1907
+ // GET https://api.elevenlabs.io/v1/convai/tags
1908
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/tags/list
1909
+ const listConversationTags = Object.assign(async (req = {}, signal) => {
1910
+ return makeJsonRequest("GET", "/v1/convai/tags", undefined, signal, buildQueryString(req));
1911
+ }, { schema: ElevenLabsListConversationTagsRequestSchema });
1912
+ // POST https://api.elevenlabs.io/v1/convai/tags
1913
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/tags/create
1914
+ const createConversationTag = Object.assign(async (req, signal) => {
1915
+ return makeJsonRequest("POST", "/v1/convai/tags", req, signal);
1916
+ }, { schema: ElevenLabsCreateConversationTagRequestSchema });
1917
+ // GET https://api.elevenlabs.io/v1/convai/tags/{tagId}
1918
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/tags/get
1919
+ const getConversationTag = Object.assign(async (tagId, signal) => {
1920
+ return makeJsonRequest("GET", `/v1/convai/tags/${encodeURIComponent(tagId)}`, undefined, signal);
1921
+ }, { schema: undefined });
1922
+ // PATCH https://api.elevenlabs.io/v1/convai/tags/{tagId}
1923
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/tags/update
1924
+ const updateConversationTag = Object.assign(async (tagId, req, signal) => {
1925
+ return makeJsonRequest("PATCH", `/v1/convai/tags/${encodeURIComponent(tagId)}`, req, signal);
1926
+ }, { schema: ElevenLabsUpdateConversationTagRequestSchema });
1927
+ // DELETE https://api.elevenlabs.io/v1/convai/tags/{tagId}
1928
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/tags/delete
1929
+ const deleteConversationTag = Object.assign(async (tagId, signal) => {
1930
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/convai/tags/${encodeURIComponent(tagId)}`, undefined, signal);
1931
+ }, { schema: undefined });
1932
+ // GET https://api.elevenlabs.io/v1/convai/settings
1933
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/get
1934
+ const getConvaiSettings = Object.assign(async (signal) => {
1935
+ return makeJsonRequest("GET", "/v1/convai/settings", undefined, signal);
1936
+ }, { schema: undefined });
1937
+ // PATCH https://api.elevenlabs.io/v1/convai/settings
1938
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/update
1939
+ const updateConvaiSettings = Object.assign(async (req, signal) => {
1940
+ return makeJsonRequest("PATCH", "/v1/convai/settings", req, signal);
1941
+ }, { schema: ElevenLabsUpdateConvaiSettingsRequestSchema });
1942
+ // GET https://api.elevenlabs.io/v1/convai/settings/dashboard
1943
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/dashboard/get
1944
+ const getConvaiDashboardSettings = Object.assign(async (signal) => {
1945
+ return makeJsonRequest("GET", "/v1/convai/settings/dashboard", undefined, signal);
1946
+ }, { schema: undefined });
1947
+ // PATCH https://api.elevenlabs.io/v1/convai/settings/dashboard
1948
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/dashboard/update
1949
+ const updateConvaiDashboardSettings = Object.assign(async (req, signal) => {
1950
+ return makeJsonRequest("PATCH", "/v1/convai/settings/dashboard", req, signal);
1951
+ }, { schema: ElevenLabsUpdateConvaiDashboardSettingsRequestSchema });
1952
+ // POST https://api.elevenlabs.io/v1/convai/secrets
1953
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/secrets/create
1954
+ const createWorkspaceSecret = Object.assign(async (req, signal) => {
1955
+ return makeJsonRequest("POST", "/v1/convai/secrets", req, signal);
1956
+ }, { schema: ElevenLabsCreateWorkspaceSecretRequestSchema });
1957
+ // GET https://api.elevenlabs.io/v1/convai/secrets
1958
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/secrets/list
1959
+ const listWorkspaceSecrets = Object.assign(async (req = {}, signal) => {
1960
+ return makeJsonRequest("GET", "/v1/convai/secrets", undefined, signal, buildQueryString(req));
1961
+ }, { schema: ElevenLabsListWorkspaceSecretsRequestSchema });
1962
+ // GET https://api.elevenlabs.io/v1/convai/secrets/{secretId}
1963
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/secrets/get
1964
+ const getWorkspaceSecret = Object.assign(async (secretId, signal) => {
1965
+ return makeJsonRequest("GET", `/v1/convai/secrets/${encodeURIComponent(secretId)}`, undefined, signal);
1966
+ }, { schema: undefined });
1967
+ // PATCH https://api.elevenlabs.io/v1/convai/secrets/{secretId}
1968
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/secrets/update
1969
+ const updateWorkspaceSecret = Object.assign(async (secretId, req, signal) => {
1970
+ return makeJsonRequest("PATCH", `/v1/convai/secrets/${encodeURIComponent(secretId)}`, req, signal);
1971
+ }, { schema: ElevenLabsUpdateWorkspaceSecretRequestSchema });
1972
+ // DELETE https://api.elevenlabs.io/v1/convai/secrets/{secretId}
1973
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/secrets/delete
1974
+ const deleteWorkspaceSecret = Object.assign(async (secretId, signal) => {
1975
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/convai/secrets/${encodeURIComponent(secretId)}`, undefined, signal);
1976
+ }, { schema: undefined });
1977
+ // GET https://api.elevenlabs.io/v1/convai/secrets/{secretId}/dependencies/{resourceType}
1978
+ // Docs: https://elevenlabs.io/docs/api-reference/workspace/secrets/get-dependencies
1979
+ const getSecretDependencies = Object.assign(async (secretId, resourceType, req = {}, signal) => {
1980
+ return makeJsonRequest("GET", `/v1/convai/secrets/${encodeURIComponent(secretId)}/dependencies/${encodeURIComponent(resourceType)}`, undefined, signal, buildQueryString(req));
1981
+ }, { schema: ElevenLabsGetSecretDependenciesRequestSchema });
1982
+ // GET https://api.elevenlabs.io/v1/convai/environment-variables
1983
+ // Docs: https://elevenlabs.io/docs/api-reference/environment-variables/list
1984
+ const listEnvironmentVariables = Object.assign(async (req = {}, signal) => {
1985
+ return makeJsonRequest("GET", "/v1/convai/environment-variables", undefined, signal, buildQueryString(req));
1986
+ }, { schema: ElevenLabsListEnvironmentVariablesRequestSchema });
1987
+ // POST https://api.elevenlabs.io/v1/convai/environment-variables
1988
+ // Docs: https://elevenlabs.io/docs/api-reference/environment-variables/create
1989
+ const createEnvironmentVariable = Object.assign(async (req, signal) => {
1990
+ return makeJsonRequest("POST", "/v1/convai/environment-variables", req, signal);
1991
+ }, { schema: ElevenLabsCreateEnvironmentVariableRequestSchema });
1992
+ // GET https://api.elevenlabs.io/v1/convai/environment-variables/{envVarId}
1993
+ // Docs: https://elevenlabs.io/docs/api-reference/environment-variables/get
1994
+ const getEnvironmentVariable = Object.assign(async (envVarId, signal) => {
1995
+ return makeJsonRequest("GET", `/v1/convai/environment-variables/${encodeURIComponent(envVarId)}`, undefined, signal);
1996
+ }, { schema: undefined });
1997
+ // PATCH https://api.elevenlabs.io/v1/convai/environment-variables/{envVarId}
1998
+ // Docs: https://elevenlabs.io/docs/api-reference/environment-variables/update
1999
+ const updateEnvironmentVariable = Object.assign(async (envVarId, req, signal) => {
2000
+ return makeJsonRequest("PATCH", `/v1/convai/environment-variables/${encodeURIComponent(envVarId)}`, req, signal);
2001
+ }, { schema: ElevenLabsUpdateEnvironmentVariableRequestSchema });
2002
+ // POST https://api.elevenlabs.io/v1/convai/tools
2003
+ // Docs: https://elevenlabs.io/docs/api-reference/tools/create
2004
+ const createTool = Object.assign(async (req, signal) => {
2005
+ return makeJsonRequest("POST", "/v1/convai/tools", req, signal);
2006
+ }, { schema: ElevenLabsCreateToolRequestSchema });
2007
+ // GET https://api.elevenlabs.io/v1/convai/tools
2008
+ // Docs: https://elevenlabs.io/docs/api-reference/tools/list
2009
+ const listTools = Object.assign(async (req = {}, signal) => {
2010
+ return makeJsonRequest("GET", "/v1/convai/tools", undefined, signal, buildQueryString(req));
2011
+ }, { schema: ElevenLabsListToolsRequestSchema });
2012
+ // GET https://api.elevenlabs.io/v1/convai/tools/{toolId}
2013
+ // Docs: https://elevenlabs.io/docs/api-reference/tools/get
2014
+ const getTool = Object.assign(async (toolId, signal) => {
2015
+ return makeJsonRequest("GET", `/v1/convai/tools/${encodeURIComponent(toolId)}`, undefined, signal);
2016
+ }, { schema: undefined });
2017
+ // PATCH https://api.elevenlabs.io/v1/convai/tools/{toolId}
2018
+ // Docs: https://elevenlabs.io/docs/api-reference/tools/update
2019
+ const updateTool = Object.assign(async (toolId, req, signal) => {
2020
+ return makeJsonRequest("PATCH", `/v1/convai/tools/${encodeURIComponent(toolId)}`, req, signal);
2021
+ }, { schema: ElevenLabsUpdateToolRequestSchema });
2022
+ // DELETE https://api.elevenlabs.io/v1/convai/tools/{toolId}
2023
+ // Docs: https://elevenlabs.io/docs/api-reference/tools/delete
2024
+ const deleteTool = Object.assign(async (toolId, signal) => {
2025
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/convai/tools/${encodeURIComponent(toolId)}`, undefined, signal);
2026
+ }, { schema: undefined });
2027
+ // GET https://api.elevenlabs.io/v1/convai/tools/{toolId}/dependent-agents
2028
+ // Docs: https://elevenlabs.io/docs/api-reference/tools/get-dependent-agents
2029
+ const getToolDependentAgents = Object.assign(async (toolId, req = {}, signal) => {
2030
+ return makeJsonRequest("GET", `/v1/convai/tools/${encodeURIComponent(toolId)}/dependent-agents`, undefined, signal, buildQueryString(req));
2031
+ }, { schema: ElevenLabsGetToolDependentAgentsRequestSchema });
2032
+ // GET https://api.elevenlabs.io/v1/convai/tools/{toolId}/executions
2033
+ // Docs: https://elevenlabs.io/docs/api-reference/tools/get-executions
2034
+ const getToolExecutions = Object.assign(async (toolId, req = {}, signal) => {
2035
+ return makeJsonRequest("GET", `/v1/convai/tools/${encodeURIComponent(toolId)}/executions`, undefined, signal, buildQueryString(req));
2036
+ }, { schema: ElevenLabsGetToolExecutionsRequestSchema });
2037
+ // POST https://api.elevenlabs.io/v1/convai/mcp-servers
2038
+ // Docs: https://elevenlabs.io/docs/api-reference/mcp/create
2039
+ const createMcpServer = Object.assign(async (req, signal) => {
2040
+ return makeJsonRequest("POST", "/v1/convai/mcp-servers", req, signal);
2041
+ }, { schema: ElevenLabsCreateMcpServerRequestSchema });
2042
+ // GET https://api.elevenlabs.io/v1/convai/mcp-servers
2043
+ // Docs: https://elevenlabs.io/docs/api-reference/mcp/list
2044
+ const listMcpServers = Object.assign(async (signal) => {
2045
+ return makeJsonRequest("GET", "/v1/convai/mcp-servers", undefined, signal);
2046
+ }, { schema: undefined });
2047
+ // GET https://api.elevenlabs.io/v1/convai/mcp-servers/{mcpServerId}
2048
+ // Docs: https://elevenlabs.io/docs/api-reference/mcp/get
2049
+ const getMcpServer = Object.assign(async (mcpServerId, signal) => {
2050
+ return makeJsonRequest("GET", `/v1/convai/mcp-servers/${encodeURIComponent(mcpServerId)}`, undefined, signal);
2051
+ }, { schema: undefined });
2052
+ // PATCH https://api.elevenlabs.io/v1/convai/mcp-servers/{mcpServerId}
2053
+ // Docs: https://elevenlabs.io/docs/api-reference/mcp/update
2054
+ const updateMcpServer = Object.assign(async (mcpServerId, req, signal) => {
2055
+ return makeJsonRequest("PATCH", `/v1/convai/mcp-servers/${encodeURIComponent(mcpServerId)}`, req, signal);
2056
+ }, { schema: ElevenLabsUpdateMcpServerRequestSchema });
2057
+ // DELETE https://api.elevenlabs.io/v1/convai/mcp-servers/{mcpServerId}
2058
+ // Docs: https://elevenlabs.io/docs/api-reference/mcp/delete
2059
+ const deleteMcpServer = Object.assign(async (mcpServerId, signal) => {
2060
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/convai/mcp-servers/${encodeURIComponent(mcpServerId)}`, undefined, signal);
2061
+ }, { schema: undefined });
2062
+ // GET https://api.elevenlabs.io/v1/convai/mcp-servers/{mcpServerId}/tools
2063
+ // Docs: https://elevenlabs.io/docs/api-reference/mcp/list-tools
2064
+ const listMcpServerTools = Object.assign(async (mcpServerId, signal) => {
2065
+ return makeJsonRequest("GET", `/v1/convai/mcp-servers/${encodeURIComponent(mcpServerId)}/tools`, undefined, signal);
2066
+ }, { schema: undefined });
2067
+ // POST https://api.elevenlabs.io/v1/convai/mcp-servers/{mcpServerId}/tool-approvals
2068
+ // Docs: https://elevenlabs.io/docs/api-reference/mcp/approval-policies/create
2069
+ const createMcpServerToolApproval = Object.assign(async (mcpServerId, req, signal) => {
2070
+ return makeJsonRequest("POST", `/v1/convai/mcp-servers/${encodeURIComponent(mcpServerId)}/tool-approvals`, req, signal);
2071
+ }, { schema: ElevenLabsCreateMcpServerToolApprovalRequestSchema });
2072
+ // DELETE https://api.elevenlabs.io/v1/convai/mcp-servers/{mcpServerId}/tool-approvals/{toolName}
2073
+ // Docs: https://elevenlabs.io/docs/api-reference/mcp/approval-policies/delete
2074
+ const deleteMcpServerToolApproval = Object.assign(async (mcpServerId, toolName, signal) => {
2075
+ return makeJsonRequest("DELETE", `/v1/convai/mcp-servers/${encodeURIComponent(mcpServerId)}/tool-approvals/${encodeURIComponent(toolName)}`, undefined, signal);
2076
+ }, { schema: undefined });
2077
+ // POST https://api.elevenlabs.io/v1/convai/mcp-servers/{mcpServerId}/tool-configs
2078
+ // Docs: https://elevenlabs.io/docs/api-reference/mcp/tool-configuration/create
2079
+ const createMcpToolConfigOverride = Object.assign(async (mcpServerId, req, signal) => {
2080
+ return makeJsonRequest("POST", `/v1/convai/mcp-servers/${encodeURIComponent(mcpServerId)}/tool-configs`, req, signal);
2081
+ }, { schema: ElevenLabsCreateMcpToolConfigOverrideRequestSchema });
2082
+ // GET https://api.elevenlabs.io/v1/convai/mcp-servers/{mcpServerId}/tool-configs/{toolName}
2083
+ // Docs: https://elevenlabs.io/docs/api-reference/mcp/tool-configuration/get
2084
+ const getMcpToolConfigOverride = Object.assign(async (mcpServerId, toolName, signal) => {
2085
+ return makeJsonRequest("GET", `/v1/convai/mcp-servers/${encodeURIComponent(mcpServerId)}/tool-configs/${encodeURIComponent(toolName)}`, undefined, signal);
2086
+ }, { schema: undefined });
2087
+ // PATCH https://api.elevenlabs.io/v1/convai/mcp-servers/{mcpServerId}/tool-configs/{toolName}
2088
+ // Docs: https://elevenlabs.io/docs/api-reference/mcp/tool-configuration/update
2089
+ const updateMcpToolConfigOverride = Object.assign(async (mcpServerId, toolName, req, signal) => {
2090
+ return makeJsonRequest("PATCH", `/v1/convai/mcp-servers/${encodeURIComponent(mcpServerId)}/tool-configs/${encodeURIComponent(toolName)}`, req, signal);
2091
+ }, { schema: ElevenLabsUpdateMcpToolConfigOverrideRequestSchema });
2092
+ // DELETE https://api.elevenlabs.io/v1/convai/mcp-servers/{mcpServerId}/tool-configs/{toolName}
2093
+ // Docs: https://elevenlabs.io/docs/api-reference/mcp/tool-configuration/delete
2094
+ const deleteMcpToolConfigOverride = Object.assign(async (mcpServerId, toolName, signal) => {
2095
+ return makeJsonRequest("DELETE", `/v1/convai/mcp-servers/${encodeURIComponent(mcpServerId)}/tool-configs/${encodeURIComponent(toolName)}`, undefined, signal);
2096
+ }, { schema: undefined });
2097
+ // GET https://api.elevenlabs.io/v1/convai/conversations
2098
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/list
2099
+ const listConversations = Object.assign(async (req = {}, signal) => {
2100
+ return makeJsonRequest("GET", "/v1/convai/conversations", undefined, signal, buildQueryString(req));
2101
+ }, { schema: ElevenLabsListConversationsRequestSchema });
2102
+ // GET https://api.elevenlabs.io/v1/history
2103
+ // Docs: https://elevenlabs.io/docs/api-reference/history/get-generated-items
2104
+ const listHistory = Object.assign(async (req = {}, signal) => {
2105
+ return makeJsonRequest("GET", "/v1/history", undefined, signal, buildQueryString(req));
2106
+ }, { schema: ElevenLabsHistoryListRequestSchema });
2107
+ // GET https://api.elevenlabs.io/v1/history/{historyItemId}
2108
+ // Docs: https://elevenlabs.io/docs/api-reference/history/get-history-item-by-id
2109
+ const getHistoryItem = Object.assign(async (historyItemId, signal) => {
2110
+ return makeJsonRequest("GET", `/v1/history/${encodeURIComponent(historyItemId)}`, undefined, signal);
2111
+ }, { schema: undefined });
2112
+ // DELETE https://api.elevenlabs.io/v1/history/{historyItemId}
2113
+ // Docs: https://elevenlabs.io/docs/api-reference/history/delete-history-item
2114
+ const deleteHistoryItem = Object.assign(async (historyItemId, signal) => {
2115
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/history/${encodeURIComponent(historyItemId)}`, undefined, signal);
2116
+ }, { schema: undefined });
2117
+ // GET https://api.elevenlabs.io/v1/history/{historyItemId}/audio
2118
+ // Docs: https://elevenlabs.io/docs/api-reference/history/get-audio-from-history-item
2119
+ const getHistoryItemAudio = Object.assign(async (historyItemId, signal) => {
2120
+ return makeGetBinaryRequest(`/v1/history/${encodeURIComponent(historyItemId)}/audio`, "", signal);
2121
+ }, { schema: undefined });
2122
+ // POST https://api.elevenlabs.io/v1/history/download
2123
+ // Docs: https://elevenlabs.io/docs/api-reference/history/download-history-items
2124
+ const downloadHistory = Object.assign(async (req, signal) => {
2125
+ return makeBinaryRequest("/v1/history/download", req, undefined, signal);
2126
+ }, { schema: ElevenLabsHistoryDownloadRequestSchema });
2127
+ // GET https://api.elevenlabs.io/v1/convai/conversations/{conversationId}
2128
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/get
2129
+ const getConversation = Object.assign(async (conversationId, req = {}, signal) => {
2130
+ return makeJsonRequest("GET", `/v1/convai/conversations/${encodeURIComponent(conversationId)}`, undefined, signal, buildQueryString(req));
2131
+ }, { schema: ElevenLabsGetConversationRequestSchema });
2132
+ // DELETE https://api.elevenlabs.io/v1/convai/conversations/{conversationId}
2133
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/delete
2134
+ const deleteConversation = Object.assign(async (conversationId, signal) => {
2135
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/convai/conversations/${encodeURIComponent(conversationId)}`, undefined, signal);
2136
+ }, { schema: undefined });
2137
+ // GET https://api.elevenlabs.io/v1/convai/conversations/{conversationId}/audio
2138
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/get-audio
2139
+ const getConversationAudio = Object.assign(async (conversationId, signal) => {
2140
+ return makeGetBinaryRequest(`/v1/convai/conversations/${encodeURIComponent(conversationId)}/audio`, "", signal);
2141
+ }, { schema: undefined });
2142
+ // GET https://api.elevenlabs.io/v1/convai/conversation/get-signed-url
2143
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/get-signed-url
2144
+ const getSignedUrl = Object.assign(async (req, signal) => {
2145
+ return makeJsonRequest("GET", "/v1/convai/conversation/get-signed-url", undefined, signal, buildQueryString(req));
2146
+ }, { schema: ElevenLabsGetSignedUrlRequestSchema });
2147
+ // GET https://api.elevenlabs.io/v1/convai/conversation/token
2148
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/get-webrtc-token
2149
+ const getConversationToken = Object.assign(async (req, signal) => {
2150
+ return makeJsonRequest("GET", "/v1/convai/conversation/token", undefined, signal, buildQueryString(req));
2151
+ }, { schema: ElevenLabsGetConversationTokenRequestSchema });
2152
+ // GET https://api.elevenlabs.io/v1/convai/conversations/messages/smart-search
2153
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/messages/search
2154
+ const smartSearchConversationMessages = Object.assign(async (req, signal) => {
2155
+ return makeJsonRequest("GET", "/v1/convai/conversations/messages/smart-search", undefined, signal, buildQueryString(req));
2156
+ }, { schema: ElevenLabsSmartSearchConversationMessagesRequestSchema });
2157
+ // GET https://api.elevenlabs.io/v1/convai/conversations/messages/text-search
2158
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/messages/text-search
2159
+ const textSearchConversationMessages = Object.assign(async (req, signal) => {
2160
+ return makeJsonRequest("GET", "/v1/convai/conversations/messages/text-search", undefined, signal, buildQueryString(req));
2161
+ }, { schema: ElevenLabsTextSearchConversationMessagesRequestSchema });
2162
+ // POST https://api.elevenlabs.io/v1/convai/conversations/{conversationId}/feedback
2163
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/create
2164
+ const sendConversationFeedback = Object.assign(async (conversationId, req, signal) => {
2165
+ return makeJsonRequestAllowEmpty("POST", `/v1/convai/conversations/${encodeURIComponent(conversationId)}/feedback`, req, signal);
2166
+ }, { schema: ElevenLabsConversationFeedbackRequestSchema });
2167
+ // POST https://api.elevenlabs.io/v1/convai/conversations/{conversationId}/files
2168
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/upload-file
2169
+ const uploadConversationFile = Object.assign(async (conversationId, req, signal) => {
2170
+ const form = new FormData();
2171
+ appendFormField(form, "file", req.file);
2172
+ return makeMultipartJsonRequest(`/v1/convai/conversations/${encodeURIComponent(conversationId)}/files`, form, undefined, signal);
2173
+ }, { schema: ElevenLabsUploadConversationFileRequestSchema });
2174
+ // DELETE https://api.elevenlabs.io/v1/convai/conversations/{conversationId}/files/{fileId}
2175
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/delete-file
2176
+ const deleteConversationFile = Object.assign(async (conversationId, fileId, signal) => {
2177
+ return makeJsonRequest("DELETE", `/v1/convai/conversations/${encodeURIComponent(conversationId)}/files/${encodeURIComponent(fileId)}`, undefined, signal);
2178
+ }, { schema: undefined });
2179
+ // GET https://api.elevenlabs.io/v1/convai/conversations/{conversationId}/sip-messages
2180
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/get-sip-messages
2181
+ const getConversationSipMessages = Object.assign(async (conversationId, req = {}, signal) => {
2182
+ return makeJsonRequest("GET", `/v1/convai/conversations/${encodeURIComponent(conversationId)}/sip-messages`, undefined, signal, buildQueryString(req));
2183
+ }, { schema: ElevenLabsGetConversationSipMessagesRequestSchema });
2184
+ // POST https://api.elevenlabs.io/v1/convai/conversations/{conversationId}/tags
2185
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/tags/assign
2186
+ const assignConversationTags = Object.assign(async (conversationId, req, signal) => {
2187
+ return makeJsonRequestAllowEmpty("POST", `/v1/convai/conversations/${encodeURIComponent(conversationId)}/tags`, req, signal);
2188
+ }, { schema: ElevenLabsAssignConversationTagsRequestSchema });
2189
+ // DELETE https://api.elevenlabs.io/v1/convai/conversations/{conversationId}/tags/{tagId}
2190
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/tags/unassign
2191
+ const unassignConversationTag = Object.assign(async (conversationId, tagId, signal) => {
2192
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/convai/conversations/${encodeURIComponent(conversationId)}/tags/${encodeURIComponent(tagId)}`, undefined, signal);
2193
+ }, { schema: undefined });
2194
+ // POST https://api.elevenlabs.io/v1/convai/conversations/{conversationId}/analysis/run
2195
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/analysis/run-analysis
2196
+ const runConversationAnalysis = Object.assign(async (conversationId, signal) => {
2197
+ return makeJsonRequest("POST", `/v1/convai/conversations/${encodeURIComponent(conversationId)}/analysis/run`, undefined, signal);
2198
+ }, { schema: undefined });
2199
+ // POST https://api.elevenlabs.io/v1/convai/conversations/{conversationId}/analysis/evaluations/run
2200
+ // Docs: https://elevenlabs.io/docs/api-reference/conversations/analysis/run-evaluation
2201
+ const runConversationEvaluations = Object.assign(async (conversationId, req, signal) => {
2202
+ return makeJsonRequest("POST", `/v1/convai/conversations/${encodeURIComponent(conversationId)}/analysis/evaluations/run`, req, signal);
2203
+ }, { schema: ElevenLabsRunConversationEvaluationsRequestSchema });
2204
+ // POST https://api.elevenlabs.io/v1/convai/batch-calling/submit
2205
+ // Docs: https://elevenlabs.io/docs/api-reference/batch-calling/create
2206
+ const submitBatchCall = Object.assign(async (req, signal) => {
2207
+ return makeJsonRequest("POST", "/v1/convai/batch-calling/submit", req, signal);
2208
+ }, { schema: ElevenLabsSubmitBatchCallRequestSchema });
2209
+ // GET https://api.elevenlabs.io/v1/convai/batch-calling/workspace
2210
+ // Docs: https://elevenlabs.io/docs/api-reference/batch-calling/list
2211
+ const listWorkspaceBatchCalls = Object.assign(async (req = {}, signal) => {
2212
+ return makeJsonRequest("GET", "/v1/convai/batch-calling/workspace", undefined, signal, buildQueryString(req));
2213
+ }, { schema: ElevenLabsListWorkspaceBatchCallsRequestSchema });
2214
+ // GET https://api.elevenlabs.io/v1/convai/batch-calling/{batchId}
2215
+ // Docs: https://elevenlabs.io/docs/api-reference/batch-calling/get
2216
+ const getBatchCall = Object.assign(async (batchId, signal) => {
2217
+ return makeJsonRequest("GET", `/v1/convai/batch-calling/${encodeURIComponent(batchId)}`, undefined, signal);
2218
+ }, { schema: undefined });
2219
+ // DELETE https://api.elevenlabs.io/v1/convai/batch-calling/{batchId}
2220
+ // Docs: https://elevenlabs.io/docs/api-reference/batch-calling/delete
2221
+ const deleteBatchCall = Object.assign(async (batchId, signal) => {
2222
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/convai/batch-calling/${encodeURIComponent(batchId)}`, undefined, signal);
2223
+ }, { schema: undefined });
2224
+ // POST https://api.elevenlabs.io/v1/convai/batch-calling/{batchId}/cancel
2225
+ // Docs: https://elevenlabs.io/docs/api-reference/batch-calling/cancel
2226
+ const cancelBatchCall = Object.assign(async (batchId, signal) => {
2227
+ return makeJsonRequest("POST", `/v1/convai/batch-calling/${encodeURIComponent(batchId)}/cancel`, undefined, signal);
2228
+ }, { schema: undefined });
2229
+ // POST https://api.elevenlabs.io/v1/convai/batch-calling/{batchId}/retry
2230
+ // Docs: https://elevenlabs.io/docs/api-reference/batch-calling/retry
2231
+ const retryBatchCall = Object.assign(async (batchId, signal) => {
2232
+ return makeJsonRequest("POST", `/v1/convai/batch-calling/${encodeURIComponent(batchId)}/retry`, undefined, signal);
2233
+ }, { schema: undefined });
2234
+ const convaiDashboardSettings = Object.assign(getConvaiDashboardSettings, {
2235
+ update: updateConvaiDashboardSettings,
2236
+ });
2237
+ const convaiSettings = Object.assign(getConvaiSettings, {
2238
+ update: updateConvaiSettings,
2239
+ dashboard: convaiDashboardSettings,
2240
+ });
2241
+ const convaiSecrets = {
2242
+ create: createWorkspaceSecret,
2243
+ list: listWorkspaceSecrets,
2244
+ get: getWorkspaceSecret,
2245
+ update: updateWorkspaceSecret,
2246
+ delete: deleteWorkspaceSecret,
2247
+ dependencies: getSecretDependencies,
2248
+ };
2249
+ const convaiEnvironmentVariables = {
2250
+ create: createEnvironmentVariable,
2251
+ list: listEnvironmentVariables,
2252
+ get: getEnvironmentVariable,
2253
+ update: updateEnvironmentVariable,
2254
+ };
2255
+ const convaiTools = {
2256
+ create: createTool,
2257
+ list: listTools,
2258
+ get: getTool,
2259
+ update: updateTool,
2260
+ delete: deleteTool,
2261
+ dependentAgents: getToolDependentAgents,
2262
+ executions: getToolExecutions,
2263
+ };
2264
+ const convaiTags = {
2265
+ create: createConversationTag,
2266
+ list: listConversationTags,
2267
+ get: getConversationTag,
2268
+ update: updateConversationTag,
2269
+ delete: deleteConversationTag,
2270
+ };
2271
+ const convaiMcpServerToolApprovals = {
2272
+ create: createMcpServerToolApproval,
2273
+ delete: deleteMcpServerToolApproval,
2274
+ };
2275
+ const convaiMcpServerToolConfigs = {
2276
+ create: createMcpToolConfigOverride,
2277
+ get: getMcpToolConfigOverride,
2278
+ update: updateMcpToolConfigOverride,
2279
+ delete: deleteMcpToolConfigOverride,
2280
+ };
2281
+ const convaiMcpServers = {
2282
+ create: createMcpServer,
2283
+ list: listMcpServers,
2284
+ get: getMcpServer,
2285
+ update: updateMcpServer,
2286
+ delete: deleteMcpServer,
2287
+ tools: listMcpServerTools,
2288
+ toolApprovals: convaiMcpServerToolApprovals,
2289
+ toolConfigs: convaiMcpServerToolConfigs,
2290
+ };
2291
+ const convaiBatchCalling = {
2292
+ submit: submitBatchCall,
2293
+ workspace: listWorkspaceBatchCalls,
2294
+ get: getBatchCall,
2295
+ delete: deleteBatchCall,
2296
+ cancel: cancelBatchCall,
2297
+ retry: retryBatchCall,
2298
+ };
2299
+ const convaiUsers = {
2300
+ list: listConversationUsers,
2301
+ };
2302
+ const convaiLlmUsage = {
2303
+ calculate: calculateLlmUsage,
2304
+ };
2305
+ const convaiLlm = {
2306
+ list: listLlms,
2307
+ };
2308
+ // POST https://api.elevenlabs.io/v1/convai/knowledge-base/url
2309
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/create-from-url
2310
+ const createKnowledgeBaseDocumentFromUrl = Object.assign(async (req, signal) => {
2311
+ return makeJsonRequest("POST", "/v1/convai/knowledge-base/url", req, signal);
2312
+ }, { schema: ElevenLabsCreateKnowledgeBaseDocumentFromUrlRequestSchema });
2313
+ // POST https://api.elevenlabs.io/v1/convai/knowledge-base/text
2314
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/create-from-text
2315
+ const createKnowledgeBaseDocumentFromText = Object.assign(async (req, signal) => {
2316
+ return makeJsonRequest("POST", "/v1/convai/knowledge-base/text", req, signal);
2317
+ }, { schema: ElevenLabsCreateKnowledgeBaseDocumentFromTextRequestSchema });
2318
+ // POST https://api.elevenlabs.io/v1/convai/knowledge-base/file
2319
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/create-from-file
2320
+ const createKnowledgeBaseDocumentFromFile = Object.assign(async (req, signal) => {
2321
+ const form = new FormData();
2322
+ for (const [key, value] of Object.entries(req)) {
2323
+ appendFormField(form, key, value);
2324
+ }
2325
+ return makeMultipartJsonRequest("/v1/convai/knowledge-base/file", form, undefined, signal);
2326
+ }, { schema: ElevenLabsCreateKnowledgeBaseDocumentFromFileRequestSchema });
2327
+ // GET https://api.elevenlabs.io/v1/convai/knowledge-base
2328
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/list
2329
+ const listKnowledgeBaseDocuments = Object.assign(async (req = {}, signal) => {
2330
+ return makeJsonRequest("GET", "/v1/convai/knowledge-base", undefined, signal, buildQueryString(req));
2331
+ }, { schema: ElevenLabsListKnowledgeBaseDocumentsRequestSchema });
2332
+ // GET https://api.elevenlabs.io/v1/convai/knowledge-base/{documentationId}
2333
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/get-document
2334
+ const getKnowledgeBaseDocument = Object.assign(async (documentationId, req = {}, signal) => {
2335
+ return makeJsonRequest("GET", `/v1/convai/knowledge-base/${encodeURIComponent(documentationId)}`, undefined, signal, buildQueryString(req));
2336
+ }, { schema: ElevenLabsGetKnowledgeBaseDocumentRequestSchema });
2337
+ // DELETE https://api.elevenlabs.io/v1/convai/knowledge-base/{documentationId}
2338
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/delete
2339
+ const deleteKnowledgeBaseDocument = Object.assign(async (documentationId, req = {}, signal) => {
2340
+ return makeJsonRequestAllowEmpty("DELETE", `/v1/convai/knowledge-base/${encodeURIComponent(documentationId)}`, undefined, signal, buildQueryString(req));
2341
+ }, { schema: ElevenLabsDeleteKnowledgeBaseDocumentRequestSchema });
2342
+ // GET https://api.elevenlabs.io/v1/convai/knowledge-base/summaries
2343
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/get-summaries
2344
+ const getKnowledgeBaseSummaries = Object.assign(async (req, signal) => {
2345
+ return makeJsonRequest("GET", "/v1/convai/knowledge-base/summaries", undefined, signal, buildQueryString(req));
2346
+ }, { schema: ElevenLabsGetKnowledgeBaseSummariesRequestSchema });
2347
+ // GET https://api.elevenlabs.io/v1/convai/knowledge-base/search
2348
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/search
2349
+ const searchKnowledgeBaseContent = Object.assign(async (req, signal) => {
2350
+ return makeJsonRequest("GET", "/v1/convai/knowledge-base/search", undefined, signal, buildQueryString(req));
2351
+ }, { schema: ElevenLabsSearchKnowledgeBaseContentRequestSchema });
2352
+ // PATCH https://api.elevenlabs.io/v1/convai/knowledge-base/{documentationId}
2353
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/update
2354
+ const updateKnowledgeBaseDocument = Object.assign(async (documentationId, req, signal) => {
2355
+ return makeJsonRequest("PATCH", `/v1/convai/knowledge-base/${encodeURIComponent(documentationId)}`, req, signal);
2356
+ }, { schema: ElevenLabsUpdateKnowledgeBaseDocumentRequestSchema });
2357
+ // GET https://api.elevenlabs.io/v1/convai/knowledge-base/{documentationId}/content
2358
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/get-content
2359
+ const getKnowledgeBaseDocumentContent = Object.assign(async (documentationId, signal) => {
2360
+ return makeTextRequest("GET", `/v1/convai/knowledge-base/${encodeURIComponent(documentationId)}/content`, signal);
2361
+ }, { schema: undefined });
2362
+ // GET https://api.elevenlabs.io/v1/convai/knowledge-base/{documentationId}/chunks
2363
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/get-chunks
2364
+ const listKnowledgeBaseDocumentChunks = Object.assign(async (documentationId, req, signal) => {
2365
+ return makeJsonRequest("GET", `/v1/convai/knowledge-base/${encodeURIComponent(documentationId)}/chunks`, undefined, signal, buildQueryString(req));
2366
+ }, { schema: ElevenLabsListKnowledgeBaseDocumentChunksRequestSchema });
2367
+ // GET https://api.elevenlabs.io/v1/convai/knowledge-base/{documentationId}/chunk/{chunkId}
2368
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/get-chunk
2369
+ const getKnowledgeBaseDocumentChunk = Object.assign(async (documentationId, chunkId, req = {}, signal) => {
2370
+ return makeJsonRequest("GET", `/v1/convai/knowledge-base/${encodeURIComponent(documentationId)}/chunk/${encodeURIComponent(chunkId)}`, undefined, signal, buildQueryString(req));
2371
+ }, { schema: ElevenLabsGetKnowledgeBaseDocumentChunkRequestSchema });
2372
+ // GET https://api.elevenlabs.io/v1/convai/knowledge-base/{documentationId}/dependent-agents
2373
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/get-agents
2374
+ const getKnowledgeBaseDependentAgents = Object.assign(async (documentationId, req = {}, signal) => {
2375
+ return makeJsonRequest("GET", `/v1/convai/knowledge-base/${encodeURIComponent(documentationId)}/dependent-agents`, undefined, signal, buildQueryString(req));
2376
+ }, { schema: ElevenLabsGetKnowledgeBaseDependentAgentsRequestSchema });
2377
+ // GET https://api.elevenlabs.io/v1/convai/knowledge-base/{documentationId}/source-file-url
2378
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/get-source-file-url
2379
+ const getKnowledgeBaseSourceFileUrl = Object.assign(async (documentationId, signal) => {
2380
+ return makeJsonRequest("GET", `/v1/convai/knowledge-base/${encodeURIComponent(documentationId)}/source-file-url`, undefined, signal);
2381
+ }, { schema: undefined });
2382
+ // POST https://api.elevenlabs.io/v1/convai/knowledge-base/{documentationId}/refresh
2383
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/refresh
2384
+ const refreshKnowledgeBaseDocument = Object.assign(async (documentationId, signal) => {
2385
+ return makeJsonRequest("POST", `/v1/convai/knowledge-base/${encodeURIComponent(documentationId)}/refresh`, undefined, signal);
2386
+ }, { schema: undefined });
2387
+ // PATCH https://api.elevenlabs.io/v1/convai/knowledge-base/{documentationId}/update-file
2388
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/update-file
2389
+ const updateKnowledgeBaseFileDocument = Object.assign(async (documentationId, req, signal) => {
2390
+ const form = new FormData();
2391
+ appendFormField(form, "file", req.file);
2392
+ return makeMultipartJsonRequestWithMethod("PATCH", `/v1/convai/knowledge-base/${encodeURIComponent(documentationId)}/update-file`, form, undefined, signal);
2393
+ }, { schema: ElevenLabsUpdateKnowledgeBaseFileDocumentRequestSchema });
2394
+ // GET https://api.elevenlabs.io/v1/convai/knowledge-base/rag-index
2395
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/rag-index-overview
2396
+ const getKnowledgeBaseRagIndexOverview = Object.assign(async (signal) => {
2397
+ return makeJsonRequest("GET", "/v1/convai/knowledge-base/rag-index", undefined, signal);
2398
+ }, { schema: undefined });
2399
+ // POST https://api.elevenlabs.io/v1/convai/knowledge-base/rag-index
2400
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/compute-rag-index-batch
2401
+ const computeKnowledgeBaseRagIndexes = Object.assign(async (req, signal) => {
2402
+ return makeJsonRequest("POST", "/v1/convai/knowledge-base/rag-index", req, signal);
2403
+ }, { schema: ElevenLabsComputeKnowledgeBaseRagIndexesRequestSchema });
2404
+ // GET https://api.elevenlabs.io/v1/convai/knowledge-base/{documentationId}/rag-index
2405
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/get-rag-index
2406
+ const getKnowledgeBaseDocumentRagIndexes = Object.assign(async (documentationId, signal) => {
2407
+ return makeJsonRequest("GET", `/v1/convai/knowledge-base/${encodeURIComponent(documentationId)}/rag-index`, undefined, signal);
2408
+ }, { schema: undefined });
2409
+ // POST https://api.elevenlabs.io/v1/convai/knowledge-base/{documentationId}/rag-index
2410
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/compute-rag-index
2411
+ const computeKnowledgeBaseDocumentRagIndex = Object.assign(async (documentationId, req, signal) => {
2412
+ return makeJsonRequest("POST", `/v1/convai/knowledge-base/${encodeURIComponent(documentationId)}/rag-index`, req, signal);
2413
+ }, { schema: ElevenLabsComputeKnowledgeBaseDocumentRagIndexRequestSchema });
2414
+ // DELETE https://api.elevenlabs.io/v1/convai/knowledge-base/{documentationId}/rag-index/{ragIndexId}
2415
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/delete-rag-index
2416
+ const deleteKnowledgeBaseDocumentRagIndex = Object.assign(async (documentationId, ragIndexId, signal) => {
2417
+ return makeJsonRequest("DELETE", `/v1/convai/knowledge-base/${encodeURIComponent(documentationId)}/rag-index/${encodeURIComponent(ragIndexId)}`, undefined, signal);
2418
+ }, { schema: undefined });
2419
+ // POST https://api.elevenlabs.io/v1/convai/knowledge-base/folder
2420
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/create-folder
2421
+ const createKnowledgeBaseFolder = Object.assign(async (req, signal) => {
2422
+ return makeJsonRequest("POST", "/v1/convai/knowledge-base/folder", req, signal);
2423
+ }, { schema: ElevenLabsCreateKnowledgeBaseFolderRequestSchema });
2424
+ // POST https://api.elevenlabs.io/v1/convai/knowledge-base/bulk-move
2425
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/bulk-move
2426
+ const bulkMoveKnowledgeBaseDocuments = Object.assign(async (req, signal) => {
2427
+ return makeJsonRequestAllowEmpty("POST", "/v1/convai/knowledge-base/bulk-move", req, signal);
2428
+ }, { schema: ElevenLabsBulkMoveKnowledgeBaseDocumentsRequestSchema });
2429
+ // POST https://api.elevenlabs.io/v1/convai/knowledge-base/{documentId}/move
2430
+ // Docs: https://elevenlabs.io/docs/api-reference/knowledge-base/move-document
2431
+ const moveKnowledgeBaseEntity = Object.assign(async (documentId, req = {}, signal) => {
2432
+ return makeJsonRequestAllowEmpty("POST", `/v1/convai/knowledge-base/${encodeURIComponent(documentId)}/move`, req, signal);
2433
+ }, { schema: ElevenLabsMoveKnowledgeBaseEntityRequestSchema });
2434
+ const convaiKnowledgeBaseChunks = Object.assign(listKnowledgeBaseDocumentChunks, {
2435
+ get: getKnowledgeBaseDocumentChunk,
2436
+ });
2437
+ const convaiKnowledgeBaseRagIndex = Object.assign(getKnowledgeBaseRagIndexOverview, {
2438
+ batch: computeKnowledgeBaseRagIndexes,
2439
+ get: getKnowledgeBaseDocumentRagIndexes,
2440
+ compute: computeKnowledgeBaseDocumentRagIndex,
2441
+ delete: deleteKnowledgeBaseDocumentRagIndex,
2442
+ });
2443
+ const convaiKnowledgeBase = {
2444
+ url: createKnowledgeBaseDocumentFromUrl,
2445
+ text: createKnowledgeBaseDocumentFromText,
2446
+ file: createKnowledgeBaseDocumentFromFile,
2447
+ folder: createKnowledgeBaseFolder,
2448
+ list: listKnowledgeBaseDocuments,
2449
+ get: getKnowledgeBaseDocument,
2450
+ update: updateKnowledgeBaseDocument,
2451
+ delete: deleteKnowledgeBaseDocument,
2452
+ summaries: getKnowledgeBaseSummaries,
2453
+ search: searchKnowledgeBaseContent,
2454
+ content: getKnowledgeBaseDocumentContent,
2455
+ chunks: convaiKnowledgeBaseChunks,
2456
+ dependentAgents: getKnowledgeBaseDependentAgents,
2457
+ sourceFileUrl: getKnowledgeBaseSourceFileUrl,
2458
+ refresh: refreshKnowledgeBaseDocument,
2459
+ updateFile: updateKnowledgeBaseFileDocument,
2460
+ ragIndex: convaiKnowledgeBaseRagIndex,
2461
+ bulkMove: bulkMoveKnowledgeBaseDocuments,
2462
+ move: moveKnowledgeBaseEntity,
2463
+ };
2464
+ const convaiConversationMessages = {
2465
+ smartSearch: smartSearchConversationMessages,
2466
+ textSearch: textSearchConversationMessages,
2467
+ };
2468
+ const convaiConversationFiles = Object.assign(uploadConversationFile, {
2469
+ delete: deleteConversationFile,
2470
+ });
2471
+ const convaiConversationTags = Object.assign(assignConversationTags, {
2472
+ unassign: unassignConversationTag,
2473
+ });
2474
+ const convaiConversationAnalysis = Object.assign(runConversationAnalysis, {
2475
+ evaluations: runConversationEvaluations,
2476
+ });
2477
+ const convaiConversations = {
2478
+ list: listConversations,
2479
+ get: getConversation,
2480
+ delete: deleteConversation,
2481
+ audio: getConversationAudio,
2482
+ messages: convaiConversationMessages,
2483
+ feedback: sendConversationFeedback,
2484
+ files: convaiConversationFiles,
2485
+ sipMessages: getConversationSipMessages,
2486
+ tags: convaiConversationTags,
2487
+ analysis: convaiConversationAnalysis,
2488
+ };
2489
+ const convaiConversation = {
2490
+ getSignedUrl,
2491
+ token: getConversationToken,
2492
+ };
2493
+ const convaiPhoneNumbers = {
2494
+ create: createPhoneNumber,
2495
+ list: listPhoneNumbers,
2496
+ get: getPhoneNumber,
2497
+ update: updatePhoneNumber,
2498
+ delete: deletePhoneNumber,
2499
+ sipMessages: getPhoneNumberSipMessages,
2500
+ };
2501
+ const convaiTwilio = {
2502
+ outboundCall: twilioOutboundCall,
2503
+ registerCall: registerTwilioCall,
2504
+ };
2505
+ const convaiSipTrunk = { outboundCall: sipTrunkOutboundCall };
2506
+ const convaiExotel = { outboundCall: exotelOutboundCall };
2507
+ const convaiWhatsApp = {
2508
+ outboundCall: whatsAppOutboundCall,
2509
+ outboundMessage: whatsAppOutboundMessage,
391
2510
  };
2511
+ const convaiWhatsAppAccounts = {
2512
+ list: listWhatsAppAccounts,
2513
+ get: getWhatsAppAccount,
2514
+ update: updateWhatsAppAccount,
2515
+ delete: deleteWhatsAppAccount,
2516
+ };
2517
+ const convai = {
2518
+ agents: convaiAgents,
2519
+ agent: {
2520
+ knowledgeBase: { size: getAgentKnowledgeBaseSize },
2521
+ llmUsage: { calculate: calculateAgentLlmUsage },
2522
+ },
2523
+ analytics: { liveCount: getLiveConversationCount },
2524
+ users: convaiUsers,
2525
+ llmUsage: convaiLlmUsage,
2526
+ llm: convaiLlm,
2527
+ agentTesting: convaiAgentTesting,
2528
+ testInvocations: convaiTestInvocations,
2529
+ tags: convaiTags,
2530
+ settings: convaiSettings,
2531
+ secrets: convaiSecrets,
2532
+ environmentVariables: convaiEnvironmentVariables,
2533
+ tools: convaiTools,
2534
+ mcpServers: convaiMcpServers,
2535
+ knowledgeBase: convaiKnowledgeBase,
2536
+ conversations: convaiConversations,
2537
+ conversation: convaiConversation,
2538
+ batchCalling: convaiBatchCalling,
2539
+ phoneNumbers: convaiPhoneNumbers,
2540
+ twilio: convaiTwilio,
2541
+ sipTrunk: convaiSipTrunk,
2542
+ exotel: convaiExotel,
2543
+ whatsapp: convaiWhatsApp,
2544
+ whatsappAccounts: convaiWhatsAppAccounts,
2545
+ };
2546
+ const user = Object.assign(getUser, {
2547
+ subscription: userSubscription,
2548
+ });
2549
+ const pvcSamplesSpeakers = Object.assign(getPvcSampleSpeakers, {
2550
+ audio: getSeparatedSpeakerAudio,
2551
+ });
392
2552
  const pvcVoiceSamples = Object.assign(updatePvcVoiceSample, {
2553
+ add: addPvcSamples,
2554
+ audio: getPvcSampleAudio,
393
2555
  delete: deletePvcVoiceSample,
394
2556
  separateSpeakers: startSpeakerSeparation,
395
2557
  speakers: pvcSamplesSpeakers,
396
2558
  waveform: getPvcVoiceSampleWaveform,
397
2559
  });
398
2560
  const postPvcVoiceSamples = Object.assign(updatePvcVoiceSample, {
2561
+ add: addPvcSamples,
399
2562
  separateSpeakers: startSpeakerSeparation,
400
2563
  });
401
2564
  const pvcVoiceCaptchaWithGet = Object.assign(pvcVoiceCaptcha, {
402
2565
  get: getPvcVoiceCaptcha,
403
2566
  });
404
2567
  const pvcVoices = Object.assign(createPvcVoice, {
2568
+ edit: editPvcVoice,
405
2569
  captcha: pvcVoiceCaptchaWithGet,
406
2570
  samples: pvcVoiceSamples,
407
2571
  train: pvcTrain,
408
2572
  verification: pvcManualVerification,
409
2573
  });
410
2574
  const postPvcVoices = Object.assign(createPvcVoice, {
2575
+ edit: editPvcVoice,
411
2576
  captcha: pvcVoiceCaptchaWithGet,
412
2577
  samples: postPvcVoiceSamples,
413
2578
  train: pvcTrain,
414
2579
  verification: pvcManualVerification,
415
2580
  });
2581
+ const pronunciationDictionaries = {
2582
+ list: listPronunciationDictionaries,
2583
+ addFromFile: addPronunciationDictionaryFromFile,
2584
+ addFromRules: addPronunciationDictionaryFromRules,
2585
+ get: getPronunciationDictionary,
2586
+ update: updatePronunciationDictionary,
2587
+ addRules: addPronunciationDictionaryRules,
2588
+ removeRules: removePronunciationDictionaryRules,
2589
+ setRules: setPronunciationDictionaryRules,
2590
+ download: downloadPronunciationDictionary,
2591
+ };
2592
+ const workspaceGroupMembers = {
2593
+ add: addWorkspaceGroupMember,
2594
+ remove: removeWorkspaceGroupMember,
2595
+ };
2596
+ const workspaceGroups = {
2597
+ list: listWorkspaceGroups,
2598
+ search: searchWorkspaceGroups,
2599
+ members: workspaceGroupMembers,
2600
+ };
2601
+ const workspaceMembers = {
2602
+ update: updateWorkspaceMember,
2603
+ };
2604
+ const workspaceInvites = {
2605
+ add: addWorkspaceInvite,
2606
+ addBulk: addWorkspaceInvitesBulk,
2607
+ delete: deleteWorkspaceInvite,
2608
+ };
2609
+ const workspaceResources = {
2610
+ get: getWorkspaceResource,
2611
+ share: shareWorkspaceResource,
2612
+ unshare: unshareWorkspaceResource,
2613
+ };
2614
+ const workspaceWebhooks = {
2615
+ list: listWorkspaceWebhooks,
2616
+ create: createWorkspaceWebhook,
2617
+ update: updateWorkspaceWebhook,
2618
+ delete: deleteWorkspaceWebhook,
2619
+ };
2620
+ const workspaceAuthConnections = {
2621
+ list: listWorkspaceAuthConnections,
2622
+ create: createWorkspaceAuthConnection,
2623
+ update: updateWorkspaceAuthConnection,
2624
+ delete: deleteWorkspaceAuthConnection,
2625
+ };
416
2626
  const workspace = {
2627
+ auditLogs: listWorkspaceAuditLogs,
2628
+ groups: workspaceGroups,
2629
+ members: workspaceMembers,
2630
+ invites: workspaceInvites,
2631
+ resources: workspaceResources,
2632
+ webhooks: workspaceWebhooks,
2633
+ authConnections: workspaceAuthConnections,
417
2634
  analytics: {
418
2635
  requests: workspaceAnalyticsRequests,
419
2636
  query: {
@@ -421,48 +2638,535 @@ export function createElevenLabs(opts) {
421
2638
  },
422
2639
  },
423
2640
  };
2641
+ const workspaces = {
2642
+ apiKeys: {
2643
+ disable: disableWorkspaceApiKey,
2644
+ thirdPartyDisabling: setWorkspaceApiKeyThirdPartyDisabling,
2645
+ },
2646
+ };
2647
+ const serviceAccountApiKeys = {
2648
+ list: listServiceAccountApiKeys,
2649
+ create: createServiceAccountApiKey,
2650
+ update: updateServiceAccountApiKey,
2651
+ delete: deleteServiceAccountApiKey,
2652
+ };
2653
+ const serviceAccounts = {
2654
+ list: listServiceAccounts,
2655
+ apiKeys: serviceAccountApiKeys,
2656
+ };
2657
+ const getWorkspace = {
2658
+ auditLogs: listWorkspaceAuditLogs,
2659
+ groups: {
2660
+ list: listWorkspaceGroups,
2661
+ search: searchWorkspaceGroups,
2662
+ },
2663
+ resources: {
2664
+ get: getWorkspaceResource,
2665
+ },
2666
+ webhooks: {
2667
+ list: listWorkspaceWebhooks,
2668
+ },
2669
+ authConnections: {
2670
+ list: listWorkspaceAuthConnections,
2671
+ },
2672
+ };
2673
+ const postWorkspace = {
2674
+ groups: {
2675
+ members: workspaceGroupMembers,
2676
+ },
2677
+ members: workspaceMembers,
2678
+ invites: {
2679
+ add: addWorkspaceInvite,
2680
+ addBulk: addWorkspaceInvitesBulk,
2681
+ },
2682
+ resources: {
2683
+ share: shareWorkspaceResource,
2684
+ unshare: unshareWorkspaceResource,
2685
+ },
2686
+ webhooks: {
2687
+ create: createWorkspaceWebhook,
2688
+ },
2689
+ authConnections: {
2690
+ create: createWorkspaceAuthConnection,
2691
+ },
2692
+ analytics: workspace.analytics,
2693
+ };
2694
+ const postServiceAccounts = {
2695
+ apiKeys: {
2696
+ create: createServiceAccountApiKey,
2697
+ },
2698
+ };
2699
+ const patchWorkspace = {
2700
+ webhooks: {
2701
+ update: updateWorkspaceWebhook,
2702
+ },
2703
+ authConnections: {
2704
+ update: updateWorkspaceAuthConnection,
2705
+ },
2706
+ };
2707
+ const patchServiceAccounts = {
2708
+ apiKeys: {
2709
+ update: updateServiceAccountApiKey,
2710
+ },
2711
+ };
2712
+ const deleteWorkspace = {
2713
+ invites: {
2714
+ delete: deleteWorkspaceInvite,
2715
+ },
2716
+ webhooks: {
2717
+ delete: deleteWorkspaceWebhook,
2718
+ },
2719
+ authConnections: {
2720
+ delete: deleteWorkspaceAuthConnection,
2721
+ },
2722
+ };
2723
+ const deleteServiceAccounts = {
2724
+ apiKeys: {
2725
+ delete: deleteServiceAccountApiKey,
2726
+ },
2727
+ };
2728
+ const v1VoicesAdd = Object.assign(addVoice, {
2729
+ schema: ElevenLabsAddVoiceRequestSchema,
2730
+ share: addSharedVoice,
2731
+ });
2732
+ const v1VoiceSettings = Object.assign(getVoiceSettings, {
2733
+ default: getDefaultVoiceSettings,
2734
+ edit: editVoiceSettings,
2735
+ });
2736
+ const v1VoiceSamples = {
2737
+ delete: deleteVoiceSample,
2738
+ audio: getVoiceSampleAudio,
2739
+ };
424
2740
  const v1Voices = Object.assign(getVoice, {
425
- settings: getVoiceSettings,
2741
+ list: listV1Voices,
2742
+ delete: deleteVoice,
2743
+ add: v1VoicesAdd,
2744
+ edit: editVoice,
2745
+ settings: v1VoiceSettings,
2746
+ samples: v1VoiceSamples,
426
2747
  pvc: pvcVoices,
427
2748
  });
428
2749
  const v2 = {
429
2750
  voices,
430
2751
  };
431
2752
  const postV1 = {
2753
+ pronunciationDictionaries: {
2754
+ addFromFile: addPronunciationDictionaryFromFile,
2755
+ addFromRules: addPronunciationDictionaryFromRules,
2756
+ addRules: addPronunciationDictionaryRules,
2757
+ removeRules: removePronunciationDictionaryRules,
2758
+ setRules: setPronunciationDictionaryRules,
2759
+ },
432
2760
  soundGeneration,
2761
+ audioIsolation,
2762
+ audioNative,
2763
+ forcedAlignment,
2764
+ music,
2765
+ speechEngine: {
2766
+ create: createSpeechEngine,
2767
+ },
2768
+ productions: {
2769
+ orders: {
2770
+ create: createOrder,
2771
+ submit: submitOrder,
2772
+ items: { upsert: upsertOrderItem },
2773
+ media: { register: registerOrderMedia },
2774
+ },
2775
+ },
433
2776
  textToSpeech,
434
2777
  textToDialogue,
2778
+ textToVoice,
2779
+ singleUseToken,
435
2780
  speechToText,
2781
+ speechToSpeech,
2782
+ similarVoices: getSimilarVoices,
436
2783
  voices: {
2784
+ add: v1VoicesAdd,
2785
+ edit: editVoice,
2786
+ settings: {
2787
+ edit: editVoiceSettings,
2788
+ },
437
2789
  pvc: postPvcVoices,
438
2790
  },
439
- workspace,
2791
+ workspace: postWorkspace,
2792
+ workspaces,
2793
+ serviceAccounts: postServiceAccounts,
2794
+ convai: {
2795
+ agents: {
2796
+ create: createAgent,
2797
+ duplicate: duplicateAgent,
2798
+ avatar: postAgentAvatar,
2799
+ simulateConversation,
2800
+ drafts: { create: createAgentDraft },
2801
+ deployments: createAgentDeployment,
2802
+ runTests: runAgentTests,
2803
+ branches: {
2804
+ create: createAgentBranch,
2805
+ rebase: rebaseAgentBranch,
2806
+ merge: mergeAgentBranch,
2807
+ },
2808
+ },
2809
+ agent: {
2810
+ llmUsage: { calculate: calculateAgentLlmUsage },
2811
+ },
2812
+ llmUsage: {
2813
+ calculate: calculateLlmUsage,
2814
+ },
2815
+ agentTesting: {
2816
+ create: createAgentTest,
2817
+ summaries: getAgentTestSummaries,
2818
+ bulkMove: bulkMoveAgentTests,
2819
+ folders: {
2820
+ create: createAgentTestFolder,
2821
+ },
2822
+ },
2823
+ testInvocations: {
2824
+ resubmit: resubmitTests,
2825
+ },
2826
+ tags: { create: createConversationTag },
2827
+ secrets: { create: createWorkspaceSecret },
2828
+ environmentVariables: { create: createEnvironmentVariable },
2829
+ tools: { create: createTool },
2830
+ mcpServers: {
2831
+ create: createMcpServer,
2832
+ toolApprovals: { create: createMcpServerToolApproval },
2833
+ toolConfigs: { create: createMcpToolConfigOverride },
2834
+ },
2835
+ batchCalling: {
2836
+ submit: submitBatchCall,
2837
+ cancel: cancelBatchCall,
2838
+ retry: retryBatchCall,
2839
+ },
2840
+ knowledgeBase: {
2841
+ url: createKnowledgeBaseDocumentFromUrl,
2842
+ text: createKnowledgeBaseDocumentFromText,
2843
+ file: createKnowledgeBaseDocumentFromFile,
2844
+ folder: createKnowledgeBaseFolder,
2845
+ refresh: refreshKnowledgeBaseDocument,
2846
+ ragIndex: {
2847
+ batch: computeKnowledgeBaseRagIndexes,
2848
+ compute: computeKnowledgeBaseDocumentRagIndex,
2849
+ },
2850
+ bulkMove: bulkMoveKnowledgeBaseDocuments,
2851
+ move: moveKnowledgeBaseEntity,
2852
+ },
2853
+ conversations: {
2854
+ feedback: sendConversationFeedback,
2855
+ files: uploadConversationFile,
2856
+ tags: assignConversationTags,
2857
+ analysis: convaiConversationAnalysis,
2858
+ },
2859
+ phoneNumbers: { create: createPhoneNumber },
2860
+ twilio: convaiTwilio,
2861
+ sipTrunk: convaiSipTrunk,
2862
+ exotel: convaiExotel,
2863
+ whatsapp: convaiWhatsApp,
2864
+ },
2865
+ history: {
2866
+ download: downloadHistory,
2867
+ },
2868
+ };
2869
+ const patchV1 = {
2870
+ pronunciationDictionaries: {
2871
+ update: updatePronunciationDictionary,
2872
+ },
2873
+ speechEngine: {
2874
+ update: updateSpeechEngine,
2875
+ },
2876
+ productions: {
2877
+ orders: { update: updateOrder },
2878
+ },
2879
+ convai: {
2880
+ agents: {
2881
+ update: updateAgent,
2882
+ branches: { update: updateAgentBranch },
2883
+ },
2884
+ agentTesting: {
2885
+ folders: { update: updateAgentTestFolder },
2886
+ },
2887
+ tags: { update: updateConversationTag },
2888
+ settings: {
2889
+ update: updateConvaiSettings,
2890
+ dashboard: { update: updateConvaiDashboardSettings },
2891
+ },
2892
+ secrets: { update: updateWorkspaceSecret },
2893
+ environmentVariables: { update: updateEnvironmentVariable },
2894
+ tools: { update: updateTool },
2895
+ mcpServers: {
2896
+ update: updateMcpServer,
2897
+ toolConfigs: { update: updateMcpToolConfigOverride },
2898
+ },
2899
+ knowledgeBase: {
2900
+ update: updateKnowledgeBaseDocument,
2901
+ updateFile: updateKnowledgeBaseFileDocument,
2902
+ },
2903
+ phoneNumbers: { update: updatePhoneNumber },
2904
+ whatsappAccounts: { update: updateWhatsAppAccount },
2905
+ },
2906
+ workspace: patchWorkspace,
2907
+ serviceAccounts: patchServiceAccounts,
2908
+ };
2909
+ const putV1 = {
2910
+ convai: {
2911
+ agentTesting: {
2912
+ update: updateAgentTest,
2913
+ },
2914
+ },
440
2915
  };
441
2916
  const deleteV1 = {
2917
+ audioIsolation: {
2918
+ history: {
2919
+ delete: deleteAudioIsolationHistoryItem,
2920
+ },
2921
+ },
2922
+ speechEngine: {
2923
+ delete: deleteSpeechEngine,
2924
+ },
2925
+ productions: {
2926
+ orders: {
2927
+ items: { remove: removeOrderItem },
2928
+ },
2929
+ },
442
2930
  voices: {
2931
+ delete: deleteVoice,
2932
+ samples: {
2933
+ delete: deleteVoiceSample,
2934
+ },
443
2935
  pvc: {
444
2936
  samples: {
445
2937
  delete: deletePvcVoiceSample,
446
2938
  },
447
2939
  },
448
2940
  },
2941
+ convai: {
2942
+ agents: {
2943
+ delete: deleteAgent,
2944
+ drafts: { delete: deleteAgentDraft },
2945
+ },
2946
+ agentTesting: {
2947
+ delete: deleteAgentTest,
2948
+ folders: { delete: deleteAgentTestFolder },
2949
+ },
2950
+ tags: { delete: deleteConversationTag },
2951
+ secrets: { delete: deleteWorkspaceSecret },
2952
+ tools: { delete: deleteTool },
2953
+ mcpServers: {
2954
+ delete: deleteMcpServer,
2955
+ toolApprovals: { delete: deleteMcpServerToolApproval },
2956
+ toolConfigs: { delete: deleteMcpToolConfigOverride },
2957
+ },
2958
+ batchCalling: { delete: deleteBatchCall },
2959
+ knowledgeBase: {
2960
+ delete: deleteKnowledgeBaseDocument,
2961
+ ragIndex: { delete: deleteKnowledgeBaseDocumentRagIndex },
2962
+ },
2963
+ conversations: {
2964
+ delete: deleteConversation,
2965
+ files: { delete: deleteConversationFile },
2966
+ tags: { unassign: unassignConversationTag },
2967
+ },
2968
+ phoneNumbers: { delete: deletePhoneNumber },
2969
+ whatsappAccounts: { delete: deleteWhatsAppAccount },
2970
+ },
2971
+ workspace: deleteWorkspace,
2972
+ serviceAccounts: deleteServiceAccounts,
2973
+ history: {
2974
+ delete: deleteHistoryItem,
2975
+ },
449
2976
  };
450
2977
  const v1 = {
2978
+ pronunciationDictionaries,
451
2979
  models,
452
2980
  voices: v1Voices,
2981
+ sharedVoices: getSharedVoices,
2982
+ similarVoices: getSimilarVoices,
453
2983
  soundGeneration,
2984
+ audioIsolation,
2985
+ audioNative,
2986
+ forcedAlignment,
2987
+ music,
2988
+ speechEngine,
2989
+ productions,
454
2990
  textToSpeech,
455
2991
  textToDialogue,
2992
+ textToVoice,
2993
+ singleUseToken,
456
2994
  speechToText,
2995
+ speechToSpeech,
2996
+ dubbing,
2997
+ studio,
457
2998
  user,
458
2999
  workspace,
3000
+ workspaces,
3001
+ serviceAccounts,
3002
+ convai,
3003
+ history: {
3004
+ list: listHistory,
3005
+ get: getHistoryItem,
3006
+ delete: deleteHistoryItem,
3007
+ audio: getHistoryItemAudio,
3008
+ download: downloadHistory,
3009
+ },
459
3010
  };
460
3011
  return attachExamples({
461
3012
  docs,
462
3013
  v1,
463
3014
  v2,
464
- get: { docs, v1: { models, voices: v1Voices, user }, v2 },
3015
+ get: {
3016
+ docs,
3017
+ v1: {
3018
+ pronunciationDictionaries: {
3019
+ list: listPronunciationDictionaries,
3020
+ get: getPronunciationDictionary,
3021
+ download: downloadPronunciationDictionary,
3022
+ },
3023
+ models,
3024
+ voices: v1Voices,
3025
+ sharedVoices: getSharedVoices,
3026
+ user,
3027
+ audioIsolation: {
3028
+ history: {
3029
+ list: listAudioIsolationHistory,
3030
+ },
3031
+ },
3032
+ audioNative: {
3033
+ settings: getAudioNativeProjectSettings,
3034
+ },
3035
+ speechEngine: {
3036
+ list: listSpeechEngines,
3037
+ get: getSpeechEngine,
3038
+ },
3039
+ productions: {
3040
+ orders: {
3041
+ list: listOrders,
3042
+ get: getOrder,
3043
+ deliverables: getOrderDeliverables,
3044
+ languages: getOrderLanguages,
3045
+ media: { get: getOrderMedia },
3046
+ },
3047
+ },
3048
+ textToVoice: {
3049
+ stream: textToVoiceStream,
3050
+ },
3051
+ convai: {
3052
+ agents: {
3053
+ list: listAgents,
3054
+ get: getAgent,
3055
+ widget: getAgentWidget,
3056
+ link: getAgentLink,
3057
+ summaries: getAgentSummaries,
3058
+ versions: { get: getAgentVersion },
3059
+ topics: getAgentTopics,
3060
+ branches: convaiAgentBranches,
3061
+ },
3062
+ agent: {
3063
+ knowledgeBase: { size: getAgentKnowledgeBaseSize },
3064
+ },
3065
+ analytics: {
3066
+ liveCount: getLiveConversationCount,
3067
+ },
3068
+ users: {
3069
+ list: listConversationUsers,
3070
+ },
3071
+ llm: {
3072
+ list: listLlms,
3073
+ },
3074
+ agentTesting: {
3075
+ list: listAgentTests,
3076
+ get: getAgentTest,
3077
+ folders: {
3078
+ get: getAgentTestFolder,
3079
+ },
3080
+ },
3081
+ testInvocations: {
3082
+ list: listTestInvocations,
3083
+ get: getTestInvocation,
3084
+ },
3085
+ tags: {
3086
+ list: listConversationTags,
3087
+ get: getConversationTag,
3088
+ },
3089
+ settings: convaiSettings,
3090
+ secrets: {
3091
+ list: listWorkspaceSecrets,
3092
+ get: getWorkspaceSecret,
3093
+ dependencies: getSecretDependencies,
3094
+ },
3095
+ environmentVariables: {
3096
+ list: listEnvironmentVariables,
3097
+ get: getEnvironmentVariable,
3098
+ },
3099
+ tools: {
3100
+ list: listTools,
3101
+ get: getTool,
3102
+ dependentAgents: getToolDependentAgents,
3103
+ executions: getToolExecutions,
3104
+ },
3105
+ mcpServers: {
3106
+ list: listMcpServers,
3107
+ get: getMcpServer,
3108
+ tools: listMcpServerTools,
3109
+ toolConfigs: {
3110
+ get: getMcpToolConfigOverride,
3111
+ },
3112
+ },
3113
+ batchCalling: {
3114
+ workspace: listWorkspaceBatchCalls,
3115
+ get: getBatchCall,
3116
+ },
3117
+ knowledgeBase: {
3118
+ list: listKnowledgeBaseDocuments,
3119
+ get: getKnowledgeBaseDocument,
3120
+ summaries: getKnowledgeBaseSummaries,
3121
+ search: searchKnowledgeBaseContent,
3122
+ content: getKnowledgeBaseDocumentContent,
3123
+ chunks: convaiKnowledgeBaseChunks,
3124
+ dependentAgents: getKnowledgeBaseDependentAgents,
3125
+ sourceFileUrl: getKnowledgeBaseSourceFileUrl,
3126
+ ragIndex: {
3127
+ overview: getKnowledgeBaseRagIndexOverview,
3128
+ get: getKnowledgeBaseDocumentRagIndexes,
3129
+ },
3130
+ },
3131
+ conversations: {
3132
+ list: listConversations,
3133
+ get: getConversation,
3134
+ audio: getConversationAudio,
3135
+ messages: convaiConversationMessages,
3136
+ sipMessages: getConversationSipMessages,
3137
+ },
3138
+ conversation: {
3139
+ getSignedUrl,
3140
+ token: getConversationToken,
3141
+ },
3142
+ phoneNumbers: {
3143
+ list: listPhoneNumbers,
3144
+ get: getPhoneNumber,
3145
+ sipMessages: getPhoneNumberSipMessages,
3146
+ },
3147
+ whatsappAccounts: {
3148
+ list: listWhatsAppAccounts,
3149
+ get: getWhatsAppAccount,
3150
+ },
3151
+ },
3152
+ workspace: getWorkspace,
3153
+ serviceAccounts: {
3154
+ list: listServiceAccounts,
3155
+ apiKeys: {
3156
+ list: listServiceAccountApiKeys,
3157
+ },
3158
+ },
3159
+ history: {
3160
+ list: listHistory,
3161
+ get: getHistoryItem,
3162
+ audio: getHistoryItemAudio,
3163
+ },
3164
+ },
3165
+ v2,
3166
+ },
465
3167
  post: { v1: postV1 },
3168
+ patch: { v1: patchV1 },
3169
+ put: { v1: putV1 },
466
3170
  delete: { v1: deleteV1 },
467
3171
  });
468
3172
  }