Vai al contenuto
Riferimento API
Riferimento API

Suno Testo in musica

Usa l'endpoint da testo a musica per creare un Task asincrono.

01

Panoramica

Usa l'endpoint da testo a musica con un modello supportato. Utilizza il Task ID restituito per recuperarne lo stato, oppure fornisci callback_url per le consegne documentate di seguito.

Avvio rapido

  1. Crea una Chiave API e impostala come RUNAPI_API_KEY.
  2. Scegli un modello supportato e invia una richiesta POST il cui corpo corrisponda allo schema di quel modello.
  3. Conserva l'ID attività restituito, quindi esegui il polling fino a uno stato terminale o gestisci i callback documentati di seguito.

Endpoint

POST /api/v1/suno/text_to_music
URL di base
https://runapi.ai
Versione API
v1
Autenticazione
Authorization: Bearer YOUR_API_TOKEN
02

Modelli supportati

Apri la pagina di un modello per i prezzi correnti, i limiti di frequenza e i dettagli sull'uso commerciale.

03

Schema della richiesta

Corpo JSON

I campi e i valori consentiti dipendono dal modello selezionato. Se fornito, callback_url riceve le notifiche Task documentate di seguito.

suno-v415 campi
audio_weightnumber
Opzionale

Peso audio (0-1).

Intervallo: 0 - 1
callback_urlstring
Opzionale

URL webhook per notifiche asincrone.

continue_atnumber
Opzionale

Timestamp in secondi da cui continuare.

lyricsstring
Opzionale

Testo esatto dei testi da cantare.

Vincolo: 5000
modelstring
Obbligatorio

Slug del modello.

negative_tagsstring
Opzionale

Stili da evitare.

persona_idstring
Opzionale

ID persona.

persona_typestring
Opzionale

Tipo di persona.

Valori consentiti: style, voice
promptstring
Opzionale

Descrizione del brano per i testi automatici.

Vincolo: 5000
stylestring
Opzionale

Stile musicale.

Vincolo: 1000
style_weightnumber
Opzionale

Peso di aderenza allo stile (0-1).

Intervallo: 0 - 1
titlestring
Opzionale

Titolo musicale.

Vincolo: 80
vocal_genderstring
Opzionale

Genere vocale.

Valori consentiti: male, female
vocal_modestring
Obbligatorio

Modalità di generazione vocale.

Valori consentiti: auto_lyrics, exact_lyrics, instrumental
weirdness_constraintnumber
Opzionale

Vincolo di stranezza (0-1).

Intervallo: 0 - 1
suno-v4.515 campi
audio_weightnumber
Opzionale

Peso audio (0-1).

Intervallo: 0 - 1
callback_urlstring
Opzionale

URL webhook per notifiche asincrone.

continue_atnumber
Opzionale

Timestamp in secondi da cui continuare.

lyricsstring
Opzionale

Testo esatto dei testi da cantare.

Vincolo: 5000
modelstring
Obbligatorio

Slug del modello.

negative_tagsstring
Opzionale

Stili da evitare.

persona_idstring
Opzionale

ID persona.

persona_typestring
Opzionale

Tipo di persona.

Valori consentiti: style, voice
promptstring
Opzionale

Descrizione del brano per i testi automatici.

Vincolo: 5000
stylestring
Opzionale

Stile musicale.

Vincolo: 1000
style_weightnumber
Opzionale

Peso di aderenza allo stile (0-1).

Intervallo: 0 - 1
titlestring
Opzionale

Titolo musicale.

Vincolo: 80
vocal_genderstring
Opzionale

Genere vocale.

Valori consentiti: male, female
vocal_modestring
Obbligatorio

Modalità di generazione vocale.

Valori consentiti: auto_lyrics, exact_lyrics, instrumental
weirdness_constraintnumber
Opzionale

Vincolo di stranezza (0-1).

Intervallo: 0 - 1
suno-v4.5-all15 campi
audio_weightnumber
Opzionale

Peso audio (0-1).

Intervallo: 0 - 1
callback_urlstring
Opzionale

URL webhook per notifiche asincrone.

continue_atnumber
Opzionale

Timestamp in secondi da cui continuare.

lyricsstring
Opzionale

Testo esatto dei testi da cantare.

Vincolo: 5000
modelstring
Obbligatorio

Slug del modello.

