For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
SDKsHelp CenterLog inSign up
    • Overview
  • Getting Started
    • API Mechanics
    • Quickstart
  • Guides
    • Communications API
    • Troubleshooting
    • Events
    • Changelog
  • Comms API Reference
      • Summary
      • POSTSend Emails
      • GETList Emails
      • GETFetch an Email
      • DELDelete
      • GETFetch an Email Operation
      • GETList Email Operations
LogoLogo
SDKsHelp CenterLog inSign up
Comms API ReferenceEmails

Fetch an Email

GET
https://comms.twilio.com/v1/Emails/:emailId
GET
/v1/Emails/:emailId
1import { TwilioClient } from "twilio-comms";
2
3async function main() {
4 const client = new TwilioClient({
5 accountId: "YOUR_ACCOUNTID_HERE",
6 authToken: "YOUR_AUTHTOKEN_HERE",
7 });
8 await client.emails.fetch("emailId");
9}
10main();
1{
2 "content": {
3 "text": "Hello, World!",
4 "subject": "An Introduction",
5 "html": "<html><body>Hello, World!</body></html>",
6 "attachments": []
7 },
8 "createdAt": "2023-08-24T14:15:22Z",
9 "deletedAt": null,
10 "from": {
11 "address": "support@example.com",
12 "name": "Cool Support"
13 },
14 "id": "comms_email_01h9krwprkeee8fzqspvwy6nq8",
15 "related": [],
16 "scheduledFor": null,
17 "status": "DELIVERED",
18 "tags": {},
19 "to": [
20 {
21 "address": "janedoe@example.com",
22 "name": "Jane Doe"
23 }
24 ],
25 "updatedAt": "2023-08-24T14:15:22Z"
26}

This operation fetches a single Email using its ID.

Data retention: Records are available for 7 days after creation. Requests for data older than 7 days may return incomplete results.

Was this page helpful?
Previous

Delete

Next
Built with

Authentication

AuthorizationBasic

Basic authentication of the form Basic <account_id:auth_token>.

OR
AuthorizationBasic

Basic authentication of the form Basic <api_key:api_key_secret>.

Path parameters

emailIdstringRequired

Response

OK
contentobject
The resolved content of the Email.
createdAtstringformat: "date-time"
The date and time when the Email was created.
deletedAtstring or nullformat: "date-time"
The date and time when the Email was deleted.
fromobject
The sender of the email.
idstringformat: "^comms_email_[0-7][a-hjkmnpqrstv-z0-9]{25,34}"
A reference to an Email.
relatedlist of objects
A list of resources that are associated with the Email.
scheduledForstring or nullformat: "date-time"

The scheduled send time of the Email. This field is only present if the Email was created with a schedule.

statusenum

The status of an Email. The status can be one of the following:

  • SCHEDULED The Email is scheduled to be sent by Twilio in the future.

  • QUEUED The Email is queued in Twilio for sending.

  • SENT The Email has been sent by Twilio.

  • DELIVERED The Email has been successfully delivered to the recipient.

  • UNDELIVERED The Email was successfully sent by Twilio but has not been delivered to the recipient.

  • OPENED The Email has been opened by the recipient.

  • FAILED The Email processing failed inside Twilio.

  • CANCELED The Email was canceled via API request.

  • INBOUND The Email was received by Twilio from an external source.

tagsmap from strings to strings

Custom metadata in the form of key-value pairs. Maximum size of a tag key is 128 characters. Maximum size of a tag value is 256 characters. There can be a maximum of 10 key-value pairs.

This field can be templated with Liquid. Specify variables with each recipient for personalization.

tolist of objects

The recipients of the email on the to line.

updatedAtstringformat: "date-time"
The date and time when the Email was last updated.

Errors

400
Bad Request Error
404
Not Found Error
429
Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error