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

# Get a list of users



## OpenAPI

````yaml openapi-admin get /users
openapi: 3.0.3
info:
  version: 1.2.0
  title: Hanko Admin API
  description: >
    ## Introduction


    This is the OpenAPI specification for the [Hanko Admin
    API](https://github.com/teamhanko/hanko/blob/main/backend/README.md#start-private-api).


    ## Authentication


    The Admin API must be protected by an access management system.


    ---
  contact:
    email: developers@hanko.io
  license:
    name: AGPL-3.0-or-later
    url: https://www.gnu.org/licenses/agpl-3.0.txt
servers:
  - url: https://{tenant_id}.hanko.io/admin
    variables:
      tenant_id:
        default: ''
        description: The (UU)ID of a tenant. Replace the default value with your tenant ID.
security: []
externalDocs:
  description: More about Hanko
  url: https://github.com/teamhanko/hanko
paths:
  /users:
    get:
      tags:
        - User Management
      summary: Get a list of users
      operationId: listUsers
      parameters:
        - in: query
          name: page
          schema:
            type: integer
            default: 1
          description: The page which should be returned
        - in: query
          name: per_page
          schema:
            type: integer
            default: 20
          description: The number of returned items
        - in: query
          name: user_id
          schema:
            allOf:
              - $ref: '#/components/schemas/UUID4'
            example: c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c
          description: >
            A single ID or a comma-separated list of IDs. Only users with the
            specified IDs are included in the result.
        - in: query
          name: email
          schema:
            type: string
            format: email
            example: example@example.com
          description: Only users with the specified email are included
        - in: query
          name: sort_direction
          schema:
            type: string
            enum:
              - asc
              - desc
          description: >-
            The sort direction of the returned list (always sorted by
            created_at)
      responses:
        '200':
          description: Details about users
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/UserBase'
          headers:
            X-Total-Count:
              $ref: '#/components/headers/X-Total-Count'
            Link:
              $ref: '#/components/headers/Link'
        '400':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - BearerApiKeyAuth: []
components:
  schemas:
    UUID4:
      type: string
      format: uuid4
      example: c339547d-e17d-4ba7-8a1d-b3d5a4d17c1c
    UserBase:
      type: object
      required:
        - id
        - created_at
        - updated_at
      properties:
        id:
          description: The ID of the user
          allOf:
            - $ref: '#/components/schemas/UUID4'
        created_at:
          description: Time of creation of the user
          type: string
          format: date-time
        updated_at:
          description: Time of last update of the user
          type: string
          format: date-time
        webauthn_credentials:
          description: List of registered Webauthn credentials
          type: array
          items:
            $ref: '#/components/schemas/WebAuthnCredential'
        emails:
          description: List of emails associated to the user
          type: array
          items:
            $ref: '#/components/schemas/Email'
        username:
          $ref: '#/components/schemas/Username'
    WebAuthnCredential:
      type: object
      required:
        - id
        - public_key
        - attestation_type
        - aaguid
        - created_at
        - backup_eligible
        - backup_state
        - mfa_only
      properties:
        id:
          description: The ID of the credential
          allOf:
            - $ref: '#/components/schemas/UUID4'
          example: f9bebc04-b894-4018-bdb8-8b520a532fef
        name:
          description: A name that the user choose
          type: string
        public_key:
          description: The public key of the credential
          type: string
        attestation_type:
          description: The attestation type the credential was registered with
          type: string
        aaguid:
          description: The AAGUID of the authenticator the credentials was created on
          type: string
        transports:
          description: The ways the authenticator is connected
          type: array
          items:
            type: string
        created_at:
          description: Time of creation of the credential
          type: string
          format: date-time
        last_used_at:
          description: The time when the credential was last used
          type: string
          format: date-time
        backup_eligible:
          description: Indicates if the credential can be backed up
          type: boolean
        backup_state:
          description: Indicates if the credential is backed up
          type: boolean
        mfa_only:
          description: Indicates if the credential can only be used as a MFA credential
          type: boolean
    Email:
      type: object
      required:
        - id
        - address
        - is_verified
        - is_primary
        - created_at
        - updated_at
      properties:
        id:
          description: The ID of the email
          allOf:
            - $ref: '#/components/schemas/UUID4'
          example: 802df042-1ac2-496d-af81-6ace729ed055
        address:
          description: The email address
          type: string
          format: email
        is_verified:
          description: Indicated the email has been verified.
          type: boolean
        is_primary:
          description: Indicates it's the primary email address.
          type: boolean
        created_at:
          description: Time of creation of the email
          type: string
          format: date-time
        updated_at:
          description: Time of last update of the email
          type: string
          format: date-time
    Username:
      description: The username of the user
      type: object
      properties:
        id:
          allOf:
            - $ref: '#/components/schemas/UUID4'
          description: The ID of the username
          example: 8cbed467-554b-4d17-b23f-bce1b4f1db92
        created_at:
          description: Time of creation of the username
          type: string
          format: date-time
        updated_at:
          description: Time of last update of the username
          type: string
          format: date-time
        username:
          description: The username of the user
          type: string
          example: john_doe_123
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
  headers:
    X-Total-Count:
      schema:
        type: string
      description: The total count of the requested resource considering query parameter
      example: 1234
    Link:
      schema:
        type: string
      description: Web Linking as described in RFC5988
      example: >-
        <http://localhost:8001/resource?page=1&per_page=10>;
        rel="first",<http://localhost:8001/resource?page=16&per_page=10>;
        rel="last",<http://localhost:8001/resource?page=6&per_page=10>;
        rel="next",<http://localhost:8001/resource?page=4&per_page=10>;
        rel="prev"
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: 400
            message: Bad Request
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: 500
            message: Internal Server Error
  securitySchemes:
    BearerApiKeyAuth:
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your API key. Must only be used when using Hanko Cloud.
      type: http
      scheme: bearer
      bearerFormat: API Key

````