Generate or update lyrics based on prompt

February 20, 2025

Table of contents

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

This is the same as the Ghostwriter feature you see on the Riffusion website.

https://api.useapi.net/v1/riffusion/music/generate-lyrics

Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
Request Body
{
    "prompt": "humorous song about a time-traveling pizza slice who embarks on a wild, cheesy adventure to save the world with its quirky charm",
}
  • user_id is optional, if not specified API will randomly select account from available accounts.

  • prompt is required, enter a topic or general direction for your lyrics.

  • lyrics is optional, you can provide existing lyrics that you want to transform using the provided prompt, e.g., translate them into the language of your choice.

Responses
  • 200 OK

    {
        "lyrics": "…generated lyrics…",
    }
    
  • 400 Bad Request

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

    {
      "error": "Unauthorized",
      "code": 401
    }
    
  • 596 Pending error

    API was unable to refresh your cookie. Please resolve this issue by using the POST accounts endpoint before making any new API calls.

    {
      "error": "Your Riffusion account has pending error. Please address this issue at https://useapi.net/docs/api-riffusion-v1/post-riffusion-accounts before making any new API calls."
    }
    
Model
{   // TypeScript, all fields are optional
    lyrics: string
    error: string
    code: number
}
Examples
  • curl -H "Accept: application/json" \
         -H "Content-Type: application/json" \
         -H "Authorization: Bearer …" \
         -X POST https://api.useapi.net/v1/riffusion/generate-lyrics \
         -d '{"prompt": "…"}'
    
  • const apiUrl = `https://api.useapi.net/v1/riffusion/generate-lyrics`; 
    const api_token = "API token";
    const prompt = "Your prompt goes here";      
    const data = { 
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${api_token}`,
        'Content-Type': 'application/json' }
    };
    data.body = JSON.stringify({ 
      prompt
    });
    const response = await fetch(apiUrl, data);
    const result = await response.json();
    console.log("response", {response, result});
    
  • import requests
    apiUrl = f"https://api.useapi.net/v1/riffusion/generate-lyrics" 
    api_token = "API token"
    prompt = "Your prompt goes here"
    headers = {
        "Content-Type": "application/json", 
        "Authorization" : f"Bearer {api_token}"
    }
    body = {
        "prompt": f"{prompt}"
    }
    response = requests.post(apiUrl, headers=headers, json=body)
    print(response, response.json())
    
Try It