Get email event statistics
Returns counts and rates for email events over a time range. The default start time is 30 days ago.
GET
/
email_events
/
stats
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.emailEvents.retrieveStats();
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.email_events.retrieve_stats()
print(response.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.EmailEvents.GetStats(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
var response = client.emailEvents().retrieveStats();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.email_events.retrieve_stats
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->emailEvents->retrieveStats();
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-events retrieve-stats \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/email_events/stats \
--header 'Authorization: Bearer <token>'{
"data": {
"record_type": "email_event_stats",
"counts": {
"queued": 1,
"sent": 1,
"delivered": 1,
"deferred": 1,
"bounced": 1,
"opened": 1,
"clicked": 1,
"complained": 1,
"unsubscribed": 1,
"failed": 1
},
"rates": {
"delivery_rate": 1,
"bounce_rate": 1,
"deferred_rate": 1,
"open_rate": 1,
"click_rate": 1,
"complaint_rate": 1
},
"time_range": {
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z"
}
}
}{
"errors": [
{
"code": "10006",
"title": "Not authorized",
"detail": "Invalid API key",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10006"
}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Inclusive ISO 8601 start timestamp. Defaults to 30 days ago when omitted.
Inclusive ISO 8601 end timestamp. When from is provided without to, defaults to from + 30 days.
Response
Email event statistics.
Show child attributes
Show child attributes
Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.emailEvents.retrieveStats();
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.email_events.retrieve_stats()
print(response.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.EmailEvents.GetStats(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
var response = client.emailEvents().retrieveStats();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.email_events.retrieve_stats
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->emailEvents->retrieveStats();
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-events retrieve-stats \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/email_events/stats \
--header 'Authorization: Bearer <token>'{
"data": {
"record_type": "email_event_stats",
"counts": {
"queued": 1,
"sent": 1,
"delivered": 1,
"deferred": 1,
"bounced": 1,
"opened": 1,
"clicked": 1,
"complained": 1,
"unsubscribed": 1,
"failed": 1
},
"rates": {
"delivery_rate": 1,
"bounce_rate": 1,
"deferred_rate": 1,
"open_rate": 1,
"click_rate": 1,
"complaint_rate": 1
},
"time_range": {
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z"
}
}
}{
"errors": [
{
"code": "10006",
"title": "Not authorized",
"detail": "Invalid API key",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10006"
}
}
]
}