Preview: SendMock has no stable release yet. These docs follow develop.

API reference

Webhook templates

POST/api/v1/webhooks/templates

Add a custom template, starting as native JSON.

CLI
sendmock webhook template create
MCP tool
sendmock_webhook_template_create
In the app
Webhooks > Templates > New template

Request body (application/json)

TemplateCreateRequest : Body of POST /api/v1/webhooks/templates (a new blank custom template).

FieldTypeDescription
namestring
The name of the new blank custom template.Example: Order webhook

Answer

201 WebhookTemplateSummary

Errors: 400, as { error: { code, message } }

Try it in Demo mode

PATCH/api/v1/webhooks/templates/{templateId}

Edit a template; each save keeps a revision, 422 when it does not render.

CLI
sendmock webhook template update <templateId>
MCP tool
sendmock_webhook_template_update
In the app
Webhooks > Templates > template > Edit, Save template

Request body (application/json)

TemplateUpdate : Body of PATCH /api/v1/webhooks/templates/{templateId}; metadata is ignored for built-ins.

FieldTypeDescription
name?string
The template's name.Example: Order webhook
description?string
What the template sends and where.Example: Posts each received email to the orders app.
events?AppEventType[]
The event types the template is made for.One of: email.received, email.inbound, email.opened, email.clicked, email.delivered, email.deferred, email.bounced, email.complained, email.unsubscribed, email.released, email.deleted, sms.sent, sms.status, sms.opened, sms.inbound, sms.reply_webhook, verify.started, verify.checked, verify.expired, push.sent, push.failed, http.captured, payment.created, payment.authorized, payment.succeeded, payment.failed, payment.canceled, payment.refunded, payment.partially_refunded, payment.dispute_opened, payment.dispute_updated, payment.dispute_closed, checkout.completed, checkout.expired, subscription.created, subscription.renewed, subscription.payment_failed, subscription.canceled, webhook.delivered, webhook.failed, test.ping, traffic.pruned
required_variables?string[]
Variables an endpoint must define to use it.
methodHttpMethod
The HTTP method.One of: GET, POST, PUT, PATCH, DELETEExample: POST
content_typestring
The body's content type.Example: application/json
header_templatesobject
Header name to a template, e.g. "X-Twilio-Signature": "{{ twilio_signature(...) }}".
body_templatestring
The body, a template over the event, its data and the variables.Example: {"subject": "{{ data.subject }}"}

Answer

200 WebhookTemplateDetail

Errors: 400, 404, 409, 422, as { error: { code, message } }

Try it in Demo mode

POST/api/v1/webhooks/templates/import

Import a template file; 409 when the id is taken.

CLI
sendmock webhook template import <file>
MCP tool
sendmock_webhook_template_import
In the app
Webhooks > Templates > Import a template

Request body (application/json)

TemplateImportRequest : Body of POST /api/v1/webhooks/templates/import.

FieldTypeDescription
file_textstring
The template file's text, TOML or JSON as exported.Example: id = "custom.order_webhook" name = "Order webhook"
on_conflict?"replace" | "copy"
What to do when the id is taken; left out, the API answers 409.One of: replace, copyExample: copy

Answer

201 WebhookTemplateSummary

Errors: 409, 422, as { error: { code, message } }

Try it in Demo mode

POST/api/v1/webhooks/templates/{templateId}/render

Render against an email, an SMS or the sample, optionally a draft.

CLI
sendmock webhook template render <templateId>
MCP tool
sendmock_webhook_template_render
In the app
Webhooks > Templates > template > Preview

Request body (application/json)

TemplateRenderRequest : Body of POST /api/v1/webhooks/templates/{templateId}/render; empty for the sample.

FieldTypeDescription
email_id?Ulid
Render against this email; with no IDs the sample event is used.Example: 01JB7T9Q2R5W8X3Y6Z1A4B7C9D
sms_id?Ulid
Render against this SMS.Example: 01JB7T9Q2R5W8X3Y6Z1A4B7C9D
http_request_id?Ulid
A captured HTTP request, as the data of an http.captured event.Example: 01JB7T9Q2R5W8X3Y6Z1A4B7C9D
payment_id?Ulid
A payment, as the data of the event its latest state stands for.Example: 01JB7T9Q2R5W8X3Y6Z1A4B7C9D
draft?TemplateDraft
Unsaved edits to preview instead of the stored template.

Answer

200 TemplateRenderResult

Errors: 404, as { error: { code, message } }

Try it in Demo mode

POST/api/v1/webhooks/templates/{templateId}/clone

Copy a template into a new custom one.

CLI
sendmock webhook template clone <templateId>
MCP tool
sendmock_webhook_template_clone
In the app
Webhooks > Templates > template > Clone

Request body (application/json)

TemplateCloneRequest : Body of POST /api/v1/webhooks/templates/{templateId}/clone.

FieldTypeDescription
namestring
The name of the copy.Example: Slack alerts (team)

Answer

201 WebhookTemplateSummary

Errors: 400, 404, as { error: { code, message } }

Try it in Demo mode