GET/ email-campaign/ :id/ logs/
Get single email campaign logs
You can return all delivery logs of the specific email campaign. These results can be filtered by conditions defined as request parameters.
| Lookup | Description | Allowed values |
|---|---|---|
| status | Status of the deliveires. | Pending = 1 Success = 2 Failure = 3 Retried = 4 Webhook = 5 |
| reason | Type of the bounce. Might be used if Webhook status has been chosen. | Softbounce = 1 Spambounce = 2 |
Request
- cURL
- JavaScript
- PHP
- Python
curl -X GET "https://<your_app_subdomain>.user.com/api/public/email-campaign/:id/logs/" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2"
const response = await fetch(
"https://<your_app_subdomain>.user.com/api/public/email-campaign/:id/logs/",
{
method: "GET",
headers: {
Authorization: "Token <your_64_char_api_key>",
Accept: "*/*; version=2",
},
},
);
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/email-campaign/:id/logs/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Token <your_64_char_api_key>",
"Accept: */*; version=2",
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
response = requests.get(
"https://<your_app_subdomain>.user.com/api/public/email-campaign/:id/logs/",
headers={
"Authorization": "Token <your_64_char_api_key>",
"Accept": "*/*; version=2",
},
)
print(response.json())
Response examples
- 200 OK
- 404 Not Found
{"count": 1,"next": null,"previous": null,"results": {"campaign_id": 180,"campaign_pk": 180,"campaign_name": "Your weekly summary","logs": [22 fields]}}{
"detail": "No EmailCampaign matches the given query."
}
Response fields
Fields returned in the 200 OK response body.
- count
- Number of results across all pages. It can lag behind recent changes; see Response pagination.
- next
- URL of the next page of results. null on the last page.
- previous
- URL of the previous page of results. null on the first page.
- results
- Results on this page.
- results.
campaign_id - ID of the campaign.
- results.
campaign_pk - ID of the campaign, the same as
campaign_id. - results.
campaign_name - Name of the campaign.
- results.
logs - One entry per email sent by the campaign.
- results.
logs[]. id - A unique identifier for the campaign which is given by User
- results.
logs[]. delivery_task_id - Not used for emails: always
null. - results.
logs[]. status - An email campaign status.
- results.
logs[]. failure_reason - Why the email failed or bounced, for example
hardbounce,softbounceorspambounce; an empty string if it didn't. - results.
logs[]. sent_at - When the email was sent, ISO 8601.
- results.
logs[]. opened_at - When the email was first opened, ISO 8601.
nullif it wasn't. - results.
logs[]. clicked_at - When a link in the email was first clicked, ISO 8601.
nullif none was. - results.
logs[]. unsubscribed_at - When the contact unsubscribed through this email, ISO 8601.
nullif they didn't. - results.
logs[]. created_at - A creation date of email campaign.
- results.
logs[]. campaign - ID of the campaign the email belongs to.
- results.
logs[]. client_user - ID of the contact the email was sent to.
- results.
logs[]. variation - ID of the message variation that was sent.
- results.
logs[]. rendered_email - ID of the stored copy of the sent email, or
nullif none was kept. - results.
logs[]. preview - URL of a preview of the sent email.
- results.
logs[]. subject - Email subject line.
- results.
logs[]. user_id - ID of the contact the email was sent to.
- results.
logs[]. user - Display name of the contact the email was sent to.
- results.
logs[]. user_email - Email address the email was sent to.
- results.
logs[]. sender - Address the email was sent from.
- results.
logs[]. recipient - Email address the email was sent to.
- results.
logs[]. has_preview - Whether a preview of the sent email is available.
- results.
logs[]. tracking_enabled - Whether open and click tracking was on for this email.
- results.
- results.
note
Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.