Get Email
curl --request GET \
--url https://api.example.com/emails/{id}import requests
url = "https://api.example.com/emails/{id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/emails/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/emails/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/emails/{id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/emails/{id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/emails/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "<string>",
"created_at": "<string>",
"sent_at": {},
"opened_at": {},
"clicked_at": {},
"to": "<string>",
"subject": "<string>",
"from": "<string>"
}Emails
Get Email
Get details of a specific email
Get Email
curl --request GET \
--url https://api.example.com/emails/{id}import requests
url = "https://api.example.com/emails/{id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/emails/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/emails/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/emails/{id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/emails/{id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/emails/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "<string>",
"created_at": "<string>",
"sent_at": {},
"opened_at": {},
"clicked_at": {},
"to": "<string>",
"subject": "<string>",
"from": "<string>"
}Description
Get detailed information and status of a specific email.Parameters
string
required
Unique email ID from send or list response.
Response
string
Unique email ID.
string
Current email status.
string
ISO 8601 creation timestamp.
string | null
Timestamp when sent to server.
string | null
Timestamp when opened (if tracking enabled).
string | null
Timestamp of first click (if tracking enabled).
string
Recipient email address.
string
Email subject.
string
Sender email address.
Examples
curl "https://api.usesendly.app/v1/emails/email_abc123" \
-H "Authorization: Bearer se_your_api_key"
const email = await client.emails.get('email_abc123')
console.log(`Status: ${email.status}`)
console.log(`Sent: ${email.sent_at}`)
console.log(`Opened: ${email.opened_at ? 'Yes' : 'No'}`)
// Check email status via SDK
import { Sendly } from '@sendlyapp/sdk'
const client = new Sendly()
const email = await client.emails.get('email_abc123')
Track Opens
const email = await client.emails.get('email_abc123')
if (email.status === 'DELIVERED' && email.opened_at) {
console.log(`Email opened at: ${email.opened_at}`)
} else if (email.status === 'DELIVERED') {
console.log('Email delivered but not opened yet')
}
curl "https://api.usesendly.app/v1/emails/email_abc123" \
-H "Authorization: Bearer se_your_api_key" | jq '.opened_at'
Poll for Delivery
async function waitForDelivery(emailId, maxAttempts = 60) {
for (let i = 0; i < maxAttempts; i++) {
const email = await client.emails.get(emailId)
if (email.status === 'DELIVERED') {
console.log('Email delivered!')
return email
} else if (['BOUNCED', 'FAILED'].includes(email.status)) {
console.error(`Email ${email.status}`)
return email
}
await new Promise(r => setTimeout(r, 1000))
}
throw new Error('Timeout waiting for delivery')
}
Status Meanings
| Status | Description |
|---|---|
| QUEUED | Waiting to be sent |
| SENT | Sent to recipient server |
| DELIVERED | Successfully delivered |
| BOUNCED | Rejected as invalid |
| FAILED | Permanent send error |
Need help? Contact support@usesendly.app