Webhooks
Create Webhook
Creates a new webhook subscribed to one or more events. The signing secret is returned only on creation — store it securely, as it cannot be retrieved again except via the reveal endpoint.
POST
/
webhooks
curl --request POST \
--url https://api.autosend.com/v1/webhooks \
--header 'Authorization: Bearer AS_your-api-key' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://example.com/webhooks/autosend",
"events": ["email.delivered", "email.bounced"],
"metadata": { "team": "growth" }
}'
import requests
url = "https://api.autosend.com/v1/webhooks"
headers = {
"Authorization": "Bearer AS_your-api-key",
"Content-Type": "application/json"
}
payload = {
"url": "https://example.com/webhooks/autosend",
"events": ["email.delivered", "email.bounced"],
"metadata": {"team": "growth"}
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
fetch('https://api.autosend.com/v1/webhooks', {
method: 'POST',
headers: {
'Authorization': 'Bearer AS_your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://example.com/webhooks/autosend',
events: ['email.delivered', 'email.bounced']
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$url = 'https://api.autosend.com/v1/webhooks';
$data = [
'url' => 'https://example.com/webhooks/autosend',
'events' => ['email.delivered', 'email.bounced'],
'metadata' => ['team' => 'growth']
];
$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() {
url := "https://api.autosend.com/v1/webhooks"
payload := map[string]interface{}{
"url": "https://example.com/webhooks/autosend",
"events": []string{"email.delivered", "email.bounced"},
"metadata": map[string]string{"team": "growth"},
}
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 CreateWebhook {
public static void main(String[] args) {
try {
URL url = new URL("https://api.autosend.com/v1/webhooks");
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" +
" \"url\": \"https://example.com/webhooks/autosend\",\n" +
" \"events\": [\"email.delivered\", \"email.bounced\"],\n" +
" \"metadata\": { \"team\": \"growth\" }\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'
uri = URI('https://api.autosend.com/v1/webhooks')
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 = {
url: 'https://example.com/webhooks/autosend',
events: ['email.delivered', 'email.bounced']
}.to_json
response = http.request(request)
puts response.body
{
"success": true,
"message": "Webhook created successfully",
"data": {
"webhook": {
"id": "60d5ec49f1b2c72d9c8b1234",
"organizationId": "60d5ec49f1b2c72d9c8b0000",
"projectId": "60d5ec49f1b2c72d9c8b1111",
"url": "https://example.com/webhooks/autosend",
"secret": "whsec_8f3a1c2d4e5b6a7c8d9e0f1a2b3c4d5e",
"events": ["email.delivered", "email.bounced"],
"isActive": true,
"status": "active",
"failureCount": 0,
"lastFailedAt": null,
"lastSuccessAt": null,
"lastDeliveredAt": null,
"metadata": { "team": "growth" },
"createdAt": "2026-06-12T10:15:00.000Z",
"updatedAt": "2026-06-12T10:15:00.000Z"
}
}
}
This endpoint accepts a project API key (
AS_ prefix). The signing secret is returned only on creation — store it securely. You can later retrieve it via the Reveal Webhook Secret endpoint.curl --request POST \
--url https://api.autosend.com/v1/webhooks \
--header 'Authorization: Bearer AS_your-api-key' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://example.com/webhooks/autosend",
"events": ["email.delivered", "email.bounced"],
"metadata": { "team": "growth" }
}'
import requests
url = "https://api.autosend.com/v1/webhooks"
headers = {
"Authorization": "Bearer AS_your-api-key",
"Content-Type": "application/json"
}
payload = {
"url": "https://example.com/webhooks/autosend",
"events": ["email.delivered", "email.bounced"],
"metadata": {"team": "growth"}
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
fetch('https://api.autosend.com/v1/webhooks', {
method: 'POST',
headers: {
'Authorization': 'Bearer AS_your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://example.com/webhooks/autosend',
events: ['email.delivered', 'email.bounced']
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$url = 'https://api.autosend.com/v1/webhooks';
$data = [
'url' => 'https://example.com/webhooks/autosend',
'events' => ['email.delivered', 'email.bounced'],
'metadata' => ['team' => 'growth']
];
$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() {
url := "https://api.autosend.com/v1/webhooks"
payload := map[string]interface{}{
"url": "https://example.com/webhooks/autosend",
"events": []string{"email.delivered", "email.bounced"},
"metadata": map[string]string{"team": "growth"},
}
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 CreateWebhook {
public static void main(String[] args) {
try {
URL url = new URL("https://api.autosend.com/v1/webhooks");
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" +
" \"url\": \"https://example.com/webhooks/autosend\",\n" +
" \"events\": [\"email.delivered\", \"email.bounced\"],\n" +
" \"metadata\": { \"team\": \"growth\" }\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'
uri = URI('https://api.autosend.com/v1/webhooks')
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 = {
url: 'https://example.com/webhooks/autosend',
events: ['email.delivered', 'email.bounced']
}.to_json
response = http.request(request)
puts response.body
{
"success": true,
"message": "Webhook created successfully",
"data": {
"webhook": {
"id": "60d5ec49f1b2c72d9c8b1234",
"organizationId": "60d5ec49f1b2c72d9c8b0000",
"projectId": "60d5ec49f1b2c72d9c8b1111",
"url": "https://example.com/webhooks/autosend",
"secret": "whsec_8f3a1c2d4e5b6a7c8d9e0f1a2b3c4d5e",
"events": ["email.delivered", "email.bounced"],
"isActive": true,
"status": "active",
"failureCount": 0,
"lastFailedAt": null,
"lastSuccessAt": null,
"lastDeliveredAt": null,
"metadata": { "team": "growth" },
"createdAt": "2026-06-12T10:15:00.000Z",
"updatedAt": "2026-06-12T10:15:00.000Z"
}
}
}
Authorizations
Project API key header of the form Bearer
AS_<key>.Body
The HTTPS (or HTTP) endpoint AutoSend will POST events to. Must include the protocol.Example:
"https://example.com/webhooks/autosend"One or more event types to subscribe to. Must contain at least one valid event. See List Available Events for the full set.Example:
["email.delivered", "email.bounced"]Response
Webhook created (201)Indicates if the request was successfulExample:
trueWrapper containing the created webhook
Show child attributes
Show child attributes
Unique webhook identifier
The destination URL events are delivered to
HMAC signing secret used to verify payload signatures. Returned only on creation.
The subscribed event types
Whether the webhook is currently active
Delivery status. One of
active, inactive, or disabledNumber of consecutive delivery failures. Starts at
0 on creation.Timestamp of the most recent failed delivery (ISO 8601), or
nullTimestamp of the most recent successful delivery (ISO 8601), or
nullTimestamp of the most recent delivery attempt (ISO 8601), or
nullArbitrary key-value metadata attached to the webhook
ISO 8601 creation timestamp
ISO 8601 last-updated timestamp
Error Responses
Returned when the URL is invalid or no valid events are supplied.
{
"success": false,
"error": {
"message": "A valid webhook URL is required",
"code": "VALIDATION_ERROR",
}
}
Was this page helpful?
⌘I
curl --request POST \
--url https://api.autosend.com/v1/webhooks \
--header 'Authorization: Bearer AS_your-api-key' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://example.com/webhooks/autosend",
"events": ["email.delivered", "email.bounced"],
"metadata": { "team": "growth" }
}'
import requests
url = "https://api.autosend.com/v1/webhooks"
headers = {
"Authorization": "Bearer AS_your-api-key",
"Content-Type": "application/json"
}
payload = {
"url": "https://example.com/webhooks/autosend",
"events": ["email.delivered", "email.bounced"],
"metadata": {"team": "growth"}
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
fetch('https://api.autosend.com/v1/webhooks', {
method: 'POST',
headers: {
'Authorization': 'Bearer AS_your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://example.com/webhooks/autosend',
events: ['email.delivered', 'email.bounced']
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$url = 'https://api.autosend.com/v1/webhooks';
$data = [
'url' => 'https://example.com/webhooks/autosend',
'events' => ['email.delivered', 'email.bounced'],
'metadata' => ['team' => 'growth']
];
$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() {
url := "https://api.autosend.com/v1/webhooks"
payload := map[string]interface{}{
"url": "https://example.com/webhooks/autosend",
"events": []string{"email.delivered", "email.bounced"},
"metadata": map[string]string{"team": "growth"},
}
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 CreateWebhook {
public static void main(String[] args) {
try {
URL url = new URL("https://api.autosend.com/v1/webhooks");
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" +
" \"url\": \"https://example.com/webhooks/autosend\",\n" +
" \"events\": [\"email.delivered\", \"email.bounced\"],\n" +
" \"metadata\": { \"team\": \"growth\" }\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'
uri = URI('https://api.autosend.com/v1/webhooks')
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 = {
url: 'https://example.com/webhooks/autosend',
events: ['email.delivered', 'email.bounced']
}.to_json
response = http.request(request)
puts response.body
{
"success": true,
"message": "Webhook created successfully",
"data": {
"webhook": {
"id": "60d5ec49f1b2c72d9c8b1234",
"organizationId": "60d5ec49f1b2c72d9c8b0000",
"projectId": "60d5ec49f1b2c72d9c8b1111",
"url": "https://example.com/webhooks/autosend",
"secret": "whsec_8f3a1c2d4e5b6a7c8d9e0f1a2b3c4d5e",
"events": ["email.delivered", "email.bounced"],
"isActive": true,
"status": "active",
"failureCount": 0,
"lastFailedAt": null,
"lastSuccessAt": null,
"lastDeliveredAt": null,
"metadata": { "team": "growth" },
"createdAt": "2026-06-12T10:15:00.000Z",
"updatedAt": "2026-06-12T10:15:00.000Z"
}
}
}