---
title: "useAuditLog"
description: "useAuditLog, auto-imported in the app: its options, return value and types."
canonical_url: "https://nuxt-backend.dev/docs/reference/api/use-audit-log"
---
# useAuditLog

Version: nuxt-backend 0.6.x · Tab: Reference · Kind: reference · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

## Interfaces

### AuditLogApi

Defined in: [src/runtime/vue/composables/use-audit-log.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts)

The reads re-exported from your `backend/audit.ts`.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="listactivity">
        
      </a>
      
       <code>
        listActivity?
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "public"
      </code>
      
      , <a href="#auditpageargs">
        <code>
          AuditPageArgs
        </code>
      </a>
      
      , <a href="https://nuxt-backend.dev/docs/reference/api/audit#auditpage">
        <code>
          AuditPage
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts" rel="nofollow">
        src/runtime/vue/composables/use-audit-log.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="listworkspaceactivity">
        
      </a>
      
       <code>
        listWorkspaceActivity?
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "public"
      </code>
      
      , <a href="#auditpageargs">
        <code>
          AuditPageArgs
        </code>
      </a>
      
      , <a href="https://nuxt-backend.dev/docs/reference/api/audit#auditpage">
        <code>
          AuditPage
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts" rel="nofollow">
        src/runtime/vue/composables/use-audit-log.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="listallactivity">
        
      </a>
      
       <code>
        listAllActivity?
      </code>
    </td>
    
    <td>
      <a href="https://docs.convex.dev/api/modules/server#functionreference" rel="nofollow">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      , <code>
        "public"
      </code>
      
      , <a href="#auditpageargs">
        <code>
          AuditPageArgs
        </code>
      </a>
      
      , <a href="https://nuxt-backend.dev/docs/reference/api/audit#auditpage">
        <code>
          AuditPage
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts" rel="nofollow">
        src/runtime/vue/composables/use-audit-log.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### UseAuditLogOptions