negative_tagsstring
Opzionale

Stili da evitare.

persona_idstring
Opzionale

ID persona.

persona_typestring
Opzionale

Tipo di persona.

Valori consentiti: style, voice
promptstring
Opzionale

Descrizione del brano per i testi automatici.

Vincolo: 5000
stylestring
Opzionale

Stile musicale.

Vincolo: 1000
style_weightnumber
Opzionale

Peso di aderenza allo stile (0-1).

Intervallo: 0 - 1
titlestring
Opzionale

Titolo musicale.

Vincolo: 80
vocal_genderstring
Opzionale

Genere vocale.

Valori consentiti: male, female
vocal_modestring
Obbligatorio

Modalità di generazione vocale.

Valori consentiti: auto_lyrics, exact_lyrics, instrumental
weirdness_constraintnumber
Opzionale

Vincolo di stranezza (0-1).

Intervallo: 0 - 1
suno-v4.5-plus15 campi
audio_weightnumber
Opzionale

Peso audio (0-1).

Intervallo: 0 - 1
callback_urlstring
Opzionale

URL webhook per notifiche asincrone.

continue_atnumber
Opzionale

Timestamp in secondi da cui continuare.

lyricsstring
Opzionale

Testo esatto dei testi da cantare.

Vincolo: 5000
modelstring
Obbligatorio

Slug del modello.

negative_tagsstring
Opzionale

Stili da evitare.

persona_idstring
Opzionale

ID persona.

persona_typestring
Opzionale

Tipo di persona.

Valori consentiti: style, voice
promptstring
Opzionale

Descrizione del brano per i testi automatici.

Vincolo: 5000
stylestring
Opzionale

Stile musicale.

Vincolo: 1000
style_weightnumber
Opzionale

Peso di aderenza allo stile (0-1).

Intervallo: 0 - 1
titlestring
Opzionale

Titolo musicale.

Vincolo: 80
vocal_genderstring
Opzionale

Genere vocale.

Valori consentiti: male, female
vocal_modestring
Obbligatorio

Modalità di generazione vocale.

Valori consentiti: auto_lyrics, exact_lyrics, instrumental
weirdness_constraintnumber
Opzionale

Vincolo di stranezza (0-1).

Intervallo: 0 - 1
suno-v515 campi
audio_weightnumber
Opzionale

Peso audio (0-1).

Intervallo: 0 - 1
callback_urlstring
Opzionale

URL webhook per notifiche asincrone.

continue_atnumber
Opzionale

Timestamp in secondi da cui continuare.

lyricsstring
Opzionale

Testo esatto dei testi da cantare.

Vincolo: 5000
modelstring
Obbligatorio

Slug del modello.

negative_tagsstring
Opzionale

Stili da evitare.

persona_idstring
Opzionale

ID persona.

persona_typestring
Opzionale

Tipo di persona.

Valori consentiti: style, voice
promptstring
Opzionale

Descrizione del brano per i testi automatici.

Vincolo: 5000
stylestring
Opzionale

Stile musicale.

Vincolo: 1000
style_weightnumber
Opzionale

Peso di aderenza allo stile (0-1).

Intervallo: 0 - 1
titlestring
Opzionale

Titolo musicale.

Vincolo: 80
vocal_genderstring
Opzionale

Genere vocale.

Valori consentiti: male, female
vocal_modestring
Obbligatorio

Modalità di generazione vocale.

Valori consentiti: auto_lyrics, exact_lyrics, instrumental
weirdness_constraintnumber
Opzionale

Vincolo di stranezza (0-1).

Intervallo: 0 - 1
suno-v5.516 campi
audio_weightnumber
Opzionale

Peso audio (0-1).

Intervallo: 0 - 1
callback_urlstring
Opzionale

URL webhook per notifiche asincrone.

continue_atnumber
Opzionale

Timestamp in secondi da cui continuare.

duration_secondsinteger
Opzionale

Durata preferita in secondi; disponibile solo per le richieste personalizzate di Suno V5.5.

Intervallo: 10 - 360
lyricsstring
Opzionale

Testo esatto dei testi da cantare.

Vincolo: 5000
modelstring
Obbligatorio

Slug del modello.

negative_tagsstring
Opzionale

Stili da evitare.

persona_idstring
Opzionale

ID persona.

persona_typestring
Opzionale

