Webhooks
Create webhook subscription
Not verified
POST /api/v1/org/webhook-subscriptions
signingSecret is returned once — store it. Events: email.opened, email.clicked, email.bounced, email.failed, InboundMessageReceived, Unsubscribe, CampaignSent.
Body Parameters
endpointstring required
eventsstring[] required
Errors Standard errors apply — see Errors .
Snippets use the MailCraftApi (C#) and MailCraft (Python) helpers from Introduction → Helpers .
using System.Text.Json.Nodes;
using var mc = new MailCraftApi(Environment.GetEnvironmentVariable("MAILCRAFT_API_KEY")!);
var body = JsonNode.Parse("""
{
"endpoint": "https://example.com/webhooks/mailcraft",
"events": [
"email.opened",
"email.bounced"
]
}
""");
JsonNode? result = await mc.SendAsync(HttpMethod.Post, "/org/webhook-subscriptions", body);
Console.WriteLine(result?.ToJsonString(MailCraftApi.Pretty) ?? "(no content)");import os
from mailcraft import MailCraft
mc = MailCraft(os.environ["MAILCRAFT_API_KEY"])
body = {'endpoint': 'https://example.com/webhooks/mailcraft',
'events': ['email.opened', 'email.bounced']}
result = mc.request("POST", "/org/webhook-subscriptions", json=body)
print(result)curl -X POST "https://mailcraft.example.com/api/v1/org/webhook-subscriptions" \
-H "Authorization: Bearer $MAILCRAFT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"endpoint": "https://example.com/webhooks/mailcraft", "events": ["email.opened", "email.bounced"]}'
Response
⚠ Not yet verified. No live response has been recorded for this endpoint, so no example is shown.