Templates (report)

GET/api/v1/reports/templates
Requires anorganization API keywith the scopereports:read

Request

GET/api/v1/reports/templates
curl -X GET 'https://app.mailyte.com/api/v1/reports/templates' \
  -H 'Authorization: Bearer mk_live_YOUR_API_KEY'
The key names its own organization, so no X-Organization-ID header is needed.

Response

Success.

  • dataarray<object>
    • objectstringreport_template
    • idstringemail-delivery | domain-health | engagement | volume-trends

      The 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.

    • namestring

      Display 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.

    • descriptionstring

      One 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".

      • namestring

        The key to send inside `parameters`. NOT NULLABLE: these rows are literals in `ReportService::templates()`.

      • typestringstring

        The 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`.

      • requiredboolean
      • defaultany

        What 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

StatusWhen
401The API key is missing, unknown, revoked or expired. All four answer identically, on purpose: distinguishing them would confirm which keys exist.
403The 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.
404No such resource in this organization.
422The request was understood but the values were not acceptable.
429Too 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.