Get started

Make a key, connect a client and send your first request. The REST API needs an API plan (Starter, Build, Scale or Growth) or prepaid API credits, and spends API credits. The MCP server signs in with your Mozart account and spends your plan's credits. Making songs needs Creator or above. The mozart command-line tool is coming soon.

Make your first song in five minutes

The first four calls make a song: check your key, start a song, wait until it can play, then download it. Steps 5 and 6 are optional: rewrite a section of that song, or make a stem. Every request goes to https://api.mozartai.com/v1 with your key as a bearer token.

  1. 1Check your key

    Make a key on the Developer page, put it in MOZART_API_KEY, and call GET /v1/me. A 200 with your account means the key works.

    cURL
    export MOZART_API_KEY=mzk_...
    curl https://api.mozartai.com/v1/me \
      -H "Authorization: Bearer $MOZART_API_KEY"
  2. 2Start a song

    POST /v1/songs with a prompt. Send a fresh idempotency-key header on every new request: a retry with the same key returns the first job and never charges twice. The answer comes back at once with job.id. A song request costs 25 credits and makes two songs.

    cURL
    JOB_ID=$(curl -s -X POST https://api.mozartai.com/v1/songs \
      -H "Authorization: Bearer $MOZART_API_KEY" \
      -H "idempotency-key: $(uuidgen)" \
      -H "Content-Type: application/json" \
      -d '{"prompt": "An upbeat synth-pop song about a summer road trip"}' | jq -r .job.id)
  3. 3Wait until it can play

    POST /v1/jobs/wait with job_ids and until. Each call holds for up to wait_seconds (at most 25) and answers jobs[] plus all_settled. Today until: "playable" and until: "complete" settle at the same moment: when the finished files are ready, about 2 to 3 minutes after a song request. Call again until all_settled is true, then read jobs[0].song_ids.

    cURL
    until curl -s -X POST https://api.mozartai.com/v1/jobs/wait \
      -H "Authorization: Bearer $MOZART_API_KEY" \
      -H "Content-Type: application/json" \
      -d "{\"job_ids\": [\"$JOB_ID\"], \"until\": \"playable\", \"wait_seconds\": 25}" \
      | tee job.json | jq -e .all_settled > /dev/null; do :; done
    SONG_ID=$(jq -r '.jobs[0].song_ids[0]' job.json)
  4. 4Download it

    POST /v1/songs/{song_id}/download with a format (mp3, wav, flac or m4a) answers a signed url. Fetch it before url_expires_at.

    cURL
    URL=$(curl -s -X POST https://api.mozartai.com/v1/songs/$SONG_ID/download \
      -H "Authorization: Bearer $MOZART_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"format": "mp3"}' | jq -r .url)
    curl -o song.mp3 "$URL"
  5. 5Rewrite a section

    POST /v1/inpaints with a source_song_id, a section of 3 to 60 seconds (start_seconds, end_seconds) and a prompt, lyrics or both. The new section blends into the music on each side. It makes two new songs and leaves the source as it was. Wait for the job as in step 3.

    cURL
    INPAINT_JOB_ID=$(curl -s -X POST https://api.mozartai.com/v1/inpaints \
      -H "Authorization: Bearer $MOZART_API_KEY" \
      -H "idempotency-key: $(uuidgen)" \
      -H "Content-Type: application/json" \
      -d "{\"source_song_id\": \"$SONG_ID\", \"start_seconds\": 30, \"end_seconds\": 45, \"prompt\": \"Lift this section with a gospel choir\"}" | jq -r .job.id)
  6. 6Make a stem

    POST /v1/stems with an instrument, 8, 16, 32 or 64 bars, a bpm and a key with key_mode. It makes two solo loops, each a WAV cut exactly on the bar, and each is a song you can cover, master or turn into MIDI. Wait for the job as in step 3.

    cURL
    STEM_JOB_ID=$(curl -s -X POST https://api.mozartai.com/v1/stems \
      -H "Authorization: Bearer $MOZART_API_KEY" \
      -H "idempotency-key: $(uuidgen)" \
      -H "Content-Type: application/json" \
      -d '{"instrument": "bass", "bars": 8, "bpm": 120, "key": "A", "key_mode": "minor", "prompt": "Warm deep house bassline"}' | jq -r .job.id)

To see the price first, send the same POST /v1/songs body with dry_run set to true. It is free and starts nothing, but it still needs its own idempotency-key header, like every write.

New to MCP? Start with the music MCP server overview.

1. Make a key

Create an API key on the Developer page of the web app to call the REST API. API keys work only with the REST API. MCP clients sign in with your Mozart account instead and need no key.

Open the Developer page

2. Connect your client

Send the key as a bearer token. Requests and responses are JSON.

REST (curl)
export MOZART_API_KEY=mzk_...
curl https://api.mozartai.com/v1/me \
  -H "Authorization: Bearer $MOZART_API_KEY"