{"id":6601,"date":"2026-11-29T11:00:12","date_gmt":"2026-11-29T08:00:12","guid":{"rendered":"https:\/\/mubert.com\/blog\/text-to-music-api-mubert-v3-webhook-polling"},"modified":"2026-11-29T11:01:12","modified_gmt":"2026-11-29T08:01:12","slug":"text-to-music-api-mubert-v3-webhook-polling","status":"publish","type":"post","link":"https:\/\/mubert.com\/blog\/text-to-music-api-mubert-v3-webhook-polling","title":{"rendered":"Text to Music API: One POST, a 15-Minute Download Link, and the Webhook That Saves You From Polling","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A text to music API turns a sentence into an audio file. With Mubert API v3, one POST with a text prompt of up to 255 characters and a duration of at least 5 seconds becomes a music track, which you collect by polling or through a webhook. This post is for developers and product teams putting generated music into an app, a game or a video tool. It covers the request, the wait, the formats and the licence. Plus the gotchas, because there are some.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The first surprise is the receipt. Your POST returns a track whose download URL is still empty. Generation is asynchronous. Everything below turns that receipt into an MP3 before the link expires.<\/p>\n\n\n\n<figure class=\"post-illustration\"><img decoding=\"async\" width=\"1024\" height=\"1024\" class=\"wp-image-6604 art-light\" src=\"https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-light-121-1024x1024.webp\" alt=\"Text to Music API: Prompt to Track With Mubert v3\" loading=\"lazy\" srcset=\"https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-light-121-1024x1024.webp 1024w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-light-121-300x300.webp 300w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-light-121-150x150.webp 150w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-light-121-768x768.webp 768w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-light-121-1536x1536.webp 1536w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-light-121-640x640.webp 640w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-light-121-1200x1200.webp 1200w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-light-121-60x60.webp 60w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-light-121-24x24.webp 24w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-light-121-48x48.webp 48w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-light-121-96x96.webp 96w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-light-121.webp 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><img decoding=\"async\" width=\"1024\" height=\"1024\" class=\"wp-image-6605 art-dark\" src=\"https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-dark-121-1024x1024.webp\" alt=\"Text to Music API: Prompt to Track With Mubert v3\" loading=\"lazy\" srcset=\"https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-dark-121-1024x1024.webp 1024w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-dark-121-300x300.webp 300w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-dark-121-150x150.webp 150w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-dark-121-768x768.webp 768w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-dark-121-1536x1536.webp 1536w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-dark-121-640x640.webp 640w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-dark-121-1200x1200.webp 1200w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-dark-121-60x60.webp 60w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-dark-121-24x24.webp 24w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-dark-121-48x48.webp 48w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-dark-121-96x96.webp 96w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-1-dark-121.webp 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Every text to music API call needs two kinds of credentials<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Every call to this text to music API needs a <code>customer-id<\/code> and an <code>access-token<\/code> header. You get both by creating a customer with your company&#8217;s <code>company-id<\/code> and <code>license-token<\/code>, as the <a href=\"https:\/\/music-api.mubert.com\/swagger-doc\/llms-full.txt\" target=\"_blank\">v3 reference<\/a> describes. All four go in headers. Never put them in the query string, because URLs end up in logs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So there are two layers. The service layer is your company and your licence. The public layer is one customer, usually one user of your product. You create it like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span class=\"tok-cmd\">curl<\/span> <span class=\"tok-flag\">-X<\/span> POST <span class=\"tok-str\">https:\/\/music-api.mubert.com\/api\/v3\/service\/customers<\/span> <span class=\"tok-dim\">\\<\/span>\n  <span class=\"tok-flag\">-H<\/span> <span class=\"tok-str\">\"company-id: $MUBERT_COMPANY_ID\"<\/span> <span class=\"tok-dim\">\\<\/span>\n  <span class=\"tok-flag\">-H<\/span> <span class=\"tok-str\">\"license-token: $MUBERT_LICENSE_TOKEN\"<\/span> <span class=\"tok-dim\">\\<\/span>\n  <span class=\"tok-flag\">-d<\/span> <span class=\"tok-dim\">'<\/span><span class=\"tok-dim\">{<\/span><span class=\"tok-str\">\"custom_id\"<\/span>: <span class=\"tok-str\">\"user12345\"<\/span><span class=\"tok-dim\">}<\/span><span class=\"tok-dim\">'<\/span> <span class=\"tok-flag\">-H<\/span> <span class=\"tok-str\">\"Content-Type: application\/json\"<\/span><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>custom_id<\/code> must be unique and alphanumeric, up to 255 characters. The response holds the <code>customer_id<\/code> and <code>access_token<\/code> for every generation call. Keep the licence token on your server. It is the master key, and a mobile app bundle is a fine place to lose it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Keep IDs stable, too. The <a href=\"https:\/\/mcp.mubert.com\" target=\"_blank\">MCP connection page<\/a> warns that every new customer consumes a seat. Create one on every app launch and you get a very large customer list, then a very awkward call with whoever pays the bill.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The request is one POST with a prompt and a duration<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You generate with <code>POST \/api\/v3\/public\/tracks<\/code>, and <code>duration<\/code> is the only required field. Most apps add a text prompt to tell the API what music to make, though an <code>image<\/code> or a <code>playlist_index<\/code> also works. The <a href=\"https:\/\/music-api.mubert.com\/swagger-doc\/openapi-prod.json\" target=\"_blank\">OpenAPI spec<\/a> lists the fields:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>prompt<\/code>: text, up to 255 characters<\/li>\n\n\n<li><code>duration<\/code>: seconds, minimum 5<\/li>\n\n\n<li><code>mode<\/code>: track, jingle, loop or mix<\/li>\n\n\n<li><code>format<\/code>: mp3 or wav<\/li>\n\n\n<li><code>bitrate<\/code>: 32, 96, 128, 192, 256 or 320<\/li>\n\n\n<li><code>intensity<\/code>: low, medium or high<\/li>\n\n\n<li><code>playlist_index<\/code> or <code>image<\/code> instead of a prompt<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Then a full call looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span class=\"tok-cmd\">curl<\/span> <span class=\"tok-flag\">-X<\/span> POST <span class=\"tok-str\">https:\/\/music-api.mubert.com\/api\/v3\/public\/tracks<\/span> <span class=\"tok-dim\">\\<\/span>\n  <span class=\"tok-flag\">-H<\/span> <span class=\"tok-str\">\"customer-id: $CUSTOMER_ID\"<\/span> <span class=\"tok-dim\">\\<\/span>\n  <span class=\"tok-flag\">-H<\/span> <span class=\"tok-str\">\"access-token: $ACCESS_TOKEN\"<\/span> <span class=\"tok-dim\">\\<\/span>\n  <span class=\"tok-flag\">-d<\/span> <span class=\"tok-dim\">'<\/span><span class=\"tok-dim\">{<\/span>\n    <span class=\"tok-str\">\"prompt\"<\/span>: <span class=\"tok-str\">\"warm lo-fi hip hop with soft piano for a study timer\"<\/span>,\n    <span class=\"tok-str\">\"duration\"<\/span>: <span class=\"tok-num\">60<\/span>,\n    <span class=\"tok-str\">\"mode\"<\/span>: <span class=\"tok-str\">\"track\"<\/span>,\n    <span class=\"tok-str\">\"format\"<\/span>: <span class=\"tok-str\">\"mp3\"<\/span>,\n    <span class=\"tok-str\">\"bitrate\"<\/span>: <span class=\"tok-num\">320<\/span>,\n    <span class=\"tok-str\">\"intensity\"<\/span>: <span class=\"tok-str\">\"medium\"<\/span>\n  <span class=\"tok-dim\">}<\/span><span class=\"tok-dim\">'<\/span> <span class=\"tok-flag\">-H<\/span> <span class=\"tok-str\">\"Content-Type: application\/json\"<\/span><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">One rule catches nearly everyone. <code>prompt<\/code> cannot be combined with <code>bpm<\/code> or <code>key<\/code>, and <code>bpm<\/code> only works with <code>playlist_index<\/code>. If your product needs an exact tempo (a running app at 160 steps a minute, say), generate from a playlist and pass <code>bpm<\/code> there. The text field is for describing the music. What a model does with adjectives is its own topic, and we covered it in <a href=\"https:\/\/mubert.com\/blog\/text-to-music-prompt-what-it-controls\">which words in a music prompt actually change the track<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The spec allows a <code>bpm<\/code> of up to 500. We have not yet seen a 500 BPM meditation app, and we are not sure the world is ready for one. Anyway.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Polling every 5 seconds is the simplest text to music API loop<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The simplest way to get the file is to call <code>GET \/api\/v3\/public\/tracks\/{id}<\/code> about every 5 seconds and stop after a few minutes. That is the advice in the <a href=\"https:\/\/github.com\/MubertAI\/skills\/blob\/main\/mubert-generate\/SKILL.md\" target=\"_blank\" rel=\"nofollow noopener\">generate skill<\/a>. Each track carries a <code>generations<\/code> array. Every generation has a <code>status<\/code> of <code>processing<\/code>, <code>done<\/code> or <code>failed<\/code>, plus a <code>url<\/code> that stays null until it is ready. Asynchronous is normal for any text to music API, because rendering audio takes longer than a web request should.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A trimmed response, showing only the fields from the spec:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span class=\"tok-dim\">{<\/span>\n  <span class=\"tok-str\">\"data\"<\/span>: <span class=\"tok-dim\">{<\/span>\n    <span class=\"tok-str\">\"id\"<\/span>: <span class=\"tok-str\">\"\u2026\"<\/span>,\n    <span class=\"tok-str\">\"generations\"<\/span>: <span class=\"tok-dim\">[<\/span>\n      <span class=\"tok-dim\">{<\/span>\n        <span class=\"tok-str\">\"session_id\"<\/span>: <span class=\"tok-str\">\"\u2026\"<\/span>,\n        <span class=\"tok-str\">\"format\"<\/span>: <span class=\"tok-str\">\"mp3\"<\/span>,\n        <span class=\"tok-str\">\"bitrate\"<\/span>: <span class=\"tok-num\">320<\/span>,\n        <span class=\"tok-str\">\"status\"<\/span>: <span class=\"tok-str\">\"done\"<\/span>,\n        <span class=\"tok-str\">\"url\"<\/span>: <span class=\"tok-str\">\"https:\/\/\u2026\"<\/span>,\n        <span class=\"tok-str\">\"expired_at\"<\/span>: <span class=\"tok-str\">\"\u2026\"<\/span>\n      <span class=\"tok-dim\">}<\/span>\n    <span class=\"tok-dim\">]<\/span>\n  <span class=\"tok-dim\">}<\/span>\n<span class=\"tok-dim\">}<\/span><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And the loop, in the plainest JavaScript we could write:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>async function waitForTrack(id, headers, timeoutMs = <span class=\"tok-num\">180000<\/span>) <span class=\"tok-dim\">{<\/span>\n  const start = Date.now();\n  while (Date.now() - start &lt; timeoutMs) <span class=\"tok-dim\">{<\/span>\n    const res = await fetch(`<span class=\"tok-str\">https:\/\/music-api.mubert.com\/api\/v3\/public\/tracks\/${id}`,<\/span> <span class=\"tok-dim\">{<\/span> headers <span class=\"tok-dim\">}<\/span>);\n    const gen = (await res.json()).data.generations<span class=\"tok-dim\">[<\/span><span class=\"tok-num\">0<\/span><span class=\"tok-dim\">]<\/span>;\n    if (gen.status === <span class=\"tok-str\">\"done\"<\/span>) return gen;\n    if (gen.status === <span class=\"tok-str\">\"failed\"<\/span>) throw new Error(<span class=\"tok-str\">\"generation failed\"<\/span>);\n    await new Promise(r =&gt; setTimeout(r, <span class=\"tok-num\">5000<\/span>));\n  <span class=\"tok-dim\">}<\/span>\n  throw new Error(<span class=\"tok-str\">\"timed out\"<\/span>);\n<span class=\"tok-dim\">}<\/span><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Confession: our first prototype polled every 200 milliseconds, because waiting felt rude. It wasn&#8217;t rude. It just made the logs longer while the track took exactly as long as it was always going to take. Five seconds is plenty.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There is also a lookup by session: <code>GET \/api\/v3\/public\/tracks\/session\/{session_id}<\/code>. Still, don&#8217;t mix the two up. Pass a <code>session_id<\/code> to the UUID route and the skill says you get a 404, plus an hour of debugging.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A webhook replaces the polling loop, mostly<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you would rather be told than keep asking, set <code>webhook_url<\/code> (up to 255 characters) and <code>webhook_enabled<\/code> on <code>PUT \/api\/v3\/service\/licenses\/{license}<\/code>. Then, per the v3 reference, webhooks &#8220;receive track models when generation completes&#8221;. Three trade-offs come with it. Know them before you delete your polling code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, the webhook belongs to the licence, not to a single request. Every customer&#8217;s finished tracks land on the same URL. So your handler has to match the track id to the user who asked, and you store that mapping when you send the POST.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Second, the spec says the payload is a track model but publishes no separate schema for it. So parse it defensively. Then fetch the track by id before you trust the <code>url<\/code>, which costs one request and saves a guess.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Third, webhooks get missed. Servers restart, deploys land at the worst moment, and firewalls have opinions. Keep the polling function as a fallback for any track still sitting in <code>processing<\/code> after a few minutes, because a missed webhook otherwise looks exactly like a slow render. Most teams running a text to music API in production end up with both, and that is fine.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Stored durations come back instantly, fresh renders take the wait<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Not every request to a text to music API needs a fresh render. The MCP connection guide recommends rounding durations to stocked values (5, 6, 8, 10, 15, 20, 30, 40, 60, 180, 240 and 300 seconds) &#8220;so a track can come back instantly&#8221;. It also prefers a <code>playlist_index<\/code> over a text prompt when speed matters.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The REST API has two neighbours of the main endpoint for this. <code>POST \/api\/v3\/public\/tracks\/stored<\/code> returns a cached track matching the requested parameters. <code>POST \/api\/v3\/public\/tracks\/record<\/code> skips the track-store cache and records a new one. The trade-off is plain. Stored answers fast but only matches stocked parameters, while a fresh render follows your exact prompt and duration and makes you wait.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Product-wise, the split is easy, since users want two different things. A user scrolling preview moods needs something now, so serve stocked durations. A user who typed a description of their video and set it to 47 seconds wants their own track. Render it and show a progress state.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Duration is the field people actually touch. In Mubert&#8217;s own data, last 28 days, 28.2% of tracks made with Render, our generator for creators, were re-cut to another duration afterwards. If your UI lets users change the length, expect more than one in four to use it.<\/p>\n\n\n\n<figure class=\"post-illustration\"><img decoding=\"async\" width=\"1024\" height=\"1024\" class=\"wp-image-6606 art-light\" src=\"https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-light-120-1024x1024.webp\" alt=\"Download link drawn as a melting ice cube on a desk, a kitchen timer next to it set to 15 minutes, and a hand rushing to grab it with a USB stick\" loading=\"lazy\" srcset=\"https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-light-120-1024x1024.webp 1024w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-light-120-300x300.webp 300w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-light-120-150x150.webp 150w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-light-120-768x768.webp 768w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-light-120-1536x1536.webp 1536w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-light-120-640x640.webp 640w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-light-120-1200x1200.webp 1200w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-light-120-60x60.webp 60w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-light-120-24x24.webp 24w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-light-120-48x48.webp 48w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-light-120-96x96.webp 96w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-light-120.webp 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><img decoding=\"async\" width=\"1024\" height=\"1024\" class=\"wp-image-6607 art-dark\" src=\"https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-dark-120-1024x1024.webp\" alt=\"Download link drawn as a melting ice cube on a desk, a kitchen timer next to it set to 15 minutes, and a hand rushing to grab it with a USB stick\" loading=\"lazy\" srcset=\"https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-dark-120-1024x1024.webp 1024w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-dark-120-300x300.webp 300w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-dark-120-150x150.webp 150w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-dark-120-768x768.webp 768w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-dark-120-1536x1536.webp 1536w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-dark-120-640x640.webp 640w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-dark-120-1200x1200.webp 1200w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-dark-120-60x60.webp 60w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-dark-120-24x24.webp 24w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-dark-120-48x48.webp 48w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-dark-120-96x96.webp 96w, https:\/\/mubert.com\/blog\/wp-content\/uploads\/2026\/11\/illustration-2-dark-120.webp 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Text to music API formats: modes, MP3 or WAV, and a 15-minute link<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The POST supports four generation modes (<code>track<\/code>, <code>jingle<\/code>, <code>loop<\/code> and <code>mix<\/code>), and the file comes as MP3 at 32 to 320 kbps or as WAV. The company&#8217;s <a href=\"https:\/\/mubert.com\/llms.txt\" target=\"_blank\">product summary<\/a> counts five formats, because the neverending stream lives on its own endpoints.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Only <code>track<\/code> returns exactly the duration you asked the text to music API for. Loops and jingles come back slightly short, says the generate skill. So if your game engine expects a loop of exactly 30.000 seconds, read the real length from the file. Do that instead of trusting the number you sent. One more quiet behaviour: with <code>wav<\/code>, the API drops your <code>bitrate<\/code> and reports 1411, which is simply what uncompressed CD-quality audio is.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Your licence&#8217;s <code>max_track_duration<\/code> sets the ceiling. The skill&#8217;s example licence allows 1800 seconds, and anything longer comes back as a 403 <code>LicenseForbiddenDuration<\/code>. Check yours with <code>GET \/service\/licenses<\/code> before you build a slider that goes to an hour.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then there is the clock. Download links expire at <code>generations[].expired_at<\/code>. On the common licence that window is <code>track_expiration_time<\/code>, 900 seconds, or 15 minutes. So when the status flips to <code>done<\/code>, copy the file to wherever your app serves audio from, within your licence terms. A URL saved in a database for tomorrow is a URL that returns nothing tomorrow.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The licence covers commercial use, with exceptions you should read<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Tracks generated through the API are royalty-free and cleared for commercial use, says the <a href=\"https:\/\/github.com\/MubertAI\/skills\" target=\"_blank\" rel=\"nofollow noopener\">skills repository<\/a>, and the exact scope depends on the plan. Read it, because a text to music API is only as useful as the licence behind the file. Generated music is owned by Mubert Inc. The product summary lists what is not covered unless a plan explicitly allows it: artist releases on Spotify or Apple Music, Content ID monetization, and stock music marketplaces.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That matters most if your product hands the file to end users. A video editor exporting a clip with a generated soundtrack is one thing. A &#8220;make a song and distribute it&#8221; button is another, and it probably needs a conversation about the licence before it needs a frontend. (Lawyers love a button.)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The supply chain matters too. The tracks come from more than 3 million samples by over 10,000 producers, and the musicians who upload them get paid. Each track is composed for your request rather than picked off a shelf, so a thousand other apps are not playing it. If you are comparing this with per-track licensing, we did the maths in <a href=\"https:\/\/mubert.com\/blog\/stock-music-licence-cost-per-track\">what a stock music licence actually buys<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Plans and their limits live on the <a href=\"https:\/\/mubert.com\/api\/plans\" target=\"_blank\">API plans page<\/a>. Check the live pricing there, because we won&#8217;t quote it here.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Error codes tell you which part of the request was wrong<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Error codes from this text to music API are short and honest. Auth problems return 401, which covers a missing or invalid <code>customer-id<\/code> or <code>access-token<\/code>, or a deleted customer. When the licence refuses something, you get a 403. A 404 means an unknown track id, or a session id on the wrong route. Validation errors return 422 with a <code>message<\/code> and an <code>errors<\/code> object keyed by field. Send those to your logs, not to your users.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The odd one, though, is 413. The spec accepts images from 50 KB up to 10 MB, but the generate skill says images above about 1 MiB hit an nginx limit. That limit returns an HTML page instead of JSON. Your <code>resp.json()<\/code> then throws, and the stack trace points at your parser instead of the image. Resize images under a megabyte before upload, and check the content type before you parse.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The v3 reference documents no rate limits. Sensible polling and a webhook keep you from finding them by accident.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A checklist for your first text to music API integration<\/h2>\n\n\n\n<ol class=\"wp-block-list post-steps\">\n<li>Create one customer per end user with a stable <code>custom_id<\/code>, and keep the licence token on the server.<\/li>\n\n\n<li>Send <code>duration<\/code> plus one source (<code>prompt<\/code>, <code>image<\/code> or <code>playlist_index<\/code>), never <code>prompt<\/code> together with <code>bpm<\/code>.<\/li>\n\n\n<li>Poll the track by id every 5 seconds with a timeout of a few minutes.<\/li>\n\n\n<li>Set <code>webhook_url<\/code> and <code>webhook_enabled<\/code> on the licence, and keep polling as the fallback.<\/li>\n\n\n<li>Round preview durations to stocked values and render fresh only when the user asks for exact ones.<\/li>\n\n\n<li>Copy the file to your own storage within 15 minutes of <code>done<\/code>.<\/li>\n\n\n<li>Read <code>max_track_duration<\/code> and <code>track_expiration_time<\/code> from your licence before you build the UI.<\/li>\n\n\n<li>Check the licence exceptions before adding any export-to-streaming feature.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Ten lines of code, and the receipt from the text to music API turns into a song. The full reference lives in the <a href=\"https:\/\/mubert.com\/api\/docs\" target=\"_blank\">Mubert API docs<\/a>.<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>With Mubert API v3, a text prompt of up to 255 characters and a duration of 5 seconds or more become a track in one POST, and you collect the file by polling or a webhook. Below: the request, the wait, the formats and the licence.<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":6602,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[127,301,283,299],"class_list":["post-6601","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-insights","tag-ai-music","tag-app-development","tag-background-music","tag-music-api"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO Pro 5.0.6.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Text to music API guide for Mubert v3: one POST with a 255-character prompt, polling every 5 s or a webhook, MP3 or WAV, and where the licence stops.\" \/>\n\t<meta name=\"robots\" content=\"max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n\t<meta name=\"author\" content=\"Mubert Team\"\/>\n\t<meta name=\"google-site-verification\" content=\"Z0lMgBGD_DdV-YJXlBW_mpnjKZhnISUJLElngis7ecg\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/mubert.com\/blog\/text-to-music-api-mubert-v3-webhook-polling\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO Pro (AIOSEO) 5.0.6.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Mubert \u2013 Royalty-free AI Music for Content Creators\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Text to Music API: Prompt to Track With Mubert v3\" \/>\n\t\t<meta property=\"og:description\" content=\"Text to music API guide for Mubert v3: one POST with a 255-character prompt, polling every 5 s or a webhook, MP3 or WAV, and where the licence stops.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/mubert.com\/blog\/text-to-music-api-mubert-v3-webhook-polling\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/mubert.com\/blog\/wp-json\/mubert\/v1\/og\/6602.jpg?v=8b17aa525e\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/mubert.com\/blog\/wp-json\/mubert\/v1\/og\/6602.jpg?v=8b17aa525e\" \/>\n\t\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-11-29T08:00:12+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-11-29T08:01:12+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/mubert.app\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@mubertapp\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Text to Music API: Prompt to Track With Mubert v3\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Text to music API guide for Mubert v3: one POST with a 255-character prompt, polling every 5 s or a webhook, MP3 or WAV, and where the licence stops.\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@mubertapp\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/mubert.com\/blog\/wp-json\/mubert\/v1\/og\/6602.jpg?v=8b17aa525e\" \/>\n\t\t<!-- All in One SEO Pro -->\r\n\t\t<title>Text to Music API: Prompt to Track With Mubert v3<\/title>\n\n","aioseo_head_json":{"title":"Text to Music API: Prompt to Track With Mubert v3","description":"Text to music API guide for Mubert v3: one POST with a 255-character prompt, polling every 5 s or a webhook, MP3 or WAV, and where the licence stops.","canonical_url":"https:\/\/mubert.com\/blog\/text-to-music-api-mubert-v3-webhook-polling","robots":"max-snippet:-1, max-image-preview:large, max-video-preview:-1","keywords":"","webmasterTools":{"google-site-verification":"Z0lMgBGD_DdV-YJXlBW_mpnjKZhnISUJLElngis7ecg","miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"Mubert \u2013 Royalty-free AI Music for Content Creators","og:type":"article","og:title":"Text to Music API: Prompt to Track With Mubert v3","og:description":"Text to music API guide for Mubert v3: one POST with a 255-character prompt, polling every 5 s or a webhook, MP3 or WAV, and where the licence stops.","og:url":"https:\/\/mubert.com\/blog\/text-to-music-api-mubert-v3-webhook-polling","og:image":"https:\/\/mubert.com\/blog\/wp-json\/mubert\/v1\/og\/6602.jpg?v=8b17aa525e","og:image:secure_url":"https:\/\/mubert.com\/blog\/wp-json\/mubert\/v1\/og\/6602.jpg?v=8b17aa525e","og:image:width":1200,"og:image:height":630,"article:published_time":"2026-11-29T08:00:12+00:00","article:modified_time":"2026-11-29T08:01:12+00:00","article:publisher":"https:\/\/facebook.com\/mubert.app","twitter:card":"summary","twitter:site":"@mubertapp","twitter:title":"Text to Music API: Prompt to Track With Mubert v3","twitter:description":"Text to music API guide for Mubert v3: one POST with a 255-character prompt, polling every 5 s or a webhook, MP3 or WAV, and where the licence stops.","twitter:creator":"@mubertapp","twitter:image":"https:\/\/mubert.com\/blog\/wp-json\/mubert\/v1\/og\/6602.jpg?v=8b17aa525e"},"aioseo_meta_data":{"post_id":"6601","title":"Text to Music API: Prompt to Track With Mubert v3","description":"Text to music API guide for Mubert v3: one POST with a 255-character prompt, polling every 5 s or a webhook, MP3 or WAV, and where the licence stops.","keywords":null,"keyphrases":{"focus":{"keyphrase":"text to music api","score":0,"analysis":[]},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-11-29 08:01:33","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"open_ai":null,"ai":null,"created":"2026-11-29 08:00:12","updated":"2026-11-29 08:01:33","focus_keyword":"text to music api","additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t<a href=\"https:\/\/mubert.com\/blog\/\" title=\"Home\">Home<\/a>\n<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t<a href=\"https:\/\/mubert.com\/blog\/category\/insights\" title=\"Insights\">Insights<\/a>\n<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\tText to Music API: One POST, a 15-Minute Download Link, and the Webhook That Saves You From Polling\n<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/mubert.com\/blog\/"},{"label":"Insights","link":"https:\/\/mubert.com\/blog\/category\/insights"},{"label":"Text to Music API: One POST, a 15-Minute Download Link, and the Webhook That Saves You From Polling","link":"https:\/\/mubert.com\/blog\/text-to-music-api-mubert-v3-webhook-polling"}],"permalink_manager":null,"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/mubert.com\/blog\/wp-json\/wp\/v2\/posts\/6601","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mubert.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mubert.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mubert.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mubert.com\/blog\/wp-json\/wp\/v2\/comments?post=6601"}],"version-history":[{"count":1,"href":"https:\/\/mubert.com\/blog\/wp-json\/wp\/v2\/posts\/6601\/revisions"}],"predecessor-version":[{"id":6608,"href":"https:\/\/mubert.com\/blog\/wp-json\/wp\/v2\/posts\/6601\/revisions\/6608"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mubert.com\/blog\/wp-json\/wp\/v2\/media\/6602"}],"wp:attachment":[{"href":"https:\/\/mubert.com\/blog\/wp-json\/wp\/v2\/media?parent=6601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mubert.com\/blog\/wp-json\/wp\/v2\/categories?post=6601"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mubert.com\/blog\/wp-json\/wp\/v2\/tags?post=6601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}