Tipo di persona.

Valori consentiti: style, voice
promptstring
Opzionale

Descrizione del brano per i testi automatici.

Vincolo: 5000
stylestring
Opzionale

Stile musicale.

Vincolo: 1000
style_weightnumber
Opzionale

Peso di aderenza allo stile (0-1).

Intervallo: 0 - 1
titlestring
Opzionale

Titolo musicale.

Vincolo: 80
vocal_genderstring
Opzionale

Genere vocale.

Valori consentiti: male, female
vocal_modestring
Obbligatorio

Modalità di generazione vocale.

Valori consentiti: auto_lyrics, exact_lyrics, instrumental
weirdness_constraintnumber
Opzionale

Vincolo di stranezza (0-1).

Intervallo: 0 - 1

Regole condizionali

Questi requisiti si applicano quando tutte le condizioni elencate corrispondono.

  1. Quando vocal_mode = auto_lyrics
    Obbligatorio
    prompt
    Non accettato
    lyrics, style, title, negative_tags, vocal_gender, duration_seconds
  2. Quando vocal_mode = exact_lyrics
    Obbligatorio
    lyrics, style, title
    Non accettato
    prompt
  3. Quando vocal_mode = instrumental
    Obbligatorio
    style, title
    Non accettato
    prompt, lyrics, vocal_gender
  4. Quando model = suno-v4
    Obbligatorio
    Non accettato
    duration_seconds
  5. Quando model = suno-v4.5
    Obbligatorio
    Non accettato
    duration_seconds
  6. Quando model = suno-v4.5-all
    Obbligatorio
    Non accettato
    duration_seconds
  7. Quando model = suno-v4.5-plus
    Obbligatorio
    Non accettato
    duration_seconds
  8. Quando model = suno-v5
    Obbligatorio
    Non accettato
    duration_seconds
04

Crea accettazione

HTTP 202

POST /api/v1/suno/text_to_music

Schema della risposta
JSON
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    },
    "task_replayed": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "status",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Esempio di risposta

JSON
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "processing"
}
05

Polling in elaborazione

HTTP 200

GET /api/v1/suno/text_to_music/:id

Schema della risposta
JSON
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "duration": {
            "type": "number"
          },
          "id": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "lyrics": {
            "type": "string"
          },
          "model_name": {
            "type": "string"
          },
          "stream_audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "generation_stage": {
      "enum": [
        "text_generated",
        "first_audio_ready"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Esempio di risposta

JSON
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "generation_stage": "text_generated",
  "id": "tsk_reference_demo",
  "status": "processing"
}
06

Polling completato

HTTP 200

GET /api/v1/suno/text_to_music/:id

Schema della risposta
JSON
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "duration": {
            "type": "number"
          },
          "id": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "lyrics": {
            "type": "string"
          },
          "model_name": {
            "type": "string"
          },
          "stream_audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "generation_stage": {
      "enum": [
        "text_generated",
        "first_audio_ready",
        "all_audios_ready",
        "failed"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "audios",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Esempio di risposta

JSON
{
  "audios": [
    {
      "audio_url": "https://file.runapi.ai/reference-audio.mp3",
      "id": "audio_reference"
    }
  ],
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "completed"
}
07

Polling non riuscito

HTTP 200

GET /api/v1/suno/text_to_music/:id

Schema della risposta
JSON
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "error": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Esempio di risposta

JSON
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "error": "Task processing failed.",
  "id": "tsk_reference_demo",
  "status": "failed"
}
08

Callback cliente: in elaborazione

HTTP 200

POST callback_url

