Removes a broadcast entry by its unique identifier.
Methods
Remove
Remove(broadcastId string) (RemoveBroadcastResponse, error)
Deletes a broadcast using the default background context.
RemoveWithContext
RemoveWithContext(ctx context.Context, broadcastId string) (RemoveBroadcastResponse, error)
Deletes a broadcast with a custom context for cancellation and timeout control.
Parameters
The unique identifier of the broadcast to delete.
Response
The object type, always broadcast.
The unique identifier of the deleted broadcast.
Indicates whether the broadcast was successfully deleted.
Example
package main
import (
"fmt"
"github.com/resend/resend-go/v2"
)
func main() {
client := resend.NewClient("re_123456789")
response, err := client.Broadcasts.Remove("brd_123456")
if err != nil {
panic(err)
}
if response.Deleted {
fmt.Println("Broadcast deleted successfully")
}
}
Example: Check status before deleting
package main
import (
"fmt"
"github.com/resend/resend-go/v2"
)
func main() {
client := resend.NewClient("re_123456789")
// Get the broadcast to check its status
broadcast, err := client.Broadcasts.Get("brd_123456")
if err != nil {
panic(err)
}
// Only delete if it hasn't been sent
if broadcast.Status != "sent" {
response, err := client.Broadcasts.Remove("brd_123456")
if err != nil {
panic(err)
}
if response.Deleted {
fmt.Printf("Broadcast deleted (was %s)\n", broadcast.Status)
}
} else {
fmt.Println("Cannot delete a broadcast that has already been sent")
}
}
Deleting a broadcast is permanent and cannot be undone. If the broadcast has been sent, you may want to keep it for record-keeping purposes.
You can delete broadcasts in any status (draft, scheduled, or sent). Deleting a scheduled broadcast will prevent it from being sent.