Add a webhook endpoint
const url = 'https://api.duta.indra.sh/v1/webhooks';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"endpoint":"https://example.com","url":"https://example.com","events":["email.sent"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.duta.indra.sh/v1/webhooks \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "endpoint": "https://example.com", "url": "https://example.com", "events": [ "email.sent" ] }'Events: email.sent, email.delivered, email.bounced, email.complained, email.failed, email.delivery_delayed, email.opened, email.clicked. Up to 10 endpoints.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
A public https URL
The same as endpoint, under Duta’s original spelling
Leave out or empty for every event
Responses
Section titled “ Responses ”Success
object
Whsec_ secret for verifying deliveries. Shown once
The same as signing_secret
ISO 8601
Example
{ "object": "webhook"}Missing or invalid API key
object
The Resend error name, so code that branches on it keeps working
Duta’s error code, finer grained than name
object
Find this request on the Logs screen
Example
{ "code": "unauthorized"}The key has sending access only
object
The Resend error name, so code that branches on it keeps working
Duta’s error code, finer grained than name
object
Find this request on the Logs screen
Example
{ "code": "unauthorized"}The request was refused. code says why
object
The Resend error name, so code that branches on it keeps working
Duta’s error code, finer grained than name
object
Find this request on the Logs screen
Example
{ "code": "unauthorized"}Rate limited. Retry after the Retry-After header
object
The Resend error name, so code that branches on it keeps working
Duta’s error code, finer grained than name
object
Find this request on the Logs screen
Example
{ "code": "unauthorized"}