const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
end_date: '<string>',
lastcmd: '<string>',
message_id: '<string>',
rcpt: '<string>',
rspcode: 123,
rspmsg: '<string>',
sender: '<string>',
sender_id: '<string>',
start_date: '<string>',
subject: '<string>',
upstream: '<string>',
upstream_hostname: '<string>'
})
};
fetch('https://api.mailchannels.net/outbound/v1/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.mailchannels.net/outbound/v1/search"
payload = {
"end_date": "<string>",
"lastcmd": "<string>",
"message_id": "<string>",
"rcpt": "<string>",
"rspcode": 123,
"rspmsg": "<string>",
"sender": "<string>",
"sender_id": "<string>",
"start_date": "<string>",
"subject": "<string>",
"upstream": "<string>",
"upstream_hostname": "<string>"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mailchannels.net/outbound/v1/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'end_date' => '<string>',
'lastcmd' => '<string>',
'message_id' => '<string>',
'rcpt' => '<string>',
'rspcode' => 123,
'rspmsg' => '<string>',
'sender' => '<string>',
'sender_id' => '<string>',
'start_date' => '<string>',
'subject' => '<string>',
'upstream' => '<string>',
'upstream_hostname' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request POST \
--url https://api.mailchannels.net/outbound/v1/search \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"end_date": "<string>",
"lastcmd": "<string>",
"message_id": "<string>",
"rcpt": "<string>",
"rspcode": 123,
"rspmsg": "<string>",
"sender": "<string>",
"sender_id": "<string>",
"start_date": "<string>",
"subject": "<string>",
"upstream": "<string>",
"upstream_hostname": "<string>"
}
'{
"notice": "<string>",
"results": [
{
"@timestamp": "<string>",
"auth": "<string>",
"delivered": "<string>",
"lastcmd": "<string>",
"message_id": "<string>",
"rcpt": "<string>",
"remediation_options": "DELIST",
"rspcode": "<string>",
"rspmsg": "<string>",
"sender": "<string>",
"sender_id": "<string>",
"size": 123,
"spam_disposition": "<string>",
"subject": "<string>",
"upstream_hostname": "<string>",
"virus_disposition": "<string>"
}
]
}{
"code": 123,
"errors": [
"<string>"
],
"message": "<string>"
}{
"code": 123,
"errors": [
"<string>"
],
"message": "<string>"
}Search traffic logs
Search email delivery logs for your account. By default, searches cover the last 3 days of data. To search a different date range, include both start_date and end_date in the request body.
const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
end_date: '<string>',
lastcmd: '<string>',
message_id: '<string>',
rcpt: '<string>',
rspcode: 123,
rspmsg: '<string>',
sender: '<string>',
sender_id: '<string>',
start_date: '<string>',
subject: '<string>',
upstream: '<string>',
upstream_hostname: '<string>'
})
};
fetch('https://api.mailchannels.net/outbound/v1/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.mailchannels.net/outbound/v1/search"
payload = {
"end_date": "<string>",
"lastcmd": "<string>",
"message_id": "<string>",
"rcpt": "<string>",
"rspcode": 123,
"rspmsg": "<string>",
"sender": "<string>",
"sender_id": "<string>",
"start_date": "<string>",
"subject": "<string>",
"upstream": "<string>",
"upstream_hostname": "<string>"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mailchannels.net/outbound/v1/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'end_date' => '<string>',
'lastcmd' => '<string>',
'message_id' => '<string>',
'rcpt' => '<string>',
'rspcode' => 123,
'rspmsg' => '<string>',
'sender' => '<string>',
'sender_id' => '<string>',
'start_date' => '<string>',
'subject' => '<string>',
'upstream' => '<string>',
'upstream_hostname' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request POST \
--url https://api.mailchannels.net/outbound/v1/search \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"end_date": "<string>",
"lastcmd": "<string>",
"message_id": "<string>",
"rcpt": "<string>",
"rspcode": 123,
"rspmsg": "<string>",
"sender": "<string>",
"sender_id": "<string>",
"start_date": "<string>",
"subject": "<string>",
"upstream": "<string>",
"upstream_hostname": "<string>"
}
'{
"notice": "<string>",
"results": [
{
"@timestamp": "<string>",
"auth": "<string>",
"delivered": "<string>",
"lastcmd": "<string>",
"message_id": "<string>",
"rcpt": "<string>",
"remediation_options": "DELIST",
"rspcode": "<string>",
"rspmsg": "<string>",
"sender": "<string>",
"sender_id": "<string>",
"size": 123,
"spam_disposition": "<string>",
"subject": "<string>",
"upstream_hostname": "<string>",
"virus_disposition": "<string>"
}
]
}{
"code": 123,
"errors": [
"<string>"
],
"message": "<string>"
}{
"code": 123,
"errors": [
"<string>"
],
"message": "<string>"
}Authorizations
Query Parameters
The offset from the first result. Defaults to 0. To fetch the next page, increase start_at by count. For example, with count set to 20, use offsets of 0, 20, and 40 for the first three pages. Requests return 400 Bad Request if start_at + count exceeds 9,999.
The number of results to return per page. Defaults to 20. The maximum is 100.
x <= 100Body
Filters for the search query. If omitted, returns logs for the authenticated account without additional filters. Use count to control the number of results per page.
Y means the email is delivered while N means not delivered.
Y, N Must be in the form yyyy-mm-dd and be after start_date. If end_date is present, start_date must be present too.
Last SMTP command.
ID of the message.
The recipient email addresses. This should correspond to the addresses in the SMTP RCPT TO: commands.
SMTP response code.
SMTP response message.
The sender email address. This should correspond to the address
in the SMTP MAIL FROM: command.
The identity of the sender, if different from the envelope sender. This should correspond to a single customer.
Disposition of spam.
CONFIRMED, SUSPECT, BULK, UNKNOWN Must be in the form yyyy-mm-dd and be before end_date. If start_date is present, end_date must be present too.
Subject of email.
Upstream IP address.
Host name of upstream.
Disposition of virus.
CONFIRMED, HIGH, MEDIUM, UNKNOWN Was this page helpful?

