> ## Documentation Index
> Fetch the complete documentation index at: https://phaseo.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 列出工作区审计事件

> 列出已验证工作区中与安全相关的控制平面更改。

<Note>
  此端点需要 `activity:read` 管理权限。OAuth 调用方还必须具有工作区所有者或管理员角色。
</Note>

事件仅包含经过清理的元数据。不会返回明文凭据、凭据哈希、授权标头、完整权限范围列表或请求正文。


## OpenAPI

````yaml zh-Hans/openapi/v1/openapi.localized.yaml GET /audit-events
openapi: 3.0.3
info:
  title: Phaseo Gateway API
  description: 通过兼容 OpenAI 的端点访问各种 AI 模型的网关 API。
  version: 1.0.0
  contact:
    name: Phaseo
    url: https://phaseo.app
    email: danielbutler500@gmail.com
servers:
  - url: https://api.phaseo.app/v1
    description: 全球路由
security:
  - BearerAuth: []
tags:
  - name: Gateway
    description: Core Phaseo Gateway operations.
paths:
  /audit-events:
    get:
      tags:
        - Gateway
      summary: 列出工作区审计事件
      description: 返回已认证工作区中与安全相关的控制平面变更。需要 owner 或 admin 身份，以及 `activity:read` 管理能力。
      operationId: listWorkspaceAuditEvents
      parameters:
        - name: limit
          in: query
          description: 要返回的审计事件最大数量。
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: cursor
          in: query
          description: 上一页返回的不透明游标。
          schema:
            type: string
        - name: action
          in: query
          description: 按完全匹配的审计操作筛选。
          schema:
            type: string
        - name: target_type
          in: query
          description: 按完全匹配的审计目标类型筛选。
          schema:
            type: string
      responses:
        '200':
          description: 工作区审计事件
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceAuditEventListResponse'
        '400':
          description: 游标或查询无效
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: 未授权
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: 缺少活动权限范围或管理员角色
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: 服务器错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    WorkspaceAuditEventListResponse:
      type: object
      required:
        - data
        - has_more
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/WorkspaceAuditEvent'
        has_more:
          type: boolean
        next_cursor:
          type: string
          nullable: true
      additionalProperties: false
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        ok:
          type: boolean
          example: false
        error:
          oneOf:
            - type: string
            - type: object
              additionalProperties: true
          example: error_type
        message:
          type: string
          example: Human-readable error message
        description:
          type: string
          example: Additional error details.
        generation_id:
          type: string
          example: G-abc123
        status_code:
          type: integer
          example: 502
        error_type:
          type: string
          enum:
            - user
            - system
          example: system
        error_origin:
          type: string
          enum:
            - user
            - gateway
            - upstream
          example: upstream
        reason:
          type: string
          example: all_candidates_failed
        attempt_count:
          type: integer
          example: 2
        failed_providers:
          type: array
          items:
            type: string
          example:
            - google-ai-studio
            - openai
        failed_statuses:
          type: array
          items:
            type: integer
          example:
            - 403
            - 429
        upstream_error:
          $ref: '#/components/schemas/ErrorUpstreamError'
        failure_sample:
          type: array
          items:
            $ref: '#/components/schemas/ErrorFailureSampleItem'
        provider_failure_diagnostics:
          $ref: '#/components/schemas/ErrorProviderFailureDiagnostics'
        routing_diagnostics:
          $ref: '#/components/schemas/ErrorRoutingDiagnostics'
        provider_candidate_diagnostics:
          $ref: '#/components/schemas/ErrorProviderCandidateDiagnostics'
        provider_enablement:
          $ref: '#/components/schemas/ErrorProviderEnablementDiagnostics'
        missing_pricing_providers:
          type: array
          items:
            type: string
        provider_payment_required_provider:
          type: string
          example: openai
        provider_payment_required_support_notice:
          type: string
          example: >-
            Our upstream provider billing appears to be unavailable. If this
            persists, contact support.
        details:
          type: array
          items:
            type: object
            additionalProperties: true
      additionalProperties: true
    WorkspaceAuditEvent:
      type: object
      required:
        - id
        - workspace_id
        - action
        - target_type
        - target_id
        - metadata
        - created_at
      properties:
        id:
          type: string
          format: uuid
        workspace_id:
          type: string
          format: uuid
        actor_user_id:
          type: string
          format: uuid
          nullable: true
        actor:
          allOf:
            - $ref: '#/components/schemas/WorkspaceAuditEventActor'
          nullable: true
        action:
          type: string
          example: api_key.rotated
        target_type:
          type: string
          example: api_key
        target_id:
          type: string
        target_name:
          type: string
          nullable: true
        metadata:
          $ref: '#/components/schemas/WorkspaceAuditEventMetadata'
        request_id:
          type: string
          nullable: true
        created_at:
          type: string
          format: date-time
      additionalProperties: false
    ErrorUpstreamError:
      type: object
      properties:
        code:
          type: string
          nullable: true
          example: PERMISSION_DENIED
        message:
          type: string
          nullable: true
          example: The caller does not have permission.
        description:
          type: string
          nullable: true
        param:
          type: string
          nullable: true
    ErrorFailureSampleItem:
      type: object
      properties:
        provider:
          type: string
          nullable: true
        type:
          type: string
          nullable: true
        status:
          type: integer
          nullable: true
        upstream_error_code:
          type: string
          nullable: true
        upstream_error_message:
          type: string
          nullable: true
        upstream_error_description:
          type: string
          nullable: true
        upstream_error_param:
          type: string
          nullable: true
        upstream_payload_preview:
          type: string
          nullable: true
        retryable:
          type: boolean
          nullable: true
      additionalProperties: true
    ErrorProviderFailureDiagnostics:
      type: object
      properties:
        category:
          type: string
          enum:
            - credentials_not_configured
            - credentials_invalid_or_forbidden
            - provider_access_missing
            - region_or_project_restriction
            - model_unavailable_for_endpoint
            - rate_limited
            - server_error
        hint:
          type: string
        provider:
          type: string
          nullable: true
    ErrorRoutingDiagnostics:
      type: object
      properties:
        filterStages:
          type: array
          items:
            type: object
            properties:
              stage:
                type: string
              beforeCount:
                type: integer
              afterCount:
                type: integer
              droppedProviders:
                type: array
                items:
                  type: object
                  properties:
                    providerId:
                      type: string
                      nullable: true
                    reason:
                      type: string
                      nullable: true
                  additionalProperties: true
            additionalProperties: true
      additionalProperties: true
    ErrorProviderCandidateDiagnostics:
      type: object
      properties:
        totalProviders:
          type: integer
        supportsEndpointCount:
          type: integer
        candidateCount:
          type: integer
        droppedUnsupportedEndpoint:
          type: array
          items:
            type: string
        droppedMissingAdapter:
          type: array
          items:
            type: object
            properties:
              providerId:
                type: string
                nullable: true
              endpoint:
                type: string
                nullable: true
            additionalProperties: true
      additionalProperties: true
    ErrorProviderEnablementDiagnostics:
      type: object
      properties:
        capability:
          type: string
        providersBefore:
          type: array
          items:
            type: string
        providersAfter:
          type: array
          items:
            type: string
        dropped:
          type: array
          items:
            type: object
            properties:
              providerId:
                type: string
                nullable: true
              reason:
                type: string
                nullable: true
            additionalProperties: true
      additionalProperties: true
    WorkspaceAuditEventActor:
      type: object
      properties:
        display_name:
          type: string
          nullable: true
        email:
          type: string
          format: email
          nullable: true
      additionalProperties: false
    WorkspaceAuditEventMetadata:
      type: object
      properties:
        prefix:
          type: string
          nullable: true
        status:
          type: string
        changedFields:
          type: array
          items:
            type: string
        limits:
          $ref: '#/components/schemas/WorkspaceAuditEventLimits'
        replacementKeyId:
          type: string
        replacementKeyName:
          type: string
        previousKeyExpiresAt:
          type: string
          format: date-time
          nullable: true
        accessTemplate:
          type: string
        expiresAt:
          type: string
          format: date-time
          nullable: true
      additionalProperties: true
    WorkspaceAuditEventLimits:
      type: object
      properties:
        dailyRequests:
          type: integer
          minimum: 0
        weeklyRequests:
          type: integer
          minimum: 0
        monthlyRequests:
          type: integer
          minimum: 0
        dailyCostNanos:
          type: integer
          minimum: 0
        weeklyCostNanos:
          type: integer
          minimum: 0
        monthlyCostNanos:
          type: integer
          minimum: 0
        softBlocked:
          type: boolean
      additionalProperties: false
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Bearer 令牌身份验证

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.