Templates (report)
/api/v1/reports/templatesRequest
/api/v1/reports/templatescurl -X GET 'https://app.mailyte.com/api/v1/reports/templates' \
-H 'Authorization: Bearer mk_live_YOUR_API_KEY'const response = await fetch('https://app.mailyte.com/api/v1/reports/templates', {
method: 'GET',
headers: {
Authorization: 'Bearer mk_live_YOUR_API_KEY',
},
});
const { data } = await response.json();import requests
response = requests.get(
"https://app.mailyte.com/api/v1/reports/templates",
headers={"Authorization": "Bearer mk_live_YOUR_API_KEY"},
)
data = response.json()["data"]<?php
$response = Http::withToken('mk_live_YOUR_API_KEY')
->get('https://app.mailyte.com/api/v1/reports/templates');
$data = $response->json('data');require "net/http"
require "json"
uri = URI("https://app.mailyte.com/api/v1/reports/templates")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer mk_live_YOUR_API_KEY"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request) }Response
Success.
dataarray<object>objectstringreport_templateidstringemail-delivery | domain-health | engagement | volume-trendsThe value to send as `template_id` on `POST /reports/generate`. This list advertises FOUR templates while generate accepts FIVE -- it also accepts `security` -- so a client driving its UI from this endpoint can never offer the security report. Recorded in plans/13-public-api-contract/converted/mailserver.md.
namestringDisplay name. NOT NULLABLE: this endpoint is `ReportService::templates()`, a hardcoded array in this repository rather than anything fetched, so every row it can return is written out there with a name. See `parameters[].default` for the one field in this object that genuinely can be null.
descriptionstringOne line about the report. Written before the rates were removed, so some still say "rates" where the report now publishes counts. NOT NULLABLE, for the same reason as `name`: the four rows are literals in this repository and all four carry one.
parametersarray<object>What this template accepts in the `parameters` object of `POST /reports/generate`. An EMPTY ARRAY is a real answer -- it means the template takes no parameters, which is `domain-health` today -- and is never a stand-in for "we did not look".
namestringThe key to send inside `parameters`. NOT NULLABLE: these rows are literals in `ReportService::templates()`.
typestringstringThe JSON type of the value. A CLOSED set, and currently a set of one: every parameter of every template is a `string`. This is not an upstream field we forward -- the template list is a hardcoded array in this repository -- so the closed set is knowable, and a test asserts this enum still equals the distinct types the endpoint returns. NOT NULLABLE for the same reason as `name`. Note the values themselves are keyword strings, not free text: `date_range` is one of `day`, `week`, `month`, `quarter` and anything else is silently replaced with `month`.
requiredbooleandefaultanyWhat is used when you omit the parameter. Was `default_value`; the object already says these are parameters, and `_value` on a field called `default` is the same word twice. NULL MEANS NONE -- this parameter has no default -- not that we could not read one. Every parameter published today has one, so null is reachable only for a future `required: true` parameter with nothing to fall back to, and for such a parameter null is the correct answer rather than a gap.
Returned inside the standard envelope.
Errors
| Status | When |
|---|---|
401 | The API key is missing, unknown, revoked or expired. All four answer identically, on purpose: distinguishing them would confirm which keys exist. |
403 | The key is valid but may not do this: it lacks the required scope, its IP allowlist does not include you, or this endpoint does not accept API keys. |
404 | No such resource in this organization. |
422 | The request was understood but the values were not acceptable. |
429 | Too many requests, or the organization has spent its sending allowance. `Retry-After` says how long to wait. |
Every status, with what causes it and what to do, is on the error reference.