import Inbound from 'inboundemail';
const client = new Inbound({
apiKey: process.env['INBOUND_API_KEY'], // This is the default and can be omitted
});
const email = await client.emails.retrieve('id');
console.log(email.id);{
"object": "<string>",
"id": "<string>",
"type": "sent",
"from": "<string>",
"to": [
"<string>"
],
"subject": "<string>",
"status": "<string>",
"created_at": "<string>",
"has_attachments": true,
"cc": [
"<string>"
],
"bcc": [
"<string>"
],
"reply_to": [
"<string>"
],
"html": "<string>",
"text": "<string>",
"sent_at": "<string>",
"scheduled_at": "<string>",
"attachments": [
"<unknown>"
],
"is_read": true,
"thread_id": "<string>",
"thread_position": 123,
"headers": "<unknown>",
"tags": [
"<unknown>"
]
}Retrieve a single email by ID. Works for sent, received, and scheduled emails.
import Inbound from 'inboundemail';
const client = new Inbound({
apiKey: process.env['INBOUND_API_KEY'], // This is the default and can be omitted
});
const email = await client.emails.retrieve('id');
console.log(email.id);{
"object": "<string>",
"id": "<string>",
"type": "sent",
"from": "<string>",
"to": [
"<string>"
],
"subject": "<string>",
"status": "<string>",
"created_at": "<string>",
"has_attachments": true,
"cc": [
"<string>"
],
"bcc": [
"<string>"
],
"reply_to": [
"<string>"
],
"html": "<string>",
"text": "<string>",
"sent_at": "<string>",
"scheduled_at": "<string>",
"attachments": [
"<unknown>"
],
"is_read": true,
"thread_id": "<string>",
"thread_position": 123,
"headers": "<unknown>",
"tags": [
"<unknown>"
]
}Your Inbound API key. Include it in the Authorization header as: Bearer
Response for status 200
"email"sent, received, scheduled Was this page helpful?