cloadyDocs
API ReferenceEndpointsWorkspaces

Query a workspace's email log

Runs a LogQL query over the workspace's email log, kept for 30 days, and returns Loki's answer unchanged. Streams carry `kind` (`delivery` or `auth`), and delivery lines `dir` (`in` or `out`) and `status` (`queued`, `delivered`, `deferred`, `bounced`, `rejected` or `spam`); auth lines `status` `ok` or `failed`. Each line is JSON with `from`, `to`, `subject`, `mailbox`, `code` and `reply` (the SMTP reply), `host` (the other server), `tls`, `size`, `score` (spam score) and `queue`. The path is Loki's own, so a Grafana data source can point here too. Needs the admin role.

GET
/api/workspaces/{workspaceSlug}/mail/loki/api/v1/query_range
AuthorizationBearer <token>

Personal API token (cldy_…)

In: header

Path Parameters

workspaceSlug*string

Query Parameters

query*string

A LogQL query: a log query returns lines, a metric query such as sum by (status) (count_over_time({kind="delivery", dir="out"} [1h])) returns series

Length1 <= length
start?string

Start of the range, as Unix seconds, Unix nanoseconds or RFC 3339; an hour before end when absent

end?string

End of the range; now when absent

limit?string

Most lines to return for a log query, 100 when absent

direction?string

backward, the default, returns the newest lines first

Value in

  • "backward"
  • "forward"
step?string

Seconds between points of a metric query, or a duration such as 1h

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/api/workspaces/string/mail/loki/api/v1/query_range?query=string"
{  "status": "string",  "data": {    "resultType": "string",    "result": [      null    ],    "property1": null,    "property2": null  },  "errorType": "string",  "error": "string",  "property1": null,  "property2": null}