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

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

### AdminApiRefs

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

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

#### Properties

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

<tbody>
  <tr>
    <td>
      <a id="listusers">
        
      </a>
      
       <code>
        listUsers?
      </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="#adminpageargs">
        <code>
          AdminPageArgs
        </code>
      </a>
      
      , | <a href="https://nuxt-backend.dev/docs/reference/api/admin#adminuserpage">
        <code>
          AdminUserPage
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="getuser">
        
      </a>
      
       <code>
        getUser?
      </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>
      
      , { <code>
        userId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | <a href="https://nuxt-backend.dev/docs/reference/api/admin#adminuserdetail">
        <code>
          AdminUserDetail
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="listworkspaces">
        
      </a>
      
       <code>
        listWorkspaces?
      </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="#adminpageargs">
        <code>
          AdminPageArgs
        </code>
      </a>
      
      , | <a href="https://nuxt-backend.dev/docs/reference/api/admin#adminworkspacepage">
        <code>
          AdminWorkspacePage
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="getworkspace">
        
      </a>
      
       <code>
        getWorkspace?
      </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>
      
      , { <code>
        workspaceId
      </code>
      
      : <code>
        string
      </code>
      
      ; }, | <a href="https://nuxt-backend.dev/docs/reference/api/admin#adminworkspacedetail">
        <code>
          AdminWorkspaceDetail
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### AdminBanOptions

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

How long a ban lasts, and why.

#### Properties

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

<tbody>
  <tr>
    <td>
      <a id="reason">
        
      </a>
      
       <code>
        reason?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Why, as the administrator words it. Kept on the account, never on the activity trail.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="expiresin">
        
      </a>
      
       <code>
        expiresIn?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Seconds until the ban lifts by itself. Left out, it lasts until lifted.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### UseAdminOptions

Defined in: [src/runtime/vue/composables/use-admin.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.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="list">
        
      </a>
      
       <code>
        list?
      </code>
    </td>
    
    <td>
      <code>
        MaybeRefOrGetter
      </code>
      
      <<a href="#adminlist">
        <code>
          AdminList
        </code>
      </a>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      Which list (reactive): <code>
        users
      </code>
      
      , the default, or <code>
        workspaces
      </code>
      
      . 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-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="search-1">
        
      </a>
      
       <code>
        search?
      </code>
    </td>
    
    <td>
      <code>
        MaybeRefOrGetter
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      Keep the rows that match (reactive): accounts whose address contains it, in lower case; workspaces whose name contains it, as typed. 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-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.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>
      Rows 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-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="userid">
        
      </a>
      
       <code>
        userId?
      </code>
    </td>
    
    <td>
      <code>
        MaybeRefOrGetter
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        null
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      The account <code>
        user
      </code>
      
       reads in full (reactive); nothing while <code>
        null
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="workspaceid">
        
      </a>
      
       <code>
        workspaceId?
      </code>
    </td>
    
    <td>
      <code>
        MaybeRefOrGetter
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        null
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      The workspace <code>
        workspace
      </code>
      
       reads in full (reactive); nothing while <code>
        null
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="api">
        
      </a>
      
       <code>
        api?
      </code>
    </td>
    
    <td>
      <a href="#adminapirefs">
        <code>
          AdminApiRefs
        </code>
      </a>
    </td>
    
    <td>
      Override the injected <code>
        api.admin
      </code>
      
       namespace.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### UseAdminReturn

Defined in: [src/runtime/vue/composables/use-admin.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.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="users">
        
      </a>
      
       <code>
        users
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      < | <a href="https://nuxt-backend.dev/docs/reference/api/admin#adminuser">
        <code>
          AdminUser
        </code>
      </a>
      
      <span>
        
      </span>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      The page of accounts in view, newest first, live; <code>
        []
      </code>
      
       for a caller who is no administrator, <code>
        undefined
      </code>
      
       while it is read or while the list is <code>
        workspaces
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="workspaces">
        
      </a>
      
       <code>
        workspaces
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      < | <a href="https://nuxt-backend.dev/docs/reference/api/admin#adminworkspace">
        <code>
          AdminWorkspace
        </code>
      </a>
      
      <span>
        
      </span>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      The page of workspaces in view, newest first, live; <code>
        []
      </code>
      
       for a caller who is no administrator, <code>
        undefined
      </code>
      
       while it is read or while the list is <code>
        users
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.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-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="hasmore">
        
      </a>
      
       <code>
        hasMore
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      Whether a later page exists.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="hasprevious">
        
      </a>
      
       <code>
        hasPrevious
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      Whether an earlier page exists.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="user">
        
      </a>
      
       <code>
        user
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      < | <a href="https://nuxt-backend.dev/docs/reference/api/admin#adminuserdetail">
        <code>
          AdminUserDetail
        </code>
      </a>
      
       | <code>
        null
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      The account <code>
        userId
      </code>
      
       names, with its workspaces and sessions, live; <code>
        null
      </code>
      
       when there is none (or the caller may not read it), <code>
        undefined
      </code>
      
       while it is read.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="workspace">
        
      </a>
      
       <code>
        workspace
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      < | <a href="https://nuxt-backend.dev/docs/reference/api/admin#adminworkspacedetail">
        <code>
          AdminWorkspaceDetail
        </code>
      </a>
      
       | <code>
        null
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      The workspace <code>
        workspaceId
      </code>
      
       names, with its members and open invitations, live; <code>
        null
      </code>
      
       when there is none, <code>
        undefined
      </code>
      
       while it is read.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.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, or a detail asked for, is being read.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.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 list answered that this caller is no administrator.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="ispending">
        
      </a>
      
       <code>
        isPending
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <code>
        true
      </code>
      
       while an action runs.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.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 last action failed, else why a read failed, else <code>
        null
      </code>
      
      . Reads never reject.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.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 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-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.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 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-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.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.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="setrole">
        
      </a>
      
       <code>
        setRole
      </code>
    </td>
    
    <td>
      (<code>
        userId
      </code>
      
      , <code>
        role
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Set an account's app-wide role. Takes a recent sign-in. Rejects on failure.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="ban">
        
      </a>
      
       <code>
        ban
      </code>
    </td>
    
    <td>
      (<code>
        userId
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Ban an account: it cannot sign in, and every session it has is signed out. Takes a recent sign-in. Rejects on failure.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="unban">
        
      </a>
      
       <code>
        unban
      </code>
    </td>
    
    <td>
      (<code>
        userId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Lift an account's ban. Takes a recent sign-in. Rejects on failure.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="allowsignincodes">
        
      </a>
      
       <code>
        allowSignInCodes
      </code>
    </td>
    
    <td>
      (<code>
        userId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Turn a passkey-only account's sign-in codes back on, for a person who lost every passkey and the recovery code: check who asks first, out of band. Takes a recent sign-in. Rejects on failure.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="revokesessions">
        
      </a>
      
       <code>
        revokeSessions
      </code>
    </td>
    
    <td>
      (<code>
        userId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Sign every session of an account out. Rejects on failure.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="impersonate">
        
      </a>
      
       <code>
        impersonate
      </code>
    </td>
    
    <td>
      (<code>
        userId
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Act as an account: the browser's session becomes a visit of theirs, thirty minutes at most, refused anything sensitive, until <a href="#stopimpersonating">
        UseAdminReturn.stopImpersonating
      </a>
      
      . With <code>
        workspaceId
      </code>
      
      , the visit opens in that workspace, where they are a member. An administrator's account is never visited (<code>
        forbidden
      </code>
      
      , reason <code>
        admin_target
      </code>
      
      ). Takes a recent sign-in. Resolves once the session is theirs, even when the workspace could not be made active (why stays in <code>
        error
      </code>
      
      ): reload or navigate after it, so every live query reads as them. Rejects only when no visit began.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="stopimpersonating">
        
      </a>
      
       <code>
        stopImpersonating
      </code>
    </td>
    
    <td>
      () => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      End a visit and go back to the administrator's own session: what the <code>
        impersonation
      </code>
      
       notice of <code>
        <BackendNotices>
      </code>
      
       calls, on the visited account's pages. Resolves once the session is the administrator's again; rejects on failure, which <code>
        error
      </code>
      
       keeps. Reload or navigate after it: every live query re-reads as the administrator.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

## Type Aliases

### AdminList

```ts
type AdminList = "users" | "workspaces";
```

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

Which list `useAdmin` pages through: every account, or every workspace.

---

### AdminPageArgs

```ts
type AdminPageArgs = {
  search?: string;
  paginationOpts: {
     numItems: number;
     cursor: string | null;
  };
};
```

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

A page request, as the list reads take it: the search, how many rows, 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="search">
        
      </a>
      
       <code>
        search?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
  
  <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-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.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-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.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-admin.ts" rel="nofollow">
        src/runtime/vue/composables/use-admin.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

## Functions

### useAdmin()

```ts
function useAdmin(options?): UseAdminReturn;
```

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

The admin console's data and actions: a paged, searchable list of every
account or every workspace, one account or workspace in full, and the
administrator's actions on an account. The reads are live queries over
`backend/admin.ts` (`setupAdmin`), each answering only an administrator
whose role is read fresh; the actions are Better Auth's admin routes,
which the server holds to the sensitive-action table: setting a role,
banning, lifting a ban and impersonating take a recent sign-in
(`useReauthentication().withReauthentication` asks for one), and each
spends the per-caller `admin` limit.

Workspaces are read-only: an administrator acts inside one by
impersonating a member. Reads never reject; a caller who is no
administrator gets empty lists and `isRefused`.

#### Parameters

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

<tbody>
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="#useadminoptions">
        <code>
          UseAdminOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Returns

[`UseAdminReturn`](#useadminreturn)

#### Example

```vue
<script setup lang="ts">
const search = ref('')
const admin = useAdmin({ search })
const { withReauthentication } = useReauthentication()
const ban = (id: string) => withReauthentication(() => admin.ban(id, { reason: 'Spam' }))
</script>
<template>
  <input v-model="search" type="search">
  <p v-for="user in admin.users.value" :key="user.id">
    {{ user.email }} <button @click="ban(user.id)">Ban</button>
  </p>
</template>
```

## References

### AdminSession

Re-exports [AdminSession](https://nuxt-backend.dev/docs/reference/api/admin#adminsession)

---

### AdminUser

Re-exports [AdminUser](https://nuxt-backend.dev/docs/reference/api/admin#adminuser)

---

### AdminUserDetail

Re-exports [AdminUserDetail](https://nuxt-backend.dev/docs/reference/api/admin#adminuserdetail)

---

### AdminWorkspace

Re-exports [AdminWorkspace](https://nuxt-backend.dev/docs/reference/api/admin#adminworkspace)

---

### AdminWorkspaceDetail

Re-exports [AdminWorkspaceDetail](https://nuxt-backend.dev/docs/reference/api/admin#adminworkspacedetail)

---

### AdminWorkspaceMember

Re-exports [AdminWorkspaceMember](https://nuxt-backend.dev/docs/reference/api/admin#adminworkspacemember)


## Sitemap

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