Schema della risposta
JSON
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "duration": {
            "type": "number"
          },
          "id": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "lyrics": {
            "type": "string"
          },
          "model_name": {
            "type": "string"
          },
          "stream_audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "generation_stage": {
      "enum": [
        "text_generated",
        "first_audio_ready"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Esempio di risposta

JSON
{
  "generation_stage": "text_generated",
  "id": "tsk_reference_demo",
  "status": "processing"
}
09

Callback cliente: completato

HTTP 200

POST callback_url

Schema della risposta
JSON
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "duration": {
            "type": "number"
          },
          "id": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "lyrics": {
            "type": "string"
          },
          "model_name": {
            "type": "string"
          },
          "stream_audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "generation_stage": {
      "enum": [
        "text_generated",
        "first_audio_ready",
        "all_audios_ready",
        "failed"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "audios"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Esempio di risposta

JSON
{
  "audios": [
    {
      "audio_url": "https://file.runapi.ai/reference-audio.mp3",
      "id": "audio_reference"
    }
  ],
  "id": "tsk_reference_demo",
  "status": "completed"
}
10

Callback cliente: fallito

HTTP 200

POST callback_url

Schema della risposta
JSON
{
  "properties": {
    "error": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "properties": {
            "code": {
              "type": "string"
            },
            "limit_cents": {
              "type": "integer"
            },
            "message": {
              "type": "string"
            },
            "reset_at": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            },
            "used_cents": {
              "type": "integer"
            },
            "window": {
              "enum": [
                "1h",
                "1d",
                "7d",
                "daily",
                "weekly",
                "monthly",
                "lifetime"
              ],
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "type": "object",
          "unevaluatedProperties": false
        }
      ]
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Esempio di risposta

JSON
{
  "error": {
    "code": "generation_failed",
    "message": "Task processing failed."
  },
  "id": "tsk_reference_demo",
  "status": "failed"
}
11

Errori

HTTP 401

POST /api/v1/suno/text_to_music

Schema della risposta
JSON
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Esempio di risposta

JSON
{
  "error": "Authentication required"
}
12

Errori

HTTP 401

GET /api/v1/suno/text_to_music/:id

Schema della risposta
JSON
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Esempio di risposta

JSON
{
  "error": "Authentication required"
}
13

Errori

HTTP 400

POST /api/v1/suno/text_to_music

Schema della risposta
JSON
{
  "oneOf": [
    {
      "properties": {
        "error": {
          "description": "Messaggio di errore leggibile.",
          "type": "string"
        }
      },
      "required": [
        "error"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    {
      "properties": {
        "error": {
          "description": "Riepilogo di convalida leggibile dall'utente.",
          "type": "string"
        },
        "errors": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": "Messaggi di convalida con chiave per campo della richiesta pubblica, con un array di stringhe leggibili dall'utente per ogni campo.",
          "type": "object"
        }
      },
      "required": [
        "error",
        "errors"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  ]
}

Esempio di risposta

JSON
{
  "error": "Validation failed",
  "errors": {
    "prompt": [
      "is required"
    ]
  }
}
14

Errori

HTTP 402

POST /api/v1/suno/text_to_music

Schema della risposta
JSON
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Esempio di risposta

JSON
{
  "error": "Insufficient balance"
}
15

Errori

HTTP 429

POST /api/v1/suno/text_to_music

Schema della risposta
JSON
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Esempio di risposta

JSON
{
  "error": "API key credit limit exceeded"
}
16

Errori

HTTP 409

POST /api/v1/suno/text_to_music

Schema della risposta
JSON
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Esempio di risposta

JSON
{
  "error": "The request uses features that are not supported for the selected model"
}
17

Errori

HTTP 429

POST /api/v1/suno/text_to_music

Schema della risposta
JSON
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Esempio di risposta

JSON
{
  "error": "Rate limit reached. Please retry later."
}
18

Errori

HTTP 503

POST /api/v1/suno/text_to_music

Schema della risposta
JSON
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Esempio di risposta

JSON
{
  "error": "Service under maintenance, please try again later"
}
19

Errori

HTTP 504

POST /api/v1/suno/text_to_music

Schema della risposta
JSON
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Esempio di risposta

JSON
{
  "error": "The request timed out"
}
20

Errori

HTTP 404

GET /api/v1/suno/text_to_music/:id

Schema della risposta
JSON
{
  "properties": {
    "error": {
      "description": "Messaggio di errore leggibile.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Esempio di risposta

JSON
{
  "error": "Task with id 'tsk_reference_demo' not found"
}
21

Esempi di Codice Generati

Usa cURL direttamente, oppure installa un SDK per il tuo linguaggio. Ogni esempio invia la richiesta validata mostrata in questo riferimento.

Installa

Shell
pip install runapi-suno
PYTHON
import os
from runapi.suno import SunoClient

client = SunoClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.text_to_music.create(
  model="suno-v5",
  vocal_mode="auto_lyrics",
  prompt="An uplifting acoustic pop song about a rainy city night.",
  persona_id="persona_reference",
  persona_type="style"
)