Adds a music on hold (MoH) file to the domain, from an uploaded file, a base64 file, or text to speech. It takes the next free index unless you send index; an index that is already used is overwritten.Requires Office Manager, Call Center Supervisor, Reseller, or Super User. Site Manager can read domain MoH but gets 403 on a change, and so do Basic User and the read-only scopes.The file is written on the server that handles the request, before the response, and copied to the other servers over the service bus (SBUS) file journal. The call answers 202 by default. Send synchronous=yes to get 200 with the stored file instead; the call then waits up to 2 seconds for it to appear. Every upload is converted to 8 kHz, 8-bit, mono mu-law WAV. Audio that cannot be converted returns 400 and nothing is stored.Upload a file. Send multipart/form-data with the audio in the file part (File also works). The part's Content-Type picks the decoder: audio/mpeg or audio/mp3 is decoded as MP3, audio/ogg, audio/webm, video/ogg, video/webm and application/ogg as Ogg or WebM, and anything else is read as WAV. The request can be up to 64 MB.Base64 file. Send JSON with the audio as base64 in file-base64, with no line breaks, and its format in file-encoding: audio/wav (the default), audio/mpeg, audio/ogg, or audio/webm. Base64 that does not decode, or another encoding, returns 400.Text to speech. Send JSON with the words to speak in file-script-text and no file. The voice defaults to the domain's text-to-speech voice (en-US-Wavenet-C in en-US when none is set); name another with text-to-speech-voice-id and text-to-speech-language. A voice id that the language does not offer falls back to the language's first voice. Text to speech must be enabled for the user (PORTAL_VOICE_TEXT_TO_SPEECH), or the call returns 400. List voices with GET /domains/{domain}/users/{user}/voices/{language}.With a file, file-script-text is stored as a description of the audio.A user that does not exist returns 404, and an owner at its storage limit returns 507. Change a file with PUT on /domains/{domain}/moh/{index}, and change the order with PUT on /domains/{domain}/moh/reorder.
Request
Authorization
Bearer Token
Provide your bearer token in the
Authorization
header when making requests to protected resources.