Email Operation Resource
An Email Operation represents a batch of emails created in a single send request. Use this resource to track the overall status and delivery statistics of your email sends.
When you send an email, the API returns an operationId that correlates all email resources created in that request. Use the Operation resource to monitor delivery progress and retrieve aggregate statistics.
Data retention is limited to 7 days after creation. Requests for older records may yield incomplete results.
All URLs in the reference documentation use the following base URL:
https://comms.twilio.com/v1
The Operation ID is an identifier that can be used to correlate all of the resources created in a request.
Issue a GET request to the resource list location, using the Operation ID as a query parameter to retrieve the resources that correlate with the Operation.
comms_operation_01h9krwprkeee8fzqspvwy6nq8Pattern: ^comms_operation_[0-7][a-hjkmnpqrstv-z0-9]{25,34}The status of an Operation.
SCHEDULEDPROCESSINGCOMPLETEDCANCELEDRepresents the stats of a sending operation of one or many Emails.
-
totalis the total number ofEmailresources created in theOperation.-
To get the status for each individual
Email, fetch theEmailresource:GET /Email/{emailId}. -
For
Emailswith multiple recipients, useReceiptse.g.GET /Emails/{emailId}/Receipts.
-
-
recipientsis the total number of recipients targeted in an Operation. -
attemptsis the total number of sending attempts made by Twilio. -
scheduledis the number ofEmailsthat are scheduled to be sent by Twilio in the future. -
queuedis the number ofEmailsthat are queued in Twilio for sending. -
sentis the number ofEmailsthat have been sent by Twilio. -
deliveredis the number ofEmailsthat have been successfully delivered to recipients. -
openedis the number ofEmailsthat have been opened by unique recipients. -
undeliveredis the number ofEmailsthat were successfully sent by Twilio but have not been delivered to the recipient. -
failedis the number ofEmailsthat failed during processing by Twilio. GetErrorswithGET /Emails/Operations/{operationId}/Errorsfore more detail. -
canceledis the number ofEmailsthat were canceled via API request.
{"total":1,"recipients":1,"attempts":1,"queued":0,"sent":0,"scheduled":0,"delivered":0,"opened":0,"undelivered":0,"failed":0,"canceled":0}GET https://comms.twilio.com/v1/Emails/Operations/{operationId}
Retrieves a single Email Operation by its ID. Records are available for 7 days after creation.
comms_operation_01h9krwprkeee8fzqspvwy6nq8Pattern: ^comms_operation_[0-7][a-hjkmnpqrstv-z0-9]{25,34}1import { TwilioClient } from "twilio-comms";23async function main() {4const client = new TwilioClient({5accountId: "TWILIO_ACCOUNT_SID",6authToken: "TWILIO_AUTH_TOKEN",7});8await client.emails.fetchOperation("comms_operation_01h9krwprkeee8fzqspvwy6nq8");9}10main();
GET https://comms.twilio.com/v1/Emails/Operations
Returns a paginated list of Email Operations. Data retention is limited to 7 days after creation.
Filter to Operations created after the specified date and time.
Filter to Operations created before the specified date and time.
Filter to Operations with the specified status.
SCHEDULEDPROCESSINGCOMPLETEDCANCELEDThe number of resources to return in a page.
50Example: 50Minimum: 1Maximum: 10001import { TwilioClient } from "twilio-comms";23async function main() {4const client = new TwilioClient({5accountId: "TWILIO_ACCOUNT_SID",6authToken: "TWILIO_AUTH_TOKEN",7});8await client.emails.listOperations({9startDate: new Date("2024-01-15T09:30:00Z"),10endDate: new Date("2024-01-15T09:30:00Z"),11status: "SCHEDULED",12pageToken: "pageToken",13pageSize: 50,14});15}16main();