How It Works
The endpoint processes an array of run IDs and returns corresponding results for each completed task. This batch approach offers several advantages over making individual requests for each result: Efficiency Benefits:- Reduces the number of HTTP requests needed
- Minimizes network overhead when fetching multiple results
- Simplifies client-side code for handling multiple audio files
- Provides better performance for applications processing many audio generations
- Batch processing of multiple text-to-sound requests
- Building audio libraries from multiple text prompts
- Creating soundtracks or audio collections
- Processing results from parallel text-to-sound tasks
Request Format
The endpoint expects a JSON payload containing an array of run IDs that you want to retrieve results for:Response Structure
The response contains an array of results, where each item corresponds to one of the requested run IDs. Each result includes a presigned URL that points directly to the generated audio file:Example Usage
Basic Bulk Request
Processing the Response
Error Handling and Status Management
When working with bulk requests, itβs important to understand that individual tasks within your batch may have different statuses. The endpoint will return results for all requested run IDs, but some may not be ready yet or may have encountered errors. Best Practices for Error Handling:- Always check the status field for each result before attempting to use the output URL
- Handle failed tasks gracefully with appropriate user feedback
- Store successful results promptly as URLs may expire
Workflow Integration
This bulk endpoint fits naturally into larger audio processing workflows. Consider this typical pattern:- Initiate Multiple Tasks: Submit several text-to-sound requests using the creation endpoint
- Store Run IDs: Keep track of all returned run IDs from your requests
- Process Completed Results: Download and handle audio files for completed tasks
- Retry or Handle Failures: Manage any failed tasks or retry processing tasks
Technical Considerations
File Format and Quality: The generated audio files are delivered in WAV format, providing high audio quality suitable for professional applications. Keep in mind that WAV files are larger than compressed formats but offer the best fidelity for your generated sound effects. URL Expiration: The presigned URLs returned in the response are temporary and will expire after a certain period. Make sure to download and store important audio files promptly to avoid losing access to your generated content. Rate Limiting: While this endpoint allows bulk retrieval, be mindful of the fact that this endpoint allows providing a maximum of 5 run IDs per request. The bulk approach is more efficient than individual requests, but extremely large batches should be broken down into manageable chunks. Memory and Storage: When downloading multiple audio files, consider the memory and storage requirements on your system. Implement appropriate streaming or chunked download strategies for large batches to avoid overwhelming your applicationβs resources. By leveraging this bulk results endpoint, you can build more efficient applications that handle multiple text-to-sound generations seamlessly, enabling creative workflows that scale with your audio production needs.Authorizations
The x-api-key
is a custom header required for authenticating requests to our API. Include this header in your request with the appropriate API key value to securely access our endpoints. You can find your API key(s) in the 'API' section of our studio website.
Body
An array of unique positive integers, each representing the ID of a specific run. You must provide between 2 and 5 IDs, and all IDs must correspond to the same run type (e.g., all text-to-speech or all dubbing runs).
2 - 5
elements[12345, 6789]
Response
Successful Response
An object containing the results of one to five text-to-sound runs. Each key in the object is a unique identifier for a run, and the corresponding value is the output for text-to-sound.