https://retellai.com/?utm_source=discord&utm_medium=seo logo
how can I send a json body in a post request when ...
# ❓・ai-evy-support
h
@AI Evy how can I send a json body in a post request when creating a "custom function"
a
Thanks for tagging me @hergustone. I'll look through relevant sources and get back to you shortly.
### Answer To send a JSON body in a POST request when creating a custom function in Retell AI, you need to define parameters using JSON schema format [(1) ]() [(2) ]() . When you create a custom function, Retell automatically sends the parameters as a JSON body in the request to your endpoint . Here's how it works: 1. Define parameters using JSON schema format . For example:
Copy code
json
{
 "type": "object",
 "properties": {
 "city": {
 "type": "string",
 "description": "The city of the weather"
 }
 },
 "required": [
 "city"
 ]
}
2. Select POST as your HTTP method when configuring the custom function . 3. Retell automatically sends the request with the following structure : - Header:
Content-Type: application/json
- Body contains:
name
,
call
, and
args
as JSON The
args
field in the JSON body will contain the parameters you defined in your schema . Parameters are only available for POST, PATCH, and PUT requests . **Important note**: Make sure your endpoint URL doesn't have a trailing slash, as this can cause issues with POST requests being converted to GET requests [(3) ]() .
​ To learn more, see the sources I considered: [[1] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) [[2] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) [[3] Custom Tool Function Call sends a "GET" from Retell to my URL and not a "POST" . Empty request body.](https://discord.com/channels/1186424376300679209/1284824056801132678) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.