Edit song section

September 5, 2026

Table of contents

  1. Request Headers
  2. Request Body
  3. Responses
  4. Model
  5. Examples
  6. Try It

https://api.useapi.net/v1/mureka/music/edit

Re-render one bounded section of a song you already generated. You choose the section by time range, hand Mureka the lyrics that section should sing, and get back a complete song with only that stretch replaced.

This is the narrower sibling of POST /music/regenerate, which always rewrites everything from a start point to the end of the song. Editing keeps the rest of the track untouched.

There is no model parameter. The edit inherits whatever rendered the source song, and the edited song comes back reporting no model of its own. Sending one is rejected with 400 Parameter model not supported.

An active paid Mureka plan is required. Without one every call returns 403 low vip level (6335), exactly as POST /music/regenerate does.

An edit costs 20 credits and returns one song. Credits come off when the request is accepted, not when the song finishes.

Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
Request Body
{
    "song_id": "user:777-mureka:123456789-song:33445566",
    "start_milliseconds": 41560,
    "end_milliseconds": 87080,
    "lyrics": "Golden temples hum a tune\nIncense swirling, afternoon\nThis line is new\nEvery heartbeat sings this room",
    "keep_melody": true
}
  • song_id is required.
    The song_id value returned by one of the following endpoints:
  • start_milliseconds is optional, where the edited section begins (default: 0).

  • end_milliseconds is optional, where the edited section ends (default: the song’s duration_milliseconds, so omitting both bounds rewrites the whole song). A value past the end of the song is clamped to its duration.

    Pick the range off GET /music/song_id, where each sung line carries its own start and end in milliseconds. Mureka treats your range as a hint and may widen it to a musical boundary, so the finished song can cover more than you asked for — regenerate_from and regenerate_to on the returned song report the range it actually used.

  • lyrics is optional, up to 3000 characters — the lyrics for the selected range only, not for the whole song. One line per sung line, without the [Verse] / [Chorus] section tags.

    Omit it to keep the words you already have: the API fills in the song’s own lines from that range, so you can re-roll a section’s performance without rewriting it. Only lines falling entirely inside the range are picked up, and they come through verbatim, including any bracketed production cue the song stores as a lyric line. A range that cuts a line in half drops that line, leaving Mureka fewer lyrics than the audio it spans — pin the bounds to a line’s own start and end when you want an exact match.

  • title is optional, up to 58 characters (default: the source song’s title).

  • keep_melody is optional (default: true). Leave it on to hold the existing melody and rewrite only what is sung over it, which keeps the section at its original length and leaves the rest of the track where it was.

    Set it to false and Mureka writes a new melody for the section, which is then re-timed to fit the new line. That moves everything after it and changes the song’s total duration — in one measured run the same four lines came back six seconds shorter, pulling the closing section earlier and trimming a 2:55 track to 2:49. Check duration_milliseconds on the returned song rather than assuming it matches the source.

  • async is optional, enables fire-and-forget mode (default: false). When true, returns immediately with 201 Created and job metadata. Poll GET /jobs/jobid for completion status. Useful for avoiding long request timeouts since music generation takes 30-90 seconds.

  • replyUrl is optional, webhook URL for job status callbacks. Receives POST requests with job status updates (created, completed, failed). The JSON payload shape matches GET /jobs/jobid response.

  • replyRef is optional, custom reference string passed back in webhook callbacks. Useful for tracking jobs on your end.
