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

# Query users

> Use when listing or searching service accounts in an admin UI, or when auditing who has API access and which roles they have.



## OpenAPI

````yaml /api-reference/openapi.json post /users/search
openapi: 3.0.1
info:
  title: Flexprice API
  description: Flexprice API Service
  contact:
    name: API Support
  license:
    name: AGPL-3.0
    url: https://www.gnu.org/licenses/agpl-3.0.html
  version: '1.0'
servers:
  - url: https://us.api.flexprice.io/v1
    description: US Region
  - url: https://api.cloud.flexprice.io/v1
    description: India Region
security: []
paths:
  /users/search:
    post:
      tags:
        - Users
      summary: Query users
      description: >-
        Use when listing or searching service accounts in an admin UI, or when
        auditing who has API access and which roles they have.
      operationId: queryUser
      requestBody:
        description: Filter
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/types.UserFilter'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListUsersResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    types.UserFilter:
      type: object
      properties:
        end_time:
          type: string
          format: date-time
        expand:
          type: string
        filters:
          type: array
          description: filters allows complex filtering based on multiple fields
          items:
            $ref: '#/components/schemas/types.FilterCondition'
        limit:
          maximum: 1000
          minimum: 1
          type: integer
        offset:
          minimum: 0
          type: integer
        order:
          type: string
          enum:
            - asc
            - desc
        roles:
          type: array
          items:
            type: string
        sort:
          type: array
          items:
            $ref: '#/components/schemas/types.SortCondition'
        start_time:
          type: string
          format: date-time
        status:
          $ref: '#/components/schemas/types.Status'
        type:
          $ref: '#/components/schemas/types.UserType'
        user_ids:
          type: array
          description: Specific filters for users
          items:
            type: string
      x-speakeasy-name-override: UserFilter
    ListUsersResponse:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/UserResponse'
        pagination:
          $ref: '#/components/schemas/types.PaginationResponse'
    errors.ErrorResponse:
      type: object
      properties:
        code:
          type: string
          enum:
            - not_found
            - already_exists
            - version_conflict
            - validation_error
            - invalid_operation
            - permission_denied
            - http_client_error
            - database_error
            - system_error
            - internal_error
            - service_unavailable
        details:
          type: object
          additionalProperties:
            type: object
        http_status_code:
          type: integer
        message:
          type: string
      x-speakeasy-name-override: ErrorResponse
    types.FilterCondition:
      type: object
      properties:
        data_type:
          $ref: '#/components/schemas/types.DataType'
        field:
          type: string
        operator:
          $ref: '#/components/schemas/types.FilterOperatorType'
        value:
          $ref: '#/components/schemas/types.Value'
      x-speakeasy-name-override: FilterCondition
    types.SortCondition:
      type: object
      properties:
        direction:
          $ref: '#/components/schemas/types.SortDirection'
        field:
          type: string
      x-speakeasy-name-override: SortCondition
    types.Status:
      type: string
      enum:
        - published
        - deleted
        - archived
      x-enum-varnames:
        - StatusPublished
        - StatusDeleted
        - StatusArchived
      x-speakeasy-name-override: Status
    types.UserType:
      type: string
      enum:
        - user
        - service_account
      x-enum-varnames:
        - UserTypeUser
        - UserTypeServiceAccount
      x-speakeasy-name-override: UserType
    UserResponse:
      type: object
      properties:
        email:
          type: string
          description: Empty for service accounts
        id:
          type: string
        roles:
          type: array
          items:
            type: string
        tenant:
          $ref: '#/components/schemas/TenantResponse'
        type:
          $ref: '#/components/schemas/types.UserType'
    types.PaginationResponse:
      type: object
      properties:
        limit:
          type: integer
        offset:
          type: integer
        total:
          type: integer
      x-speakeasy-name-override: PaginationResponse
    types.DataType:
      type: string
      enum:
        - string
        - number
        - date
        - array
      x-enum-varnames:
        - DataTypeString
        - DataTypeNumber
        - DataTypeDate
        - DataTypeArray
      x-speakeasy-name-override: DataType
    types.FilterOperatorType:
      type: string
      enum:
        - eq
        - contains
        - not_contains
        - gt
        - lt
        - in
        - not_in
        - before
        - after
      x-enum-varnames:
        - EQUAL
        - CONTAINS
        - NOT_CONTAINS
        - GREATER_THAN
        - LESS_THAN
        - IN
        - NOT_IN
        - BEFORE
        - AFTER
      x-speakeasy-name-override: FilterOperatorType
    types.Value:
      type: object
      properties:
        array:
          type: array
          items:
            type: string
        boolean:
          type: boolean
        date:
          type: string
        number:
          type: number
        string:
          type: string
      x-speakeasy-name-override: Value
    types.SortDirection:
      type: string
      enum:
        - asc
        - desc
      x-enum-varnames:
        - SortDirectionAsc
        - SortDirectionDesc
      x-speakeasy-name-override: SortDirection
    TenantResponse:
      type: object
      properties:
        billing_details:
          $ref: '#/components/schemas/TenantBillingDetails'
        created_at:
          type: string
          format: date-time
        id:
          type: string
        metadata:
          $ref: '#/components/schemas/types.Metadata'
        name:
          type: string
        status:
          type: string
        updated_at:
          type: string
          format: date-time
    TenantBillingDetails:
      type: object
      properties:
        address:
          $ref: '#/components/schemas/Address'
        email:
          type: string
        help_email:
          type: string
        phone:
          type: string
    types.Metadata:
      type: object
      additionalProperties:
        type: string
      x-speakeasy-name-override: Metadata
    Address:
      type: object
      properties:
        address_city:
          maxLength: 100
          type: string
        address_country:
          type: string
        address_line1:
          maxLength: 255
          type: string
        address_line2:
          maxLength: 255
          type: string
        address_postal_code:
          maxLength: 20
          type: string
        address_state:
          maxLength: 100
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: Enter your API key in the format *x-api-key &lt;api-key&gt;**
      name: x-api-key
      in: header

````