# How to send audio file via VaRest?

**URL:** <https://forums.unrealengine.com/t/how-to-send-audio-file-via-varest/2116140>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, api, Blueprint, question\
**Created:** [November 11, 2024, 3:07pm UTC](https://forums.unrealengine.com/t/how-to-send-audio-file-via-varest/2116140 "2024-11-11T15:07:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![santandel](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@santandel](https://forums.unrealengine.com/u/santandel)\
**Post date:** [November 11, 2024, 3:07pm UTC](https://forums.unrealengine.com/t/how-to-send-audio-file-via-varest/2116140/1 "2024-11-11T15:07:08Z")

</div>

Im trying to call python script through the local api (the api was setup through Flask). Inside unreal engine, I created blueprint to record audio when I press 2 and save inside content folder. All I need is how to send recorded audio to that flask api via VaRest and get back response audio to play. I saw lots of tutorial and couldn’t get how to do it. Actually it calls the api link when I release 2 but there is no audio sent via api as python gives error 400. I don’t know which node to connect with which node to send the audio. I’m relatively new to unreal engine, please help me to make this work.

**This is the code I used to test api and it retrieves the response audio as expected**

```auto
import requests

# Define the URL and file path
url = "http://127.0.0.1:5000/process_audio"
file_path = "second.wav"

# Send the audio file to the Flask API
with open(file_path, "rb") as audio_file:
    files = {"audio": audio_file}
    response = requests.post(url, files=files)

# Check if the response was successful
if response.status_code == 200:
    # Save the response as an MP3 file
    with open("response.mp3", "wb") as f:
        f.write(response.content)
    print("Audio response saved as 'response.mp3'.")
else:
    print("Request failed with status:", response.status_code)
    print("Response text:", response.text)

```

**And this is when I tried to recreate the above mechanism in blueprint**

 ![Screenshot 2024-11-10 004650](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/9/3/893ffd0188a3295d72494e39bd5895375a0e04d9.png)  
It actually call API, but the audio is never sent. I getting error like error:400 (bad request) from flask. I searched turorials, forums and couldn’t find anything related to this. Anyone know how to send audio file via VaRest please help me 🙏.

---

<div class="post-metadata">

**Author:** ![Pushpendra718](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pushpendra718](https://forums.unrealengine.com/u/Pushpendra718)\
**Post date:** [April 9, 2025, 3:33am UTC](https://forums.unrealengine.com/t/how-to-send-audio-file-via-varest/2116140/2 "2025-04-09T03:33:18Z")

</div>

hey didi you solve this?
