Webhooks
Resend Webhook
Queues a test delivery of a given event to the webhook’s URL. The webhook must be subscribed to the supplied event.
POST
/
webhooks
/
{id}
/
resend
curl --request POST \
--url https://api.autosend.com/v1/webhooks/60d5ec49f1b2c72d9c8b1234/resend \
--header 'Authorization: Bearer AS_your-api-key' \
--header 'Content-Type: application/json' \
--data '{
"event": "email.delivered",
"data": {
"messageId": "msg_abc123",
"to": "[email protected]"
}
}'
import requests
webhook_id = "60d5ec49f1b2c72d9c8b1234"
url = f"https://api.autosend.com/v1/webhooks/{webhook_id}/resend"
headers = {
"Authorization": "Bearer AS_your-api-key",
"Content-Type": "application/json"
}
payload = {
"event": "email.delivered",
"data": {
"messageId": "msg_abc123",
"to": "[email protected]"
}
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const webhookId = '60d5ec49f1b2c72d9c8b1234';
fetch(`https://api.autosend.com/v1/webhooks/${webhookId}/resend`, {
method: 'POST',
headers: {
'Authorization': 'Bearer AS_your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
event: 'email.delivered',
data: {
messageId: 'msg_abc123',
to: '[email protected]'
}
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$webhookId = '60d5ec49f1b2c72d9c8b1234';
$url = "https://api.autosend.com/v1/webhooks/{$webhookId}/resend";
$data = [
'event' => 'email.delivered',
'data' => [
'messageId' => 'msg_abc123',
'to' => '[email protected]'
]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer AS_your-api-key',
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
webhookID := "60d5ec49f1b2c72d9c8b1234"
url := "https://api.autosend.com/v1/webhooks/" + webhookID + "/resend"
payload := map[string]interface{}{
"event": "email.delivered",
"data": map[string]string{
"messageId": "msg_abc123",
"to": "[email protected]",
},
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer AS_your-api-key")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class ResendWebhook {
public static void main(String[] args) {
try {
String webhookId = "60d5ec49f1b2c72d9c8b1234";
URL url = new URL("https://api.autosend.com/v1/webhooks/" + webhookId + "/resend");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "Bearer AS_your-api-key");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
String jsonInputString = "{\n" +
" \"event\": \"email.delivered\",\n" +
" \"data\": { \"messageId\": \"msg_abc123\", \"to\": \"[email protected]\" }\n" +
"}";
try (OutputStream os = con.getOutputStream()) {
byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
int status = con.getResponseCode();
System.out.println("Response Status: " + status);
} catch (Exception e) {
e.printStackTrace();
}
}
}
require 'net/http'
require 'json'
require 'uri'
webhook_id = '60d5ec49f1b2c72d9c8b1234'
uri = URI("https://api.autosend.com/v1/webhooks/#{webhook_id}/resend")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path)
request['Authorization'] = 'Bearer AS_your-api-key'
request['Content-Type'] = 'application/json'
request.body = {
event: 'email.delivered',
data: { messageId: 'msg_abc123', to: '[email protected]' }
}.to_json
response = http.request(request)
puts response.body
{
"success": true,
"message": "Webhook queued for delivery",
"data": {
"jobId": "12345"
}
}
This endpoint accepts a project API key (
AS_ prefix). It queues a test delivery of the supplied event to the webhook’s URL. The webhook must already be subscribed to that event.curl --request POST \
--url https://api.autosend.com/v1/webhooks/60d5ec49f1b2c72d9c8b1234/resend \
--header 'Authorization: Bearer AS_your-api-key' \
--header 'Content-Type: application/json' \
--data '{
"event": "email.delivered",
"data": {
"messageId": "msg_abc123",
"to": "[email protected]"
}
}'
import requests
webhook_id = "60d5ec49f1b2c72d9c8b1234"
url = f"https://api.autosend.com/v1/webhooks/{webhook_id}/resend"
headers = {
"Authorization": "Bearer AS_your-api-key",
"Content-Type": "application/json"
}
payload = {
"event": "email.delivered",
"data": {
"messageId": "msg_abc123",
"to": "[email protected]"
}
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const webhookId = '60d5ec49f1b2c72d9c8b1234';
fetch(`https://api.autosend.com/v1/webhooks/${webhookId}/resend`, {
method: 'POST',
headers: {
'Authorization': 'Bearer AS_your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
event: 'email.delivered',
data: {
messageId: 'msg_abc123',
to: '[email protected]'
}
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$webhookId = '60d5ec49f1b2c72d9c8b1234';
$url = "https://api.autosend.com/v1/webhooks/{$webhookId}/resend";
$data = [
'event' => 'email.delivered',
'data' => [
'messageId' => 'msg_abc123',
'to' => '[email protected]'
]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer AS_your-api-key',
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
webhookID := "60d5ec49f1b2c72d9c8b1234"
url := "https://api.autosend.com/v1/webhooks/" + webhookID + "/resend"
payload := map[string]interface{}{
"event": "email.delivered",
"data": map[string]string{
"messageId": "msg_abc123",
"to": "[email protected]",
},
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer AS_your-api-key")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class ResendWebhook {
public static void main(String[] args) {
try {
String webhookId = "60d5ec49f1b2c72d9c8b1234";
URL url = new URL("https://api.autosend.com/v1/webhooks/" + webhookId + "/resend");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "Bearer AS_your-api-key");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
String jsonInputString = "{\n" +
" \"event\": \"email.delivered\",\n" +
" \"data\": { \"messageId\": \"msg_abc123\", \"to\": \"[email protected]\" }\n" +
"}";
try (OutputStream os = con.getOutputStream()) {
byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
int status = con.getResponseCode();
System.out.println("Response Status: " + status);
} catch (Exception e) {
e.printStackTrace();
}
}
}
require 'net/http'
require 'json'
require 'uri'
webhook_id = '60d5ec49f1b2c72d9c8b1234'
uri = URI("https://api.autosend.com/v1/webhooks/#{webhook_id}/resend")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path)
request['Authorization'] = 'Bearer AS_your-api-key'
request['Content-Type'] = 'application/json'
request.body = {
event: 'email.delivered',
data: { messageId: 'msg_abc123', to: '[email protected]' }
}.to_json
response = http.request(request)
puts response.body
{
"success": true,
"message": "Webhook queued for delivery",
"data": {
"jobId": "12345"
}
}
Authorizations
Project API key header of the form Bearer
AS_<key>.Path Parameters
The unique identifier of the webhook.Example:
"60d5ec49f1b2c72d9c8b1234"Body
The event type to deliver. Must be one the webhook is subscribed to.Example:
"email.delivered"The event payload that will be wrapped and POSTed to the webhook URL.Example:
{ "messageId": "msg_abc123", "to": "[email protected]" }Response
Webhook queued for delivery (200)Indicates if the request was successful
Wrapper containing the queued job reference
Show child attributes
Show child attributes
The queue job ID for the delivery attempt
Error Responses
Returned when the webhook is not subscribed to the supplied event.
{
"success": false,
"error": {
"message": "Webhook is not subscribed to this event: email.delivered",
"code": "WEBHOOK_NOT_SUBSCRIBED",
}
}
Returned when no webhook with the given ID exists in the project.
{
"success": false,
"error": {
"message": "Webhook not found",
"code": "WEBHOOK_NOT_FOUND",
}
}
Related topics
Was this page helpful?
⌘I
curl --request POST \
--url https://api.autosend.com/v1/webhooks/60d5ec49f1b2c72d9c8b1234/resend \
--header 'Authorization: Bearer AS_your-api-key' \
--header 'Content-Type: application/json' \
--data '{
"event": "email.delivered",
"data": {
"messageId": "msg_abc123",
"to": "[email protected]"
}
}'
import requests
webhook_id = "60d5ec49f1b2c72d9c8b1234"
url = f"https://api.autosend.com/v1/webhooks/{webhook_id}/resend"
headers = {
"Authorization": "Bearer AS_your-api-key",
"Content-Type": "application/json"
}
payload = {
"event": "email.delivered",
"data": {
"messageId": "msg_abc123",
"to": "[email protected]"
}
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const webhookId = '60d5ec49f1b2c72d9c8b1234';
fetch(`https://api.autosend.com/v1/webhooks/${webhookId}/resend`, {
method: 'POST',
headers: {
'Authorization': 'Bearer AS_your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
event: 'email.delivered',
data: {
messageId: 'msg_abc123',
to: '[email protected]'
}
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$webhookId = '60d5ec49f1b2c72d9c8b1234';
$url = "https://api.autosend.com/v1/webhooks/{$webhookId}/resend";
$data = [
'event' => 'email.delivered',
'data' => [
'messageId' => 'msg_abc123',
'to' => '[email protected]'
]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer AS_your-api-key',
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
webhookID := "60d5ec49f1b2c72d9c8b1234"
url := "https://api.autosend.com/v1/webhooks/" + webhookID + "/resend"
payload := map[string]interface{}{
"event": "email.delivered",
"data": map[string]string{
"messageId": "msg_abc123",
"to": "[email protected]",
},
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer AS_your-api-key")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class ResendWebhook {
public static void main(String[] args) {
try {
String webhookId = "60d5ec49f1b2c72d9c8b1234";
URL url = new URL("https://api.autosend.com/v1/webhooks/" + webhookId + "/resend");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "Bearer AS_your-api-key");
con.setRequestProperty("Content-Type", "application/json");
con.setDoOutput(true);
String jsonInputString = "{\n" +
" \"event\": \"email.delivered\",\n" +
" \"data\": { \"messageId\": \"msg_abc123\", \"to\": \"[email protected]\" }\n" +
"}";
try (OutputStream os = con.getOutputStream()) {
byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
int status = con.getResponseCode();
System.out.println("Response Status: " + status);
} catch (Exception e) {
e.printStackTrace();
}
}
}
require 'net/http'
require 'json'
require 'uri'
webhook_id = '60d5ec49f1b2c72d9c8b1234'
uri = URI("https://api.autosend.com/v1/webhooks/#{webhook_id}/resend")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path)
request['Authorization'] = 'Bearer AS_your-api-key'
request['Content-Type'] = 'application/json'
request.body = {
event: 'email.delivered',
data: { messageId: 'msg_abc123', to: '[email protected]' }
}.to_json
response = http.request(request)
puts response.body
{
"success": true,
"message": "Webhook queued for delivery",
"data": {
"jobId": "12345"
}
}