> ## Documentation Index
> Fetch the complete documentation index at: https://docs.autosend.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Resend Webhook

> Queues a test delivery of a given event to the webhook's URL. The webhook must be subscribed to the supplied event.

> [!NOTE]
>
> 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.

```bash cURL theme={null}
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": "recipient@example.com"
  }
}'
```

```python Python theme={null}
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": "recipient@example.com"
    }
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

```javascript JavaScript theme={null}
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: 'recipient@example.com'
    }
  })
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
```

```php PHP theme={null}
<?php

$webhookId = '60d5ec49f1b2c72d9c8b1234';
$url = "https://api.autosend.com/v1/webhooks/{$webhookId}/resend";

$data = [
    'event' => 'email.delivered',
    'data' => [
        'messageId' => 'msg_abc123',
        'to' => 'recipient@example.com'
    ]
];

$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;
?>
```

```go Go theme={null}
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":        "recipient@example.com",
        },
    }

    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))
}
```

```java Java theme={null}
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\": \"recipient@example.com\" }\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();
        }
    }
}
```

```ruby Ruby theme={null}
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: 'recipient@example.com' }
}.to_json

response = http.request(request)
puts response.body
```

```json 200 Response theme={null}
{
  "success": true,
  "message": "Webhook queued for delivery",
  "data": {
    "jobId": "12345"
  }
}
```

***

#### Authorizations

**Authorizations** `string | header` *required*

Project API key header of the form Bearer `AS_<key>`.

### Path Parameters

**id** `string` *required*

The unique identifier of the webhook.

Example: `"60d5ec49f1b2c72d9c8b1234"`

### Body

**event** `string` *required*

The event type to deliver. Must be one the webhook is subscribed to.

Example: `"email.delivered"`

**data** `object` *required*

The event payload that will be wrapped and POSTed to the webhook URL.

Example: `{ "messageId": "msg_abc123", "to": "recipient@example.com" }`

#### Response

Webhook queued for delivery (200)

**success** `boolean`

Indicates if the request was successful

**data** `object`

Wrapper containing the queued job reference

**child attributes**

**data.jobId** `string`

The queue job ID for the delivery attempt

#### Error Responses

**400 - Webhook not subscribed** `object`

Returned when the webhook is not subscribed to the supplied event.

```json theme={null}
{
  "success": false,
  "error": {
    "message": "Webhook is not subscribed to this event: email.delivered",
    "code": "WEBHOOK_NOT_SUBSCRIBED",
  }
}
```

**404 - Webhook not found** `object`

Returned when no webhook with the given ID exists in the project.

```json theme={null}
{
  "success": false,
  "error": {
    "message": "Webhook not found",
    "code": "WEBHOOK_NOT_FOUND",
  }
}
```


## OpenAPI

````yaml POST /webhooks/{id}/resend
openapi: 3.1.0
info:
  title: AutoSend API
  description: >-
    AutoSend REST API for managing project webhooks. These endpoints accept a
    project API key (AS_ prefix) and let you subscribe to email and contact
    events, inspect delivery logs, and test deliveries.
  version: 1.0.0
servers:
  - url: https://api.autosend.com/v1
security:
  - bearerAuth: []
paths:
  /webhooks/{id}/resend:
    post:
      summary: Resend Webhook
      description: >-
        Queues a test delivery of a given event to the webhook's URL. The
        webhook must be subscribed to the supplied event.
components: {}

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.