KIE.AI
English
  • English
  • Chinese
English
  • English
  • Chinese
Support
English
  • English
  • Chinese
MarketVeo3.1 APISuno API
4o Image APIFlux Kontext APIRunway APILuma APIFile Upload APICommon API
MarketVeo3.1 APISuno API
4o Image APIFlux Kontext APIRunway APILuma APIFile Upload APICommon API
  1. Music Generation
  • Suno API Quickstart
  • Music Generation
    • Music Generation Callbacks
    • Music Extension Callbacks
    • Audio Upload and Cover Callbacks
    • Audio Upload and Extension Callbacks
    • Add Instrumental Callbacks
    • Add Vocals Callbacks
    • Music Cover Generation Callbacks
    • Replace Music Section Callbacks
    • Generate Music
      POST
    • Extend Music
      POST
    • Upload And Cover Audio
      POST
    • Upload And Extend Audio
      POST
    • Add Instrumental to Music
      POST
    • Add Vocals to Music
      POST
    • Get Music Task Details
      GET
    • Get Timestamped Lyrics
      POST
    • Boost Music Style
      POST
    • Create Suno Cover Task
      POST
    • Get Cover Generation Details
      GET
    • Replace Music Section
      POST
    • Generate Persona
      POST
  • Lyrics Generation
    • Lyrics Generation Callbacks
    • Generate Lyrics
      POST
    • Get Lyrics Task Details
      GET
  • WAV Conversion
    • Convert to WAV Callbacks
    • Convert to WAV Format
      POST
    • Get WAV Conversion Details
      GET
  • Vocal Removal
    • Audio Separation Callbacks
    • MIDI Generation Callbacks
    • Separate Vocals from Music
    • Get Vocal Separation Details
    • Generate MIDI from Audio
    • Get MIDI Generation Details
  • Music Video Generation
    • Music Video Generation Callbacks
    • Create Music Video
    • Get Music Video Details
English
  • English
  • Chinese
Support
English
  • English
  • Chinese
MarketVeo3.1 APISuno API
4o Image APIFlux Kontext APIRunway APILuma APIFile Upload APICommon API
MarketVeo3.1 APISuno API
4o Image APIFlux Kontext APIRunway APILuma APIFile Upload APICommon API
  1. Music Generation

Audio Upload and Extension Callbacks

System will call this callback when audio generation is complete
When you submit an audio upload and extension task to the Suno API, you can use the callBackUrl parameter to set a callback URL. The system will automatically push the results to your specified address when the task is completed.

Callback Mechanism Overview#

The callback mechanism eliminates the need to poll the API for task status. The system will proactively push task completion results to your server.
Webhook Security
To ensure the authenticity and integrity of callback requests, we strongly recommend implementing webhook signature verification. See our Webhook Verification Guide for detailed implementation steps.

Callback Timing#

The system will send callback notifications in the following situations:
Text generation completed (callbackType: "text")
First audio track generation completed (callbackType: "first")
All audio tracks generation completed (callbackType: "complete")
Audio generation task failed
Errors occurred during task processing

Callback Method#

HTTP Method: POST
Content Type: application/json
Timeout Setting: 15 seconds

Callback Request Format#

When the task progresses or completes, the system will send a POST request to your callBackUrl in the following format:
Complete Success Callback
First Track Complete Callback
Text Generation Complete Callback
Failure Callback
{
  "code": 200,
  "msg": "All generated successfully.",
  "data": {
    "callbackType": "complete",
    "task_id": "2fac****9f72",
    "data": [
      {
        "id": "e231****-****-****-****-****8cadc7dc",
        "audio_url": "https://example.cn/****.mp3",
        "source_audio_url": "https://example.cn/****.mp3",
        "stream_audio_url": "https://example.cn/****",
        "source_stream_audio_url": "https://example.cn/****",
        "image_url": "https://example.cn/****.jpeg",
        "source_image_url": "https://example.cn/****.jpeg",
        "prompt": "[Verse] Night city lights shining bright",
        "model_name": "chirp-v3-5",
        "title": "Iron Man",
        "tags": "electrifying, rock",
        "createTime": "2025-01-01 00:00:00",
        "duration": 198.44
      }
    ]
  }
}

Status Code Description#

code (integer, required)#

Callback status code indicating task processing result:
Status CodeDescription
200Success - Request has been processed successfully
400Validation Error - Lyrics contained copyrighted material
408Rate Limited - Timeout
413Conflict - Uploaded audio matches existing work of art
500Server Error - An unexpected error occurred while processing the request
501Audio generation failed
531Server Error - Sorry, the generation failed due to an issue. Your credits have been refunded. Please try again

