https://retellai.com/?utm_source=discord&utm_medium=seo logo
why I am getting error 400 when creating a "custom...
# ❓・ai-evy-support
h
@AI Evy why I am getting error 400 when creating a "custom function" despite the API I am using works
a
Thanks for tagging me @hergustone. I'll look through relevant sources and get back to you shortly.
### Answer Error 400 when creating custom functions is typically caused by invalid parameter schema formatting [(1) ]() [(2) ]() [(3) ]() . The most common issue is missing
"type": "object"
at the top level of the JSON schema [(1) ]() [(3) ]() . Your parameter schema should follow this exact format [(3) ]() :
Copy code
json
{
  "type": "object",
  "properties": {
    "city": {
      "type": "string",
      "description": "The city of the weather"
    }
  },
  "required": [
    "city"
  ]
}
[(1) ]() Common troubleshooting steps [(1) ]() [(2) ]() : 1. Add "type": "object" at the top level of your JSON schema [(1) ]() [(3) ]() 2. Remove curly braces from the function name - it should not contain
{{}}
brackets [(2) ]() 3. Use JSON schema format instead of actual JSON data - Retell needs the "shape" of the data, not the actual values 4. Convert your JSON to JSON schema using tools like If your API works externally but fails in Retell, the issue is almost always with the parameter schema format rather than the API endpoint itself [(2) ]() [(3) ]() .
​ To learn more, see the sources I considered: [[1] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) [[2] Custom Function Error 400](https://discord.com/channels/1186424376300679209/1308150652978987129) [[3] 400 error when creating new Custom functions in multi-state agents.](https://discord.com/channels/1186424376300679209/1389298560268374149) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
h
great now I need to send a body in json format @AI Evy