Skip to content
Dashboard

Visibility

View as Markdown

Logs

Read the attack status and history of a domain, page and search its security events, and read bot, browser, packet inspection and threat statistics.

This part of the API is read-only. It tells you whether a domain is under attack, what the firewall logged, and what was counted for bots, browsers, packet inspection and threats. The paths start with /v2/cdn/logs/{domain_public_id}/diagnostics/, where the id is the public id of the domain, taken from the domains list.

The examples on this page use these shell variables:

export DIAMWALL_API_KEY="your key"
export LOGS="https://api.diamwall.com/v2/cdn/logs/your-domain-public-id/diagnostics"

Every endpoint here is a diagnostic. The answer has two keys, diagnostic (its name) and data. There is no ETag and nothing to write.

  • Unavailable is not empty. When a diagnostic cannot be answered you get an error, usually a 503. Show it as unavailable. Never show it as “no attack”, “no events” or zero.
  • Unknown parameters are refused. Each endpoint accepts only the parameters listed for it. Anything else, format included, answers 400 INVALID_REQUEST.
  • JSON only. Send Accept: application/json or no Accept header. Asking for text/html answers 406 NOT_ACCEPTABLE.
  • Big counts are strings. In the statistics, counts such as requests, hits and bytes_sent are decimal strings, for example "1234567". Parse them as 64-bit integers.
curl "$LOGS/attack-status/" \
-H "Authorization: Api-Key $DIAMWALL_API_KEY"
{
"diagnostic": "attack-status",
"data": { "status": 2, "under_attack": true }
}

status is 0, 1 or 2. 0 means the domain is not under attack. 1 and 2 both mean it is. under_attack says the same as a boolean, so use it when you only need yes or no.

curl "$LOGS/attack-history/?limit=50" \
-H "Authorization: Api-Key $DIAMWALL_API_KEY"
{
"diagnostic": "attack-history",
"data": {
"items": [
{
"id": "3f8e2c1a-7b4d-4e9a-9c21-5d6f7a8b9c0d",
"record": {
"start": {
"date": "11/Jul/2025:17:58:44",
"conn": 10403,
"type": "HTTP Flood",
"rule": "Sensor Mode",
"trigger": "rps"
},
"end": {
"date": "11/Jul/2025:18:04:12",
"total": 384211,
"legit": 1200,
"suspicious": 3400,
"malicious": 379611,
"dpi": 0,
"peak": 9120
}
}
}
],
"page": { "limit": 50, "next_cursor": null, "total": 1 },
"revision": "sha256:71707f2e3bb8..."
}
}
  • Each entry is an id and a record. The record has start and, once the attack ended, end. An attack that is still going on has no end.
  • The entries come in the order they were recorded. They are not sorted for you.
  • limit goes from 1 to 100. Without it a page holds 50 entries.
  • To read the next page, send data.page.next_cursor back as cursor, until it is null.
  • If the history changes between two pages, the next page answers 409 CURSOR_STALE. Start again from the first page, and never join pages from two different reads.
  • A domain with no attacks answers 200 with an empty items. A history that could not be read is an error, never an empty list.

When it is available, end.graph holds the traffic of the attack second by second:

{
"2025-07-11-17:59": {
"58": { "total": 80, "legit": 8, "suspicious": 12, "malicious": 60, "dpi": 0 }
},
"2025-07-11-18:1": {
"2": { "total": 90, "legit": 5, "suspicious": 10, "malicious": 75, "dpi": 1 },
"7": { "total": 120, "legit": 10, "suspicious": 20, "malicious": 90, "dpi": 3 }
}
}
curl "$LOGS/attack-domains/" \
-H "Authorization: Api-Key $DIAMWALL_API_KEY"

The answer is the number of attack statistics of this domain, in data.count, and data.query_time_ms. The statistics themselves are not part of the answer.

An event is one entry of the firewall log: a request, and what was done with it.

curl "$LOGS/attack-logs/?per_page=100&order=desc" \
-H "Authorization: Api-Key $DIAMWALL_API_KEY"
{
"diagnostic": "attack-logs",
"data": {
"items": [
{
"timestamp": "2026-10-20T10:01:00Z",
"domain": "example.com",
"remote_addr": "203.0.113.7",
"country": "PT",
"status": 403,
"method": "POST",
"host": "example.com",
"uri": "/login/1",
"request_id": "0f1e2d3c4b5a69780001",
"asn": 64496,
"event_name": "SQL Injection",
"event_rule": "owasp-942100",
"event_action": "block",
"referer": "-",
"user_agent": "Mozilla/5.0",
"pop": "lis1",
"ja4": "t13d1516h2_8daaf6152771_02713d6af862",
"ja4h": "ge11nn05enus_9ed1ff1f7b03_cd8dafe26982",
"ja4one": "-",
"ja4l": "-"
}
],
"page": { "number": 1, "limit": 100, "total": 41, "next_page": null, "previous_page": null },
"query_time_ms": 14
}
}
Parameter Values
page The page to read, from 1. Without it, the first page.
per_page Events in a page, from 1 to 1000. Without it, 20.
page_size Another name for per_page. Send one of the two, never both.
order asc or desc, by the time of the events.

