{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/beel-es/json-schema/beel-es-request-log-single-response-schema.json",
  "title": "RequestLogSingleResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/beel-es-accountrequestlogs-api-openapi.yml#/components/schemas/RequestLogSingleResponse",
  "type": "object",
  "required": [
    "success",
    "data"
  ],
  "properties": {
    "success": {
      "type": "boolean"
    },
    "data": {
      "$ref": "#/$defs/RequestLogDetail"
    },
    "meta": {
      "$ref": "#/$defs/ResponseMeta"
    }
  },
  "$defs": {
    "Environment": {
      "type": "string",
      "description": "Mode a record lives in — its Test/Live twin. It decides where invoices, customers and\nquota are accounted.\n\nFor a company it also decides which AEAT its NIF is registered against: switching a\ncompany on in `PROD` is what registers it with the real AEAT, so `aeat_environment`\nis that same mode and uses this same enum.\n",
      "enum": [
        "TEST",
        "PROD"
      ]
    },
    "RequestLogDetail": {
      "description": "Full detail of a request, including bodies and headers.",
      "allOf": [
        {
          "$ref": "#/$defs/RequestLogSummary"
        },
        {
          "type": "object",
          "properties": {
            "query_string": {
              "type": [
                "string",
                "null"
              ]
            },
            "user_agent": {
              "type": [
                "string",
                "null"
              ]
            },
            "request_body": {
              "type": [
                "string",
                "null"
              ],
              "description": "Request body (truncated by the ingestor; no sensitive headers)."
            },
            "response_body": {
              "type": [
                "string",
                "null"
              ],
              "description": "Response body (truncated by the ingestor)."
            },
            "request_headers": {
              "type": [
                "object",
                "null"
              ],
              "additionalProperties": {
                "type": "string"
              }
            },
            "response_headers": {
              "type": [
                "object",
                "null"
              ],
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        }
      ]
    },
    "RequestLogSummary": {
      "type": "object",
      "description": "Summary of an API request (list view).",
      "required": [
        "request_id",
        "timestamp",
        "http_method",
        "http_path",
        "http_status"
      ],
      "properties": {
        "request_id": {
          "type": "string",
          "description": "Request correlation identifier (X-Request-Id header)."
        },
        "timestamp": {
          "type": "string",
          "format": "date-time",
          "description": "Time the request was received."
        },
        "http_method": {
          "type": "string"
        },
        "http_path": {
          "type": "string"
        },
        "http_status": {
          "type": "integer"
        },
        "duration_ms": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64",
          "description": "Request latency in milliseconds."
        },
        "environment": {
          "allOf": [
            {
              "$ref": "#/$defs/Environment"
            }
          ]
        },
        "api_key_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "Id of the API key the request authenticated with."
        },
        "error_code": {
          "type": [
            "string",
            "null"
          ],
          "description": "Public error code returned (e.g. INVOICE_NOT_FOUND). Null if the request succeeded."
        },
        "client_ip": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "ResponseMeta": {
      "type": "object",
      "properties": {
        "timestamp": {
          "type": "string",
          "format": "date-time"
        },
        "request_id": {
          "type": "string"
        }
      }
    }
  }
}