导出请求日志

OpenAPI 契约

方法
GET
路径
/api/v1/request-logs/export
认证
jwtBearer (bearer) OR automationKey (bearer)
响应状态
200 400 401 403 429 500
请求与响应 Schema
JSON
{
  "requestBody": {},
  "responses": {
    "200": {
      "description": "CSV export",
      "content": {
        "text/csv": {
          "format": "binary",
          "type": "string"
        }
      }
    },
    "400": {
      "description": "Invalid request",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/RequestError"
        }
      }
    },
    "401": {
      "description": "Authentication required or invalid",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "403": {
      "description": "Authenticated but not permitted",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "429": {
      "description": "Rate limit exceeded",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "500": {
      "description": "Unexpected server error",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    }
  }
}

GET /api/v1/request-logs/export 接受 JWT 或带 analytics:read 的 nfy_ 密钥。除 page 和 size 外,它接受与列表端点相同的过滤条件(search、method、status、statusClass、path、apiKeyId、minLatencyMs、maxLatencyMs、from、to),并以 text/csv 下载的形式返回最多 10,000 条匹配记录,按时间从新到旧排列,并带有 Content-Disposition 文件名。

CSV 以一行表头开始(id,userId,apiKeyId,apiKeyPrefix,authType,method,path,queryString,statusCode,latencyMs,clientIp,userAgent,createdAt),之后每条匹配记录各占一行。以 =、+、-、@、制表符或换行符开头的字段会加上 ' 前缀,以防止电子表格公式注入。

http
GET /api/v1/request-logs/export?statusClass=5xx&from=2026-06-01T00:00:00Z
Authorization: Bearer <access token>