To read on, send data.page.next_page as page, until it is null. An event has a challenge field only when its action was a challenge.

The search is a POST with a JSON body. It reads only: nothing is created. Every field of the body is optional, and {} answers the first page of all events. The answer has the same shape as the list above, paged the same way.

curl -X POST "$LOGS/attack-search/" \
-H "Authorization: Api-Key $DIAMWALL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"per_page": 100,
"ordering": "-timestamp",
"filters": [
{ "field": "country", "op": "equals", "value": "PT" },
{ "field": "status", "op": "between", "value": "400", "value_to": "499" },
{ "field": "uri", "op": "includes", "value": "/login" }
]
}'

The body takes these fields:

Fields What they do
page, per_page or page_size, order The paging of the list above, as JSON integers and a word.
ip, country, method, uri, event, rule, action, asn, ua, request_id Simple filters, each a string.
start, end A time range, as RFC3339 instants such as 2026-10-01T00:00:00Z.
search A text looked for across the events.
ordering The field to sort by: timestamp, date, status, country, asn, method, event_name, event_action or remote_addr. Put - in front for descending.
filters Up to 32 conditions. An event must match all of them.

Each entry of filters is an object with field, op and value. value is always a string, numbers included. between also takes value_to, and no other operator does. The operators depend on the field:

field op
remote_addr, ip equals, notEquals, includes, notIncludes
country equals, notEquals
status, asn equals, notEquals, gt, gte, lt, lte, between
timestamp, date after, before, between
Any other field includes, notIncludes, equals, notEquals

No match answers 200 with an empty items. A search that could not run is a 503, never an empty list.

Three endpoints count what was seen in the stored logs of your domain during a time window: bots, browser families and packet inspection hits.

All three take the same window, and so does threat statistics:

  • Send both start and end, or neither. One without the other answers 400 INVALID_REQUEST.
  • Both are RFC3339 times on a whole minute, such as 2026-11-08T12:00:00Z. They are compared in UTC.
  • The window is from 1 minute to 7 days long. start is included and end is not.
  • With a positive offset, write the + as %2B in the URL.
  • Without a window you get the last 60 complete minutes, ending at the start of the current minute.
state reason Meaning
available null There are stored requests in the window. A total of zero is a real zero.
unavailable no_observations Nothing is stored for the window. The totals are null. This means unknown, not zero traffic.

window_requests is the number of stored requests in the window. It is what the percentages are measured against. It is not your total traffic.

curl "$LOGS/bot-statistics/?start=2026-11-08T12:00:00Z&end=2026-11-08T13:00:00Z&limit=20" \
-H "Authorization: Api-Key $DIAMWALL_API_KEY"
{
"diagnostic": "bot-statistics",
"data": {
"state": "available",
"reason": null,
"window_requests": "100",
"limit": 20,
"truncated": false,
"totals": {
"requests": "20",
"bytes_sent": "1234567",
"bytes_known_requests": "12",
"decisions": { "allow": "15", "block": "3", "challenge": "1", "rate_limited": "1", "other": "0", "unknown": "0" },
"verification": { "verified": "0", "unverified": "0", "unknown": "20" }
},
"items": [
{
"bot_id": "gptbot",
"requests": "12",
"bytes_sent": "1234567",
"bytes_known_requests": "12",
"percent_of_window": 12
}
],
"bytes_basis": "response_body"
}
}

The example is shortened. Each item also has its own decisions and verification.

Parameter Values
start, end The window.
limit How many bots to list, from 1 to 200. Without it, 100.
bot_id One exact bot id, such as gptbot.
decision allow, block, challenge, rate_limited, other or unknown.
verification verified, unverified or unknown.
  • totals covers every bot that matches, not only the listed ones. Do not rebuild it by adding up items.
  • bytes_sent is null when it is unknown. "0" is a measured zero.
  • bytes_known_requests is how many requests had a usable measurement. When it is lower than requests, bytes_sent covers only part of them.
  • A bytes_basis of response_body means the bytes are response bodies, without headers.
  • To show megabytes, divide bytes_sent by 1,000,000.

