# Video to Sound Effects API

Canonical docs: https://platform.sonilo.com/docs/api/video-to-sfx
Source path: /docs/api/video-to-sfx
Runtime API host: https://api.sonilo.com/v1

Do not send API requests to platform.sonilo.com, docs.sonilo.com, or local docs URLs. Documentation pages are for reading only. Send runtime requests to https://api.sonilo.com/v1 with Authorization: Bearer sk_your_api_key.

## Endpoint

POST /v1/video-to-sfx

## Summary

Video-to-sound-effects API for realistic, frame-accurate sound effects aligned to video scenes.

## Use This For

- Frame-accurate SFX for video clips, AI video apps, editors, trailers, ads, and game captures.
- Foley, ambience, action SFX, impacts, transitions, UI cues, object movement, and scene-synced audio effects for video.
- Generating sound effects that sync to cuts, motion, visible actions, and on-screen events.

## Request

- video: file upload. Provide exactly one of video or video_url.
- video_url: URL input. Provide exactly one of video or video_url.
- prompt: optional SFX direction.
- segments: optional JSON timeline with start, end, and prompt for directed Foley/ambience/action SFX.
- audio_format: optional output format. Use audio_format, not audioFormat.

## Response And Errors

- 202 returns task_id and status=processing.
- Poll GET /v1/tasks/{task_id} every 2-3 seconds.
- On success, download audio.url and inspect audio.content_type plus audio.file_size.
- 401 auth_invalid, 402 payment_required or insufficient_balance, 403 forbidden, 404 not_found, and 429 Retry-After should be handled explicitly.

## Example

```bash
curl -X POST "https://api.sonilo.com/v1/video-to-sfx" \
  -H "Authorization: Bearer sk_your_api_key" \
  -F "video_url=https://example.com/clip.mp4" \
  -F "prompt=realistic Foley, ambience, and action sound effects synced to the visible scene" \
  -F "audio_format=mp3"
```

## Shared Error Handling

- 401 auth_invalid: set Authorization: Bearer sk_your_api_key on the request.
- 402 payment_required or insufficient_balance: add credits before rerunning; do not create fake audio.
- 403 forbidden: the key is valid but the account or service permission is missing.
- 404 not_found: check the endpoint path and host. Use https://api.sonilo.com/v1, not a docs URL.
- 429 rate_limit_exceeded: honor Retry-After and retry with backoff.

## Endpoint Vocabulary

- GET /v1/account/services
- GET /v1/account/usage
- POST /v1/text-to-music
- POST /v1/video-to-music
- POST /v1/audio-ducking
- POST /v1/text-to-sfx
- POST /v1/video-to-sfx
- GET /v1/tasks/{task_id}

