[GH-ISSUE #4103] Documentation for listUsers incorrect for client-side. #9829

Closed
opened 2026-04-13 05:34:51 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @tjwells85 on GitHub (Aug 20, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/4103

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Create better-auth client with the adminClient plugin:

import { createAuthClient } from 'better-auth/react';
import { passkeyClient } from 'better-auth/client/plugins';
import { adminClient } from 'better-auth/client/plugins';

export const authClient = createAuthClient({
	baseURL: import.meta.env.PUBLIC_AUTH_HOST,
	plugins: [passkeyClient(), adminClient()],
});

export const { signIn, signOut, getSession, useSession, passkey } = authClient;

Then attempt to call list users based on the documentation:

// Fetch all users, no filtering
const { data, error } = await authClient.admin.listUsers({}); // Should work if all params optional

// For these two, Typescript says that limit or offset are not valid properties
const { data, error } = await authClient.admin.listUsers({ limit: 200 });
const { data, error } = await authClient.admin.listUsers({ offset: 0 });

Current vs. Expected behavior

Current documentation, as of 8/20/2025 (I made sure to refresh the page) shows:

const { data: users, error } = await authClient.admin.listUsers({
    searchValue: "some name",
    searchField: "name",
    searchOperator: "contains",
    limit: 100,
    offset: 100,
    sortBy: "name",
    sortDirection: "desc",
    filterField: "email",
    filterValue: "hello@example.com",
    filterOperator: "eq",
});

But typescript will complain and expects a query object:

const { data, error } = await authClient.admin.listUsers({ query: {} });

Which does work, and I get my users as expected.

What version of Better Auth are you using?

1.3.7

System info

System:
    OS: Linux 6.6 Fedora Linux 42 (WSL)
    CPU: (16) x64 AMD Ryzen 7 9700X 8-Core Processor
    Memory: 25.39 GB / 30.19 GB
    Container: Yes
    Shell: 5.9 - /usr/sbin/zsh

Which area(s) are affected? (Select all that apply)

Documentation

Auth config (if applicable)


Additional context

No response

Originally created by @tjwells85 on GitHub (Aug 20, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/4103 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce Create better-auth client with the adminClient plugin: ```ts import { createAuthClient } from 'better-auth/react'; import { passkeyClient } from 'better-auth/client/plugins'; import { adminClient } from 'better-auth/client/plugins'; export const authClient = createAuthClient({ baseURL: import.meta.env.PUBLIC_AUTH_HOST, plugins: [passkeyClient(), adminClient()], }); export const { signIn, signOut, getSession, useSession, passkey } = authClient; ``` Then attempt to call list users based on the documentation: ```ts // Fetch all users, no filtering const { data, error } = await authClient.admin.listUsers({}); // Should work if all params optional // For these two, Typescript says that limit or offset are not valid properties const { data, error } = await authClient.admin.listUsers({ limit: 200 }); const { data, error } = await authClient.admin.listUsers({ offset: 0 }); ``` ### Current vs. Expected behavior Current documentation, as of 8/20/2025 (I made sure to refresh the page) shows: ```ts const { data: users, error } = await authClient.admin.listUsers({ searchValue: "some name", searchField: "name", searchOperator: "contains", limit: 100, offset: 100, sortBy: "name", sortDirection: "desc", filterField: "email", filterValue: "hello@example.com", filterOperator: "eq", }); ``` But typescript will complain and expects a query object: ```ts const { data, error } = await authClient.admin.listUsers({ query: {} }); ``` Which does work, and I get my users as expected. ### What version of Better Auth are you using? 1.3.7 ### System info ```bash System: OS: Linux 6.6 Fedora Linux 42 (WSL) CPU: (16) x64 AMD Ryzen 7 9700X 8-Core Processor Memory: 25.39 GB / 30.19 GB Container: Yes Shell: 5.9 - /usr/sbin/zsh ``` ### Which area(s) are affected? (Select all that apply) Documentation ### Auth config (if applicable) ```typescript ``` ### Additional context _No response_
GiteaMirror added the locked label 2026-04-13 05:34:51 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 20, 2025):

Hi @tjwells85! I'm Dosu and I’m helping the better-auth team.

You're right—the documentation for authClient.admin.listUsers is currently incorrect for client-side usage. The method expects parameters like limit, offset, and filters inside a query object (e.g., authClient.admin.listUsers({ query: { limit: 10 } })), not as top-level properties. Passing them at the top level will cause TypeScript errors, as you've seen. This mismatch is confirmed by issue #3033, and is enforced by the client plugin's type definitions.

To avoid errors, always wrap your parameters in a query object. The documentation should be updated to reflect this usage pattern.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

<!-- gh-comment-id:3206937669 --> @dosubot[bot] commented on GitHub (Aug 20, 2025): <!-- Greeting --> Hi @tjwells85! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> You're right—the documentation for `authClient.admin.listUsers` is currently incorrect for client-side usage. The method expects parameters like `limit`, `offset`, and filters inside a `query` object (e.g., `authClient.admin.listUsers({ query: { limit: 10 } })`), not as top-level properties. Passing them at the top level will cause TypeScript errors, as you've seen. This mismatch is confirmed by [issue #3033](https://github.com/better-auth/better-auth/issues/3033), and is enforced by the client plugin's type definitions. To avoid errors, always wrap your parameters in a `query` object. The documentation should be updated to reflect this usage pattern. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/f04160c7-a33a-4c1b-9c31-1564054a84ea?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/f04160c7-a33a-4c1b-9c31-1564054a84ea?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/f04160c7-a33a-4c1b-9c31-1564054a84ea?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/f04160c7-a33a-4c1b-9c31-1564054a84ea?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/f04160c7-a33a-4c1b-9c31-1564054a84ea?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/f04160c7-a33a-4c1b-9c31-1564054a84ea?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/f04160c7-a33a-4c1b-9c31-1564054a84ea?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/4103)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#9829