Fetch business email
curl --request GET \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/support-emails/{messageId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/support-emails/{messageId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/support-emails/{messageId}', 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://sandbox.layerfi.com/v1/businesses/{businessId}/support-emails/{messageId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://sandbox.layerfi.com/v1/businesses/{businessId}/support-emails/{messageId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.layerfi.com/v1/businesses/{businessId}/support-emails/{messageId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/support-emails/{messageId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"thread_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"mailbox_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"gmail_message_id": "<string>",
"gmail_thread_id": "<string>",
"business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"direction": "RECEIVED",
"from_address": "jsmith@example.com",
"subject": "<string>",
"snippet": "<string>",
"received_at": "2023-11-07T05:31:56Z",
"body_html": "<string>",
"body_text": "<string>",
"participants": [
{
"email_address": "jsmith@example.com",
"role": "FROM"
}
],
"attachments": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filename": "<string>",
"mime_type": "<string>",
"size_bytes": 123,
"url": "<string>"
}
]
}
}{
"type": "InvalidParameters",
"description": "<string>",
"error_enum": "InvalidPayload",
"meta": {}
}Business Emails
Fetch business email
Fetches one message from a thread linked to this business. Returns its stored HTML or plain-text body and temporary presigned S3 URLs for attachments. Treat HTML as untrusted before rendering it. Fetch the email again to refresh expired attachment URLs.
GET
/
v1
/
businesses
/
{businessId}
/
support-emails
/
{messageId}
Fetch business email
curl --request GET \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/support-emails/{messageId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/support-emails/{messageId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/support-emails/{messageId}', 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://sandbox.layerfi.com/v1/businesses/{businessId}/support-emails/{messageId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://sandbox.layerfi.com/v1/businesses/{businessId}/support-emails/{messageId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.layerfi.com/v1/businesses/{businessId}/support-emails/{messageId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/support-emails/{messageId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"thread_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"mailbox_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"gmail_message_id": "<string>",
"gmail_thread_id": "<string>",
"business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"direction": "RECEIVED",
"from_address": "jsmith@example.com",
"subject": "<string>",
"snippet": "<string>",
"received_at": "2023-11-07T05:31:56Z",
"body_html": "<string>",
"body_text": "<string>",
"participants": [
{
"email_address": "jsmith@example.com",
"role": "FROM"
}
],
"attachments": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filename": "<string>",
"mime_type": "<string>",
"size_bytes": 123,
"url": "<string>"
}
]
}
}{
"type": "InvalidParameters",
"description": "<string>",
"error_enum": "InvalidPayload",
"meta": {}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The UUID of the business whose email to fetch.
The message UUID, for example data.message_id from an email.message_received webhook.
Response
Email retrieved.
One business email with its stored body and presigned attachment download URLs. HTML takes precedence when both HTML and plain text arrive; only one body field is populated. Both are null when no body was stored.
Show child attributes
Show child attributes