## List audit events

**get** `/api/v1/audit/events`

List audit events

### Query Parameters

- `action: optional string`

- `environment: optional "sandbox" or "production"`

  Environment to list audit events from. Defaults to sandbox when omitted.

  - `"sandbox"`

  - `"production"`

- `from: optional string`

- `outcome: optional "success" or "client_error" or "server_error"`

  - `"success"`

  - `"client_error"`

  - `"server_error"`

- `page: optional number`

- `per_page: optional number`

- `target_id: optional string`

- `target_type: optional string`

- `to: optional string`

### Returns

- `data: array of object { id, action, actor, 12 more }`

  - `id: string`

  - `action: "users.business.register" or "users.auth.login" or "users.auth.refresh" or 13 more`

    - `"users.business.register"`

    - `"users.auth.login"`

    - `"users.auth.refresh"`

    - `"users.auth.revoke"`

    - `"users.password_reset.request"`

    - `"users.password_reset.complete"`

    - `"users.beta.apply"`

    - `"users.api_key.create"`

    - `"users.api_key.revoke"`

    - `"accounts.account.create"`

    - `"accounts.account.update_status"`

    - `"accounts.account.close"`

    - `"accounts.money.deposit"`

    - `"accounts.money.withdraw"`

    - `"accounts.money.transfer"`

    - `"ledger.transaction.post"`

  - `actor: object { id, type, roles }`

    - `id: string`

    - `type: "user" or "api_key" or "internal_service" or "anonymous"`

      - `"user"`

      - `"api_key"`

      - `"internal_service"`

      - `"anonymous"`

    - `roles: optional array of string`

  - `correlation_id: string`

  - `created_at: string`

  - `environment: "sandbox" or "production"`

    - `"sandbox"`

    - `"production"`

  - `metadata: map[string]`

  - `occurred_at: string`

  - `organization_id: string`

  - `outcome: "success" or "client_error" or "server_error"`

    - `"success"`

    - `"client_error"`

    - `"server_error"`

  - `request: object { id, method, path, 2 more }`

    - `id: string`

    - `method: string`

    - `path: string`

    - `ip: optional string`

    - `user_agent: optional string`

  - `schema_version: 1`

    - `1`

  - `source_service: "users" or "accounts" or "ledger"`

    - `"users"`

    - `"accounts"`

    - `"ledger"`

  - `target: object { id, type }`

    - `id: string`

    - `type: string`

  - `reason: optional string`

- `pagination: object { page, per_page, total_count, total_pages }`

  - `page: number`

  - `per_page: number`

  - `total_count: number`

  - `total_pages: number`

### Example

```http
curl https://rails-client-server-staging.up.railway.app/api/v1/audit/events \
    -H "X-API-Key: $RAILS_API_KEY"
```

#### Response

```json
{
  "data": [
    {
      "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "action": "users.business.register",
      "actor": {
        "id": "id",
        "type": "user",
        "roles": [
          "string"
        ]
      },
      "correlation_id": "correlation_id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "environment": "sandbox",
      "metadata": {
        "foo": "string"
      },
      "occurred_at": "2019-12-27T18:11:19.117Z",
      "organization_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "outcome": "success",
      "request": {
        "id": "id",
        "method": "method",
        "path": "path",
        "ip": "ip",
        "user_agent": "user_agent"
      },
      "schema_version": 1,
      "source_service": "users",
      "target": {
        "id": "id",
        "type": "type"
      },
      "reason": "reason"
    }
  ],
  "pagination": {
    "page": 1,
    "per_page": 1,
    "total_count": 0,
    "total_pages": 0
  }
}
```
