https://retellai.com/?utm_source=discord&utm_medium=seo logo
im getting and error code 400 when trying to add a...
# ❓・ai-evy-support
a
@AI Evy im getting and error code 400 when trying to add a custom function please assist
a
Thanks for tagging me @azaar_44183. I'll look through relevant sources and get back to you shortly.
### Answer A 400 error when adding a custom function typically indicates that the function payload doesn't match the expected schema. [(1) ]() Common causes: 1. Invalid JSON schema - Ensure your parameters include
"type": "object"
at the top level. [(2) ]() Your schema should follow this format:
Copy code
json
{
  "type": "object",
  "properties": {
    "city": {
      "type": "string",
      "description": "City to look up."
    },
    "units": {
      "type": "string",
      "enum": ["metric", "imperial"]
    }
  },
  "required": ["city"]
}
2. JSON syntax errors - Check for trailing commas, incorrect syntax, and ensure the name, tool_id, and url are properly formatted. [(1) ]() 3. Missing required fields - Verify all required fields are included in your function configuration. To resolve: - Review the [Custom Function documentation]() to ensure you're following the correct format [(3) ]() - Validate your JSON syntax - Confirm your parameter schema matches the expected structure If the issue persists after checking these items, please share your function configuration (without sensitive data) so we can identify the specific problem.
​ To learn more, see the sources I considered: [[1] 400 error when adding a function to a conversation flow](https://discord.com/channels/1186424376300679209/1411008678487916646) [[2] 400 error when creating new Custom functions in multi-state agents.](https://discord.com/channels/1186424376300679209/1389298560268374149) [[3] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.