Skip to main content
GET
/
account
/
subaccount
/
stat
/
{subaccount_id}
Python
import requests
url = "https://api.sendpost.io/api/v1/subaccount/stat"
params = {"from": "2020-03-12", "to": "2020-04-14"}
headers = {
    "accept": "application/json",
    "X-SubAccount-ApiKey": "<subaccount_api_key>"
}
response = requests.get(url, headers=headers, params=params)
print(response.json())
curl --request GET \
--url https://api.sendpost.io/api/v1/account/subaccount/stat/{subaccount_id} \
--header 'X-Account-ApiKey: <api-key>'
const options = {method: 'GET', headers: {'X-Account-ApiKey': '<api-key>'}};

fetch('https://api.sendpost.io/api/v1/account/subaccount/stat/{subaccount_id}', 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://api.sendpost.io/api/v1/account/subaccount/stat/{subaccount_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Account-ApiKey: <api-key>"
],
]);

$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://api.sendpost.io/api/v1/account/subaccount/stat/{subaccount_id}"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("X-Account-ApiKey", "<api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.sendpost.io/api/v1/account/subaccount/stat/{subaccount_id}")
.header("X-Account-ApiKey", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.sendpost.io/api/v1/account/subaccount/stat/{subaccount_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-Account-ApiKey"] = '<api-key>'

response = http.request(request)
puts response.read_body
[
  {
    "date": "2020-03-12",
    "stats": {
      "processed": 225,
      "delivered": 200,
      "dropped": 10,
      "hardBounced": 10,
      "softBounced": 5,
      "unsubscribed": 6,
      "spam": 2
    }
  }
]

Authorizations

X-Account-ApiKey
string
header
required

This api key can be used for all account level operations

Path Parameters

subaccount_id
integer<int64>
required

The ID of the subaccount to retrieve

Example:

11

Query Parameters

from
string<date>
required

Start date for stats retrieval.

to
string<date>
required

Date to which stats should be retrieved ( Note than from date should be earlier than to date. Also the difference between from and to date shouldn't ne more than 60 days )

Response

200 - application/json

Successful response

date
string<date>

Date for which stats are retrieved (UTC).

Example:

"2020-03-12"

stats
object