Using the Cancel Scheduled Sends API, you can cancel or pause sending one or more groups of emails. SendGrid defines these multiple scheduled send requests together as batches identified with a batch_id
.
With this API, you can perform the following tasks on scheduled emails:
Cancelling or pausing a batch of messages include the following conditions:
send_at
time.send_at
time, SendGrid discards the messages.send_at
time, SendGrid retains the messages.
When you resume a paused batch, SendGrid delivers your scheduled send.send_at
time, SendGrid discards the messages as Expired.To cancel a scheduled send of a single message, consult Canceling a Scheduled Send.
This operation allows you to generate a new mail batch ID.
Once a batch ID is created, you can associate it with a mail send by passing it in the request body of the Mail Send operation. This makes it possible to group multiple requests to the Mail Send operation by assigning them the same batch ID.
A batch ID that's associated with a mail send can be used to access and modify the associated send. For example, you can pause or cancel a send using its batch ID. See the Scheduled Sends API for more information about pausing and cancelling a mail send.
Bearer <<YOUR_API_KEY_HERE>>
Optional
Use the on-behalf-of
header to make API calls for a particular Subuser through the parent account. You can use this header to automate bulk updates or to administer a Subuser without changing the authentication in your code. You will use the parent account's API key when using this header.
Batch ID success response.
A mail batch ID.
1const client = require("@sendgrid/client");2client.setApiKey(process.env.SENDGRID_API_KEY);34const request = {5url: `/v3/mail/batch`,6method: "POST",7};89client10.request(request)11.then(([response, body]) => {12console.log(response.statusCode);13console.log(response.body);14})15.catch((error) => {16console.error(error);17});