Get an email message
The legacy /v2/emails/{id} GET route is a backward-compatible alias for this operation.
GET
/
email_messages
/
{id}
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const EmailMessageDetail = await client.emailMessages.retrieve('id');
console.log(EmailMessageDetail.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
email_message_detail = client.email_messages.retrieve(
"id",
)
print(email_message_detail.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
emailMessage, err := client.EmailMessages.Get(
context.TODO(),
"id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", emailMessage.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
var response = client.emailMessages().retrieve("id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
email_message_detail = telnyx.email_messages.retrieve("id")
puts(email_message_detail)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$email_message_detail = $client->emailMessages->retrieve(
'id',
);
var_dump($email_message_detail);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-messages retrieve \
--api-key 'My API Key' \
--id idcurl --request GET \
--url https://api.telnyx.com/v2/email_messages/{id} \
--header 'Authorization: Bearer <token>'{
"data": {
"record_type": "email_message",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"from": {
"email": "<string>",
"name": "<string>"
},
"to": [
{
"email": "<string>",
"name": "<string>"
}
],
"cc": [
{
"email": "<string>",
"name": "<string>"
}
],
"bcc": [
{
"email": "<string>",
"name": "<string>"
}
],
"reply_to": "<string>",
"subject": "<string>",
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"template_variables": {},
"attachments": [
{
"url": "<string>",
"sha256": "<string>",
"size_bytes": 123,
"filename": "<string>",
"content_type": "<string>",
"disposition": "attachment",
"content_id": "<string>"
}
],
"events": [
{
"occurred_at": "2023-11-07T05:31:56Z",
"payload": {}
}
],
"created_at": "2023-11-07T05:31:56Z",
"text_body": "<string>",
"html_body": "<string>",
"scheduled_at": "2023-11-07T05:31:56Z",
"inline_css": true,
"sandbox": true,
"recipient_statuses": {
"delivered": 998,
"bounced": 2
}
}
}{
"errors": [
{
"code": "10006",
"title": "Not authorized",
"detail": "Invalid API key",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10006"
}
}
]
}{
"errors": [
{
"code": "10001",
"title": "Not Found",
"detail": "The requested resource was not found"
}
]
}Authorizations
Telnyx API key supplied as Authorization: Bearer <token>. In production, auth may be validated by the API gateway and forwarded via Telnyx auth headers.
Path Parameters
Email message UUID.
Response
Email message details, including plain-text and HTML bodies.
Show child attributes
Show child attributes
Was this page helpful?
โI
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const EmailMessageDetail = await client.emailMessages.retrieve('id');
console.log(EmailMessageDetail.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
email_message_detail = client.email_messages.retrieve(
"id",
)
print(email_message_detail.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
emailMessage, err := client.EmailMessages.Get(
context.TODO(),
"id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", emailMessage.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
var response = client.emailMessages().retrieve("id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
email_message_detail = telnyx.email_messages.retrieve("id")
puts(email_message_detail)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$email_message_detail = $client->emailMessages->retrieve(
'id',
);
var_dump($email_message_detail);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-messages retrieve \
--api-key 'My API Key' \
--id idcurl --request GET \
--url https://api.telnyx.com/v2/email_messages/{id} \
--header 'Authorization: Bearer <token>'{
"data": {
"record_type": "email_message",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"from": {
"email": "<string>",
"name": "<string>"
},
"to": [
{
"email": "<string>",
"name": "<string>"
}
],
"cc": [
{
"email": "<string>",
"name": "<string>"
}
],
"bcc": [
{
"email": "<string>",
"name": "<string>"
}
],
"reply_to": "<string>",
"subject": "<string>",
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"template_variables": {},
"attachments": [
{
"url": "<string>",
"sha256": "<string>",
"size_bytes": 123,
"filename": "<string>",
"content_type": "<string>",
"disposition": "attachment",
"content_id": "<string>"
}
],
"events": [
{
"occurred_at": "2023-11-07T05:31:56Z",
"payload": {}
}
],
"created_at": "2023-11-07T05:31:56Z",
"text_body": "<string>",
"html_body": "<string>",
"scheduled_at": "2023-11-07T05:31:56Z",
"inline_css": true,
"sandbox": true,
"recipient_statuses": {
"delivered": 998,
"bounced": 2
}
}
}{
"errors": [
{
"code": "10006",
"title": "Not authorized",
"detail": "Invalid API key",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10006"
}
}
]
}{
"errors": [
{
"code": "10001",
"title": "Not Found",
"detail": "The requested resource was not found"
}
]
}