Responses
  • 200 OK

    {
        "jobid": "j0121061432017475905m-u777-a12345678901234-bot:mureka",
        "feed_id": 11223344,
        "state": 3,
        "songs": [
            {
                "song_id": "user:777-mureka:123456789-song:33445566",
                "title": "<title>",
                "is_regenerate": true,
                "regenerate_from": 41560,
                "regenerate_to": 91013,
                "duration_milliseconds": 202843,
                "generate_at": 12345677,
                "genres": [
                    "r&b",
                    "pop"
                ],
                "moods": [
                    "warm",
                    "relaxed"
                ],
                "mp3_url": "https://<download link>.mp3",
                "share_key": "<share key>",
                "machine_audit_state": 1,
                "credit_type": 1,
                "cover": "https://<cover image>.png",
                "share_link": "https://<share link>"
            }
        ]
    }
    
  • 201 Created

    Job created in async mode (async: true). The edit is processing in the background.

    Use GET /jobs/jobid to poll for completion status.

    {
        "jobid": "j0121061432017475905m-u777-a12345678901234-bot:mureka",
        "verb": "music/edit",
        "jobType": "music",
        "status": "created",
        "created": "2026-09-05T12:34:56.789Z",
        "request": {
            "account": "12345678901234",
            "song_id": 33445566,
            "start_milliseconds": 41560,
            "end_milliseconds": 87080,
            "keep_melody": true,
            "async": true,
            "replyUrl": "https://your-domain.com/webhook",
            "replyRef": "my-custom-ref-123"
        }
    }
    
  • 400 Bad Request

    {
      "error": "<Error message>",
      "code": 400
    }
    

    Returned when the range is unusable — end_milliseconds at or before start_milliseconds, start_milliseconds past the end of the song, or a range that contains no sung lines while lyrics was omitted.

  • 401 Unauthorized

    {
      "error": "Wrong username/password combination.",
      "code": 401
    }
    
  • 403 Forbidden

    Editing an existing song is a paid Mureka feature. Subscribe at mureka.ai/subscribe and retry.

    {
      "error": "low vip level (6335)"
    }
    
  • 429 Too Many Requests

    • Rate limit exceeded.
      Endpoint called too frequently. Wait at least 3 seconds before making another call.
      {
      "code": 9008,
      "msg": "Too frequently, please try again later."
      }
      
    • Concurrent job limit exceeded. All job slots are taken (typically 10 concurrent generations per account). Wait at least 5 seconds before retrying.
      {
      "error": "Generate multiple task exceed limit. (6323)"
      }
      
  • 596 Account Error

    Returned when the account has an error state preventing API calls.

    {
        "error": "Session refresh failed 2026-01-19T14:31:15.000Z, manual update required",
        "code": "REFRESH_FAILED"
    }
    

    Possible error codes:

    • ACCOUNT_ERROR - Account has a blocking error
    • REFRESH_FAILED - Automatic token refresh failed
    • REFRESH_IN_PROGRESS - Token refresh already in progress, retry shortly
    • SESSION_EXPIRED - Session expired and no auto-refresh available
    • COOKIE_EXPIRED - Google cookie has expired

    To resolve, update your account configuration via POST /accounts.

Model
  • Edit completed. Returns the full song data with MP3 URLs.

    {
        jobid: string                              // Job identifier (for later lookup)
        feed_id: number
        state: number
        songs?: {
            song_id: string
            title: string
            is_regenerate: boolean
            regenerate_from: number                // Start of the range Mureka actually re-rendered
            regenerate_to: number                  // End of the range Mureka actually re-rendered
            duration_milliseconds: number
            generate_at: number
            genres: string[]
            moods: string[]
            mp3_url: string
            share_key: string
            machine_audit_state: number
            credit_type: number
            cover: string
            share_link: string
        }[]
        error?: string
        code?: number
        msg?: string
    }
    
  • Job created and processing in background. Structure matches GET /jobs/jobid response.

    {
        jobid: string                              // Job identifier
        verb: 'music/edit'                         // Job verb
        jobType: 'music'                           // Job type
        status: 'created'                          // Job status
        created: string                            // ISO 8601 timestamp
        request: {
            account?: string
            song_id: number                        // Decoded Mureka id, not the user:…-song:… form
            start_milliseconds?: number
            end_milliseconds?: number
            lyrics?: string
            title?: string
            keep_melody?: boolean
            async: true
            replyUrl?: string
            replyRef?: string
        }
    }
    
  • Error response structure (applies to both sync and async modes).

    {
        jobid?: string                             // Present for job-related errors
        error: string                              // Error summary message
        code?: number                              // HTTP status code or error code
        msg?: string                               // Additional error message
        rawData?: string                           // Raw error data (if available)
    }
    
Examples
  • curl -H "Accept: application/json" \
         -H "Content-Type: application/json" \
         -H "Authorization: Bearer …" \
         -X POST https://api.useapi.net/v1/mureka/music/edit \
         -d '{"song_id": "…", "start_milliseconds": 41560, "end_milliseconds": 87080, "lyrics": "…"}'
    
  • const song_id = "user:777-mureka:123456789-song:33445566";
    const start_milliseconds = 41560;
    const end_milliseconds = 87080;
    const lyrics = "Golden temples hum a tune\nIncense swirling, afternoon";
    const apiUrl = `https://api.useapi.net/v1/mureka/music/edit`; 
    const api_token = "API token";
    const data = { 
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${api_token}`,
        'Content-Type': 'application/json' }
    };
    data.body = JSON.stringify({ 
      song_id, start_milliseconds, end_milliseconds, lyrics
    });
    const response = await fetch(apiUrl, data);
    const result = await response.json();
    console.log("response", {response, result});
    
  • import requests
    song_id = "user:777-mureka:123456789-song:33445566"
    start_milliseconds = 41560
    end_milliseconds = 87080
    lyrics = "Golden temples hum a tune\nIncense swirling, afternoon"
    apiUrl = f"https://api.useapi.net/v1/mureka/music/edit" 
    api_token = "API token"
    headers = {
        "Content-Type": "application/json", 
        "Authorization" : f"Bearer {api_token}"
    }
    body = {
        "song_id": song_id,
        "start_milliseconds": start_milliseconds,
        "end_milliseconds": end_milliseconds,
        "lyrics": lyrics
    }
    response = requests.post(apiUrl, headers=headers, json=body)
    print(response, response.json())
    
Try It