msg (string, required)#

Status message providing detailed status description

data.callbackType (string, required)#

Callback type indicating the stage of generation:
text: Text generation complete
first: First track complete
complete: All tracks complete
error: Generation failed

data.task_id (string, required)#

Task ID, consistent with the taskId returned when you submitted the task

data.data (array, required)#

Array of generated audio tracks. Empty for text callbacks or failures.

data.data[].id (string)#

Audio unique identifier (audioId)

data.data[].audio_url (string)#

Extended audio file URL for download

data.data[].source_audio_url (string)#

Original source audio file URL

data.data[].stream_audio_url (string)#

Extended streaming audio URL for real-time playback

data.data[].source_stream_audio_url (string)#

Original source streaming audio URL

data.data[].image_url (string)#

Extended cover image URL

data.data[].source_image_url (string)#

Original source cover image URL

data.data[].prompt (string)#

Generation prompt/lyrics used

data.data[].model_name (string)#

Model name used for generation (e.g., "chirp-v3-5")

data.data[].title (string)#

Music title

data.data[].tags (string)#

Music tags/genre

data.data[].createTime (string)#

Creation timestamp

data.data[].duration (number)#

Audio duration in seconds

Callback Reception Examples#

Here are example codes for receiving callbacks in popular programming languages:
Node.js
Python
PHP

Best Practices#

Callback URL Configuration Recommendations
1.
Use HTTPS: Ensure your callback URL uses HTTPS protocol for secure data transmission
2.
Verify Source: Verify the legitimacy of the request source in callback processing
3.
Idempotent Processing: The same task_id may receive multiple callbacks, ensure processing logic is idempotent
4.
Quick Response: Callback processing should return a 200 status code as quickly as possible to avoid timeout
5.
Asynchronous Processing: Complex business logic should be processed asynchronously to avoid blocking callback response
6.
Handle Multiple Callbacks: Be prepared to receive text, first, and complete callbacks for the same task
7.
Download Both Versions: Consider downloading both extended and source files for comparison
Important Reminders
Callback URL must be a publicly accessible address
Server must respond within 15 seconds, otherwise it will be considered a timeout
If 3 consecutive retries fail, the system will stop sending callbacks
You may receive multiple callbacks for the same task (text → first → complete)
Please ensure the stability of callback processing logic to avoid callback failures due to exceptions
Handle copyright and conflict errors appropriately (codes 400, 413)
Credit refunds are automatic for certain server errors (code 531)
Be aware of both extended and source file URLs for complete asset management
Generated files will be retained for 14 days

Troubleshooting#

If you do not receive callback notifications, please check the following:
Network Connection Issues
Confirm that the callback URL is accessible from the public network
Check firewall settings to ensure inbound requests are not blocked
Verify that domain name resolution is correct
Server Response Issues
Ensure the server returns HTTP 200 status code within 15 seconds
Check server logs for error messages
Verify that the interface path and HTTP method are correct
Content Format Issues
Confirm that the received POST request body is in JSON format
Check that Content-Type is application/json
Verify that JSON parsing is correct
Audio Processing Issues
Confirm that audio URLs are accessible
Check audio download permissions and network connections
Verify audio save paths and permissions
Handle both regular and streaming audio URLs appropriately
Process multiple tracks in the same callback
Download both extended and source audio files as needed
Copyright and Content Issues
Review error messages for copyright violations (code 400)
Check for content conflicts with existing works (code 413)
Ensure compliance with platform content policies
Adjust uploaded audio or prompts if flagged
Verify uploaded audio originality and ensure it doesn't exceed 2 minutes
Rate Limiting Issues
Handle timeout errors gracefully (code 408)
Implement appropriate retry logic with backoff
Monitor API usage to avoid rate limits
Consider upgrading service plan if needed
Extension-Specific Issues
Ensure uploaded audio does not exceed 2 minutes
Verify continueAt parameter is within valid range (greater than 0 and less than audio duration)
Check model version compatibility with source music
Monitor that extended files are properly differentiated from source files

Alternative Solution#

If you cannot use the callback mechanism, you can also use polling:
Poll Query Results
Use the get music details endpoint to regularly query task status. We recommend querying every 30 seconds.
Previous
Audio Upload and Cover Callbacks
Next
Add Instrumental Callbacks
Built with