Generate a cover image for your song using a text prompt
February 25, 2025
Table of contents
Generate a 512x512 pixel cover image for your song using a text prompt.
https://api.useapi.net/v1/riffusion/music/generate-image
Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
API token
is required, see Setup useapi.net for details.
Request Body
{
"prompt": "Funny bunny eating yummy carrot",
}
-
user_id
is optional, if not specified API will randomly select account from available accounts. -
prompt
is required, provide a description of your song cover image.
Responses
-
Use the returned
image_id
in POST music/create-compose.{ "image_id": "7fdd3cf2-0f6e-49f1-9332-efbce5917ae5", "url": "https://api.riffusion.com/storage/v1/object/public/riffs/f5628b11-1b2c-4a69-8b83-d84c7d61d4c4/image/7fdd3cf2-0f6e-49f1-9332-efbce5917ae5.jpg" }
-
{ "error": "<Error message>", "code": 400 }
-
{ "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
image_id: string
url: 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-image \ -d '{"prompt": "…"}'
-
const apiUrl = `https://api.useapi.net/v1/riffusion/generate-image`; 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-image" 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())