Defined in: [src/runtime/vue/composables/use-audit-log.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="scope">
        
      </a>
      
       <code>
        scope?
      </code>
    </td>
    
    <td>
      <code>
        MaybeRefOrGetter
      </code>
      
      <<a href="#auditscope">
        <code>
          AuditScope
        </code>
      </a>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      Whose activity (reactive). Default <code>
        'mine'
      </code>
      
      . Changing it, or who reads it (another account signed in, another workspace made active), goes back to the first page.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts" rel="nofollow">
        src/runtime/vue/composables/use-audit-log.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="limit">
        
      </a>
      
       <code>
        limit?
      </code>
    </td>
    
    <td>
      <code>
        MaybeRefOrGetter
      </code>
      
      <<code>
        number
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      Events per page (reactive), at most 100. Default 20. Changing it goes back to the first page.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts" rel="nofollow">
        src/runtime/vue/composables/use-audit-log.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="api">
        
      </a>
      
       <code>
        api?
      </code>
    </td>
    
    <td>
      <a href="#auditlogapi">
        <code>
          AuditLogApi
        </code>
      </a>
    </td>
    
    <td>
      Override the injected <code>
        api.audit
      </code>
      
       namespace.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts" rel="nofollow">
        src/runtime/vue/composables/use-audit-log.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### UseAuditLogReturn

Defined in: [src/runtime/vue/composables/use-audit-log.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="events">
        
      </a>
      
       <code>
        events
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      < | <a href="https://nuxt-backend.dev/docs/reference/api/audit#auditentry">
        <code>
          AuditEntry
        </code>
      </a>
      
      <span>
        
      </span>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      The page in view, newest first, live: an event recorded while the first page is in view appears at its top. <code>
        []
      </code>
      
       when signed out, when the caller may not read this scope, and when nothing was recorded; <code>
        undefined
      </code>
      
       while the session or the page is still being read.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts" rel="nofollow">
        src/runtime/vue/composables/use-audit-log.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="page">
        
      </a>
      
       <code>
        page
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        number
      </code>
      
      >
    </td>
    
    <td>
      The page in view, from 1.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts" rel="nofollow">
        src/runtime/vue/composables/use-audit-log.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="hasmore">
        
      </a>
      
       <code>
        hasMore
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      Whether an older page exists.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts" rel="nofollow">
        src/runtime/vue/composables/use-audit-log.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="hasprevious">
        
      </a>
      
       <code>
        hasPrevious
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      Whether a newer page exists.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts" rel="nofollow">
        src/runtime/vue/composables/use-audit-log.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="isloading">
        
      </a>
      
       <code>
        isLoading
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <code>
        true
      </code>
      
       while the page in view is being read.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts" rel="nofollow">
        src/runtime/vue/composables/use-audit-log.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="isrefused">
        
      </a>
      
       <code>
        isRefused
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <code>
        true
      </code>
      
       once the read answered that this caller may not read the scope: a member who manages nothing, or someone who is no administrator.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts" rel="nofollow">
        src/runtime/vue/composables/use-audit-log.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="error">
        
      </a>
      
       <code>
        error
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      < | <a href="https://nuxt-backend.dev/docs/reference/api/functions#backenderror">
        <code>
          BackendError
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      Why the page could not be read, else <code>
        null
      </code>
      
      . Reads never reject.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts" rel="nofollow">
        src/runtime/vue/composables/use-audit-log.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="next">
        
      </a>
      
       <code>
        next
      </code>
    </td>
    
    <td>
      () => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Show the next, older page once it is read (no-op on the last).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts" rel="nofollow">
        src/runtime/vue/composables/use-audit-log.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="previous">
        
      </a>
      
       <code>
        previous
      </code>
    </td>
    
    <td>
      () => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Show the previous, newer page once it is read (no-op on the first).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts" rel="nofollow">
        src/runtime/vue/composables/use-audit-log.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="reset">
        
      </a>
      
       <code>
        reset
      </code>
    </td>
    
    <td>
      () => <code>
        void
      </code>
    </td>
    
    <td>
      Back to the first page, the newest events.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts" rel="nofollow">
        src/runtime/vue/composables/use-audit-log.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

## Type Aliases

### AuditScope

```ts
type AuditScope = "mine" | "workspace" | "all";
```

Defined in: [src/runtime/vue/composables/use-audit-log.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts)

Whose activity to read:

- `mine`: what happened to the signed-in account, and in it;
- `workspace`: everything in the active workspace, for its owners and admins;
- `all`: every event, for the app's administrators.

---

### AuditPageArgs

```ts
type AuditPageArgs = {
  paginationOpts: {
     numItems: number;
     cursor: string | null;
  };
};
```

Defined in: [src/runtime/vue/composables/use-audit-log.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts)

A page request, as the reads take it: how many events, and the cursor the page before ended at.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="paginationopts">
        
      </a>
      
       <code>
        paginationOpts
      </code>
    </td>
    
    <td>
      { <code>
        numItems
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        cursor
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; }
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts" rel="nofollow">
        src/runtime/vue/composables/use-audit-log.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        paginationOpts.numItems
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts" rel="nofollow">
        src/runtime/vue/composables/use-audit-log.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        paginationOpts.cursor
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts" rel="nofollow">
        src/runtime/vue/composables/use-audit-log.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

## Functions

### useAuditLog()

```ts
function useAuditLog(options?): UseAuditLogReturn;
```

Defined in: [src/runtime/vue/composables/use-audit-log.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-audit-log.ts)

The activity trail, a page at a time: the signed-in account's own (sign-ins,
passkeys, email and session changes, workspaces joined, an administrator's
actions on it), the active workspace's for its owners and admins, or every
event for administrators. Each page is a live query over
`backend/audit.ts`; older pages are read by a cursor, so they hold still
while new events arrive at the top of the first.

Entries carry names, never addresses: who acted (`you`, another account,
an unnamed `administrator` in an account's own activity, the `app`, or an
`erased` account), the account it is about and the workspace.
Reads never throw: a failed read shows in `error`, and a scope the caller
may not read is empty, with `isRefused` set.

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="#useauditlogoptions">
        <code>
          UseAuditLogOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Returns

[`UseAuditLogReturn`](#useauditlogreturn)

#### Example

```vue
<script setup lang="ts">
const activity = useAuditLog({ scope: 'workspace', limit: 10 })
</script>
<template>
  <p v-for="event in activity.events.value" :key="event.id">{{ event.type }}</p>
  <button :disabled="!activity.hasMore.value" @click="activity.next()">Older</button>
</template>
```

## References

### AuditEntry

Re-exports [AuditEntry](https://nuxt-backend.dev/docs/reference/api/audit#auditentry)

---

### AuditParty

Re-exports [AuditParty](https://nuxt-backend.dev/docs/reference/api/audit#auditparty)


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
