Quickstart
Make your first Sonilo API request in under five minutes.
1. Get an API key
Open the API Keys page and create a new key. Copy it — the secret value is shown once.
2. Make your first request
The shortest path is text-to-music: pass a prompt and a duration in seconds. The response is an NDJSON stream — read it line by line.
curl -N -X POST https://api.sonilo.com/v1/text-to-music \
-H "Authorization: Bearer sk_your_api_key" \
-F "prompt=lofi hiphop beat" \
-F "duration=30"3. Parse the NDJSON stream
Each line is a JSON object with a type field. The stream finishes successfully when you receive a complete event; if you see error, the request failed.
Sample stream
{"type":"title","title":"Ethereal Pulse"}
{"type":"audio_chunk","stream_index":0,"num_streams":1,"data":"<base64>"}
{"type":"audio_chunk","stream_index":0,"num_streams":1,"data":"<base64>"}
{"type":"complete"}4. Next steps
Try the streaming Video to Music endpoint, or jump back to the Errors section to learn how to handle failures and rate limits.