This counts requests per browser family. It is not a list of versions. With family and threshold it also tells you how many requests came from a version below a major version you choose:

curl "$LOGS/browser-statistics/?family=chrome&threshold=110" \
-H "Authorization: Api-Key $DIAMWALL_API_KEY"
{
"diagnostic": "browser-statistics",
"data": {
"state": "available",
"reason": null,
"window_requests": "100",
"totals": {
"requests": "40",
"comparable_requests": "35",
"unknown_version_requests": "3",
"non_comparable_requests": "2"
},
"items": [
{
"family": "chrome",
"requests": "40",
"comparable_requests": "35",
"unknown_version_requests": "3",
"non_comparable_requests": "2",
"percent_of_window": 40
}
],
"preview": {
"basis": "supplied_threshold",
"family": "chrome",
"threshold": 110,
"compared_requests": "35",
"below_requests": "7",
"below_percent": 20
}
}
}
Parameter Values
start, end The window.
family chrome, edge, firefox, opera, safari, samsung or unknown.
threshold A major version, from 1 to 9999. It needs a family other than unknown.
  • comparable_requests, unknown_version_requests and non_comparable_requests add up to requests.
  • below_requests counts versions strictly below threshold. below_percent is measured against compared_requests, not against the window.
  • Without threshold, preview is null. It is also null for a window with no observations.
  • When no version can be compared, below_requests and below_percent are null.
  • The preview is only a count. Sending a threshold changes no setting of the domain.
curl "$LOGS/packet-inspection-statistics/?decision=challenge&limit=20" \
-H "Authorization: Api-Key $DIAMWALL_API_KEY"
{
"diagnostic": "packet-inspection-statistics",
"data": {
"state": "available",
"reason": null,
"window_requests": "100",
"limit": 20,
"truncated": false,
"totals": {
"hits": "12",
"decisions": { "allow": "0", "block": "0", "challenge": "12", "rate_limited": "0", "other": "0", "unknown": "0" }
},
"items": [
{
"rule_id": "RULE_EXAMPLE",
"hits": "12",
"decisions": { "allow": "0", "block": "0", "challenge": "12", "rate_limited": "0", "other": "0", "unknown": "0" }
}
]
}
}
Parameter Values
start, end The window.
limit How many rules to list, from 1 to 200. Without it, 100.
rule_id One exact rule id.
decision allow, block, challenge, rate_limited, other or unknown.

A hit is counted for the packet inspection rule recorded in an event. It is not a count of all requests. totals covers every rule that matches, not only the listed ones. A window with stored requests and no packet inspection event is available with zero hits.

Two different things are answered here. Keep them apart:

Endpoint What it describes
threat-statistics Threat decisions recorded in the stored logs of your domain, in a time window.
threat-inventory, threat-indicators The current global reputation of IPv4 addresses. It is not the traffic of your domain, and it has no history.

It accepts only start and end, with the same window rules.

curl "$LOGS/threat-statistics/?start=2026-11-12T00:00:00Z&end=2026-11-12T01:00:00Z" \
-H "Authorization: Api-Key $DIAMWALL_API_KEY"
{
"diagnostic": "threat-statistics",
"data": {
"state": "available",
"reason": null,
"window_requests": "4",
"totals": {
"hits": "3",
"decisions": { "block": "1", "challenge": "1", "unknown": "1" },
"tiers": { "high": "1", "medium": "1", "low": "0", "unknown": "1" }
},
"countries": [
{ "country": "PT", "hits": "1" },
{ "country": "US", "hits": "1" },
{ "country": "unknown", "hits": "1" }
],
"hourly": [{ "start": "2026-11-12T00:00:00Z", "hits": "3" }]
}
}
  • tiers are the tiers recorded at the time of each request. They are not recalculated with today’s settings.
  • hourly buckets are in UTC. A missing bucket can be shown as zero only when state is available.
  • Keep countries and hourly in the order they arrive. An empty list is a valid answer.
  • With no stored requests, state is unavailable, window_requests is "0", totals is null and the lists are empty.
  • sources, false_positive_rate and precision are always null.

The inventory is a summary of the global reputation list: how many addresses are in each tier, in total, per source and per country. It takes no query parameter.

curl "$LOGS/threat-inventory/" \
-H "Authorization: Api-Key $DIAMWALL_API_KEY"
{
"diagnostic": "threat-inventory",
"data": {
"generated_at": "2026-11-14T12:00:00Z",
"classification": { "basis": "aggregate_global_score", "high_above": 80, "medium_from": 40 },
"tiers": { "high": "2", "medium": "1", "low": "0", "unknown": "0" },
"total": "3",
"sources": [
{ "source": "honeypot", "tiers": { "high": "2", "medium": "1", "low": "0", "unknown": "0" }, "total": "3" }
],
"countries": [
{ "country": "PT", "tiers": { "high": "2", "medium": "1", "low": "0", "unknown": "0" }, "total": "3" }
]
}
}
  • The tier of an address comes from its global score and the thresholds in classification.
  • One address can have several sources. Never add up the source totals to get the global total: use total.
  • The inventory keeps addresses last seen within three calendar months.
  • generated_at is when the answer was made, not when the list was last updated. The inventory can be up to 30 seconds old.
  • New sources can appear in sources at any time. Do not reject a name you have not seen before.

The indicators are the entries of the same global list, one address at a time.

curl "$LOGS/threat-indicators/?tier=high&country=PT&page_size=50" \
-H "Authorization: Api-Key $DIAMWALL_API_KEY"
{
"diagnostic": "threat-indicators",
"data": {
"items": [
{
"type": "ip",
"value": "192.0.2.xxx",
"tier": "high",
"score": 90,
"sources": ["honeypot"],
"country": "PT",
"asn": null,
"first_seen": "2026-11-13T12:00:00Z",
"last_seen": "2026-11-14T12:00:00Z",
"redacted": true
}
],
"page": { "number": 1, "limit": 50, "has_more": true, "truncated": false, "pagination": "live_offset", "maximum_page": 1000 }
}
}
Parameter Values
page From 1 to 1000. Without it, 1.
page_size From 1 to 100. Without it, 20.
tier high, medium, low or unknown.
source One exact source. The reference lists the accepted values.
country Two uppercase letters, or unknown.
asn AS followed by the number, such as AS64496.
ip One exact IPv4 address, with no mask.
  • The filters combine: an entry must match all of them. Each takes one value and can be sent only once.
  • Addresses are masked. value stays masked, with redacted: true, even when you filter by an exact ip.
  • score and asn can be null. A country of XX is answered as it is stored.
  • The list is live and sorted by IP, so entries can move between pages from one call to the next. There is no cursor.
  • has_more means there is another page you can read. truncated means entries remain beyond page 1000.
  • Credits. Each domain has a budget of 3000 credits a minute, shared by everyone who calls the API for that domain.

    Endpoint Cost
    threat-statistics 2 credits
    threat-inventory, threat-indicators 20 credits
    Everything else on this page 8 credits
  • Pages. One page is one read, and one page of a search is one search. Each costs the full price.

  • Out of credits. The call answers 429 TOO_MANY_REQUESTS, with the wait in details.retry_after_seconds.

  • Refused before spending. On the threat endpoints, an unknown or repeated parameter is refused before any credit is spent. A request the CDN itself refuses with 400 has already spent its credits.

  • Permissions. Reads need logs.view on the domain: its owner, a member of its organization with that permission, or a collaborator who was granted it.

Status Code What happened
400 INVALID_REQUEST A parameter or body field is wrong, unknown or repeated. When the answer has fields, it names what was refused.
404 DIAGNOSTIC_NOT_FOUND The diagnostic cannot be run. Asking again answers the same. Give the request_id to support.
406 NOT_ACCEPTABLE The Accept header asks for something other than JSON.
409 CURSOR_STALE The attack history changed while you were paging. Start from the first page.
409 DOMAIN_WITHOUT_KEY The domain is not active on the network yet. There is nothing to read.
415 UNSUPPORTED_MEDIA_TYPE The search body was not sent as application/json.
429 TOO_MANY_REQUESTS A limit was reached, per user or per domain. Wait details.retry_after_seconds.
429 RATE_LIMIT_EXCEEDED The CDN refused the domain. Until the wait is over, every request for it answers this.
503 DIAGNOSTIC_UNAVAILABLE What the diagnostic needs is down. Nothing in your request is wrong. Back off, then read again.
503 DIAGNOSTIC_FAILED A threat lookup timed out or was refused. Back off, then read again.
503 RESPONSE_TOO_LARGE The answer would be over 8 MiB, so none of it was sent. Ask for a smaller page or a narrower search.
503 STATE_CHANGING What you asked for kept changing while it was read. Back off, then read again.

The errors that come from the key itself, such as API_KEY_IP_NOT_ALLOWED, are on the Errors page.

Each row opens the endpoint in the API reference, with every parameter, rule and response.

Loading the endpoints...