> ## Documentation Index
> Fetch the complete documentation index at: https://docs.camb.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Sound and Music Run Result

> Retrieve the generated audio file for a completed Sound and Music task.

This endpoint retrieves the audio output generated from a previously completed Sound and Music task. It provides access to the audio content that was created based on the text prompt and configuration specified in your original request based on returned `run_id`.

The endpoint supports two different response formats based on your needs:

### Audio Stream (Default)

Returns the raw audio bytes of your generated sound effect in WAV format. This is ideal for:

* Direct playback in browser applications
* Immediately saving the audio to your local system
* Streaming the audio to users in real-time applications

### Download URL

**Content-Type: application/json**

Returns a JSON object containing a URL where the generated audio file can be downloaded:

```json theme={null}
{
  "file_url": "https://storage.example.com/text-to-sound/your-generated-file.wav"
}
```

This option is useful when you prefer to:

* Defer the actual download to a later time
* Share the audio file with others via a link
* Implement custom download behavior in your application

## Example Usage

### Retrieving Audio as a Stream

```bash theme={null}
curl -X GET "https://client.camb.ai.com/text-to-sound-result/run_abc123" \
  -H "x-api-key: YOUR_API_KEY" \
  --output my_sound_effect.wav
```

### Retrieving a Download URL

```bash theme={null}
curl -X GET "https://client.camb.ai.com/text-to-sound-result/run_abc123" \
  -H "x-api-key: YOUR_API_KEY"
```

Response:

```json theme={null}
{
  "file_url": "https://storage.example.com/sounds/abc123.wav"
}
```

## Best Practices

To get the most from this endpoint:

1. **Check Task Status First**: Only request results for tasks that have completed successfully.
2. **Handle Audio Appropriately**: The returned WAV format is widely compatible but may need conversion for specific use cases.
3. **Download Promptly**: Temporary URLs may expire after a certain period, so download and store important files.

## Technical Considerations

* The generated audio files are delivered in WAV format which provides high quality but larger file sizes.
* If the specified `run_id` doesn't exist or hasn't completed processing, you'll receive an appropriate error response.

By integrating this endpoint with your audio production workflow, you can seamlessly access AI-generated sound effects created from text descriptions, enabling new creative possibilities for your projects.


## OpenAPI

````yaml get /text-to-sound-result/{run_id}
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://client.camb.ai/apis
security: []
paths:
  /text-to-sound-result/{run_id}:
    get:
      tags:
        - Apis
        - Text-to-Audio
      summary: Get Sound and Music Run Result
      operationId: get_text_to_audio_result_text_to_audio_result__run_id__get
      parameters:
        - name: run_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/RunIDParam'
          description: >-
            The unique identifier for the run, which was generated during the
            text to an audio effect creation process and returned upon task
            completion.
      responses:
        '200':
          description: Successful Response
          content:
            audio/wav:
              schema:
                type: string
                format: binary
                contentEncoding: base64
                description: >-
                  The generated audio file bytes in WAV format, representing the
                  audio effect created from the provided text prompt.
            application/json:
              schema:
                $ref: '#/components/schemas/AudioOutputFileURLResponse'
                description: >-
                  A JSON that contains a presigned URL that points to the
                  generated audio effect WAV file.
      security:
        - APIKeyHeader: []
components:
  schemas:
    RunIDParam:
      type: integer
      title: Run ID
      description: >-
        The unique identifier for the run, which was generated during the
        creation process and returned upon task completion.
    AudioOutputFileURLResponse:
      type: object
      properties:
        output_url:
          title: Output URL
          type: string
          description: A presigned URL that points to the output audio file.
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        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.

````