Sonilo API
The Sonilo API turns video or text into music. Generation endpoints stream their output as NDJSON over a single HTTPS connection; account endpoints return ordinary JSON.
Authentication
The Sonilo API authenticates requests with API keys. Generate and manage keys from the API Keys page. Keys begin with sk_ and are shown once at creation — copy them immediately. Pass the key as a Bearer token on every request:
curl https://api.sonilo.com/v1/account/services \
-H "Authorization: Bearer sk_your_api_key_here"Treat keys like passwords: keep them server-side and load them from environment variables — never commit them or ship them in client code. If a key is exposed, revoke it on the API Keys page and create a new one. Revoked keys take effect immediately and return 401 on any subsequent request.
Base URL
All API requests share a single base URL:
https://api.sonilo.com/v1Endpoint paths in this reference are relative to this base. The API is served only over HTTPS — plain HTTP requests are rejected.
Headers
Every request must include an Authorization header. Generation endpoints additionally require a Content-Type:
Authorization: Bearer sk_…— required on every request.Content-Type: multipart/form-data— for the generation endpoints/v1/text-to-musicand/v1/video-to-music, which take form fields and file uploads. Account endpoints areGETrequests with no body.
Core endpoints
Sonilo exposes two generation endpoints and two account endpoints. Follow any path below for the full request and response reference.
Response format
Account endpoints return a single application/json response. Generation endpoints return an application/x-ndjson stream — one JSON object per line, each carrying a type field. Read the body line by line and parse each line independently.
Generation streams use a small, stable set of event types:
title— generated track title; emitted once per stream.audio_chunk— base64-encoded audio fragment. Group chunks bystream_indexand concatenate in order.complete— the stream finished successfully.error— generation failed; carriescodeandmessage.
See the Video to Music reference for the full event schema.
Errors
All errors return a JSON body with a code and message. The HTTP status indicates the failure class:
| Code | Condition |
|---|---|
| 400 | Invalid input (missing video, both video and video_url provided, unsafe URL) |
| 401 | Invalid or missing API key |
| 402 | Account suspended or credit limit exceeded |
| 413 | File too large |
| 422 | Video duration exceeds 6 minutes or ffprobe failed |
| 429 | Rate limit exceeded |
| 502 | Upstream processing error |
Rate limits
Your account has shared rate limits that apply across all generation endpoints. Default limits for the standard tier are shown below.
- Requests per minute (RPM): 60
- Max concurrent tasks: 5
See Settings for your account's actual limits.
- Exceeding rate limits returns
429 Too Many Requests - Exceeding file size returns
413 Request Entity Too Large - Exceeding video duration returns
422 Unprocessable Entity
Next steps
Follow the Quickstart to make your first request in five minutes, then jump into the Video to Music reference.