{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/roar-ai-com/json-schema/roar-ai-com-client-app-request-page-schema.json",
  "title": "ClientAppRequestPage",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/roar-ai-com-openapi.json#/components/schemas/ClientAppRequestPage",
  "type": "object",
  "required": [
    "data",
    "nextCursor",
    "summary",
    "retentionDays"
  ],
  "properties": {
    "retentionDays": {
      "type": "integer",
      "description": "How many days of requests are kept. Older rows are deleted, so a window reaching further back returns no more."
    },
    "data": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "appId",
          "appName",
          "serviceId",
          "at",
          "method",
          "path",
          "status",
          "durationMs",
          "incomplete",
          "bytes",
          "host",
          "requestId",
          "reachedApp",
          "appStatus",
          "blocked"
        ],
        "properties": {
          "appId": {
            "type": "string",
            "format": "uuid"
          },
          "appName": {
            "type": "string"
          },
          "serviceId": {
            "type": "string",
            "format": "uuid"
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "method": {
            "type": "string"
          },
          "path": {
            "type": "string",
            "description": "Query parameter names kept, every value removed"
          },
          "status": {
            "type": "integer"
          },
          "durationMs": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Null when not reported, or when the response was incomplete"
          },
          "incomplete": {
            "type": "boolean",
            "description": "The response stopped before it finished (the visitor left, or the app broke off mid-response). The status is the one already sent; there is no duration."
          },
          "bytes": {
            "type": [
              "integer",
              "null"
            ]
          },
          "host": {
            "type": [
              "string",
              "null"
            ]
          },
          "requestId": {
            "type": [
              "string",
              "null"
            ],
            "description": "The `cf-ray`; null when the node did not report one"
          },
          "blocked": {
            "type": "boolean",
            "description": "Stopped by the security rules before reaching the app — a scanner or an attack. Listed only with `band=blocked`, and never counted as a request or an error."
          },
          "reachedApp": {
            "type": "boolean",
            "description": "False when the request never reached the app: it did not answer, or the caller gave up first. Such a row has no duration or size."
          },
          "appStatus": {
            "type": [
              "integer",
              "null"
            ],
            "description": "What the app answered, when the caller got something else (`status`) — the app finished after the caller had already been cut off. Null otherwise."
          }
        }
      }
    },
    "nextCursor": {
      "type": [
        "string",
        "null"
      ],
      "description": "Pass back as `cursor` for older requests; null on the last page"
    },
    "summary": {
      "$ref": "#/$defs/ClientAppRequestsSummary",
      "nullable": true,
      "description": "Over the whole window and every app — first page only, null after it"
    },
    "facets": {
      "type": [
        "object",
        "null"
      ],
      "description": "Counts over the window, not narrowed by the filters — first page only",
      "required": [
        "byApp",
        "byStatus",
        "byMethod",
        "byPath"
      ],
      "properties": {
        "byApp": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "appId",
              "requests",
              "appErrors"
            ],
            "properties": {
              "appId": {
                "type": "string",
                "format": "uuid"
              },
              "requests": {
                "type": "integer"
              },
              "appErrors": {
                "type": "integer"
              }
            }
          }
        },
        "byStatus": {
          "type": "object",
          "required": [
            "2xx",
            "3xx",
            "4xx",
            "5xx",
            "blocked"
          ],
          "properties": {
            "2xx": {
              "type": "integer"
            },
            "3xx": {
              "type": "integer"
            },
            "4xx": {
              "type": "integer"
            },
            "5xx": {
              "type": "integer"
            },
            "blocked": {
              "type": "integer",
              "description": "Stopped by the security rules; beside the classes, never inside them"
            }
          }
        },
        "byMethod": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "method",
              "requests"
            ],
            "properties": {
              "method": {
                "type": "string"
              },
              "requests": {
                "type": "integer"
              }
            }
          }
        },
        "byPath": {
          "type": "array",
          "description": "The ten busiest paths",
          "items": {
            "type": "object",
            "required": [
              "path",
              "requests",
              "appErrors",
              "badRequests"
            ],
            "properties": {
              "path": {
                "type": "string"
              },
              "requests": {
                "type": "integer"
              },
              "appErrors": {
                "type": "integer"
              },
              "badRequests": {
                "type": "integer"
              }
            }
          }
        }
      }
    },
    "series": {
      "type": [
        "array",
        "null"
      ],
      "description": "Requests per hour (per day past two days) over the FILTERED list — first page only",
      "items": {
        "type": "object",
        "required": [
          "bucket",
          "requests",
          "appErrors",
          "badRequests"
        ],
        "properties": {
          "bucket": {
            "type": "string",
            "format": "date-time"
          },
          "requests": {
            "type": "integer"
          },
          "appErrors": {
            "type": "integer"
          },
          "badRequests": {
            "type": "integer"
          }
        }
      }
    }
  },
  "$defs": {
    "ClientAppRequestsSummary": {
      "type": "object",
      "required": [
        "requests",
        "appErrors",
        "badRequests",
        "p95DurationMs",
        "p50DurationMs",
        "blocked"
      ],
      "properties": {
        "blocked": {
          "type": "integer",
          "description": "Stopped by the security rules before reaching the app — scanners and attacks. In none of the other counts."
        },
        "requests": {
          "type": "integer"
        },
        "appErrors": {
          "type": "integer",
          "description": "Status 500–599: the app broke"
        },
        "badRequests": {
          "type": "integer",
          "description": "Status 400–499: mostly crawlers on a public app"
        },
        "p95DurationMs": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Over requests that finished with a reported duration (incomplete ones are left out); null when none had one"
        },
        "p50DurationMs": {
          "type": [
            "integer",
            "null"
          ],
          "description": "The median over the same requests as p95DurationMs; null when none had a reported duration"
        }
      }
    }
  }
}