Description
When attempting to create a webhook via the AgentMail API, the request fails with a validation error indicating that the event_types field is required but missing from the API documentation and examples.
Error Details
{
"name": "ValidationError",
"errors": [
{
"expected": "array",
"code": "invalid_type",
"path": ["event_types"],
"message": "Invalid input: expected array, received undefined"
}
]
}
Steps to Reproduce
- Follow the setup instructions in the sales-agent README
- Execute the webhook creation command:
curl -X POST https://api.agentmail.to/v0/webhooks \
-H "Authorization: Bearer $AGENTMAIL_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"url\": \"https://$WEBHOOK_DOMAIN/webhooks\"
}"
Expected Behavior
The webhook should be created successfully with just the url parameter as shown in the documentation.
Actual Behavior
The API returns a validation error requiring an event_types field that is not documented or provided in the example.
Environment
- API Version: v0
- Endpoint:
/v0/webhooks
- Method: POST
Documentation Issue
The current documentation shows:
{
"url": "https://$WEBHOOK_DOMAIN/webhooks"
}
But the API appears to require:
{
"url": "https://$WEBHOOK_DOMAIN/webhooks",
"event_types": ["email_received", "email_sent"]
}
Request
Please either:
- Update the documentation to include the required
event_types field with example values
- Make the
event_types field optional if it's not always required
- Provide clear error messages that specify which fields are required
Additional Context
This affects the sales-agent example setup process and prevents users from completing the webhook configuration step.
Labels
bug api documentation webhook