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

# Get a list of user profiles

> Retrieves a list of user profiles in lexicographical order.

**Required ACL:** `search`, `browse`, `recommendation`


## OpenAPI

````yaml specs/advanced-personalization.yml get /2/users
openapi: 3.1.0
info:
  title: Advanced Personalization API
  summary: >-
    The Advanced Personalization API lets you access user profiles built based
    on the behavior of your users on your website or app
  description: >
    ## Client libraries


    Use Algolia's API clients and libraries to reliably integrate Algolia's APIs
    with your apps.

    The official API clients are covered by Algolia's [Service Level
    Agreement](https://www.algolia.com/policies/sla).


    For more information, see [Algolia's
    ecosystem](https://www.algolia.com/doc/libraries).


    ## Base URLs


    The Advanced Personalization API can be reached from multiple domains, each
    specific to a region.


    - `https://ai-personalization.eu.algolia.com`

    - `https://ai-personalization.us.algolia.com`


    Use the URL that matches your [analytics
    region](https://dashboard.algolia.com/account/infrastructure/analytics).


    **All requests must use HTTPS.**


    ## Authentication


    Add these headers to authenticate requests:


    - `x-algolia-application-id`. Your Algolia application ID.

    - `x-algolia-api-key`. An API key with the `search`, `browse` and
    `recommendation` ACL permissions.


    You can find your application ID and API key in the [Algolia
    dashboard](https://dashboard.algolia.com/account/api-keys).


    ## Request format


    Request bodies must be JSON objects.


    ## Response status and errors


    The Advanced Personalization API returns JSON responses.

    Since JSON doesn't guarantee any specific ordering, don't rely on the order
    of attributes in the API response.


    Successful responses return `2xx` statuses. Client errors return `4xx`
    statuses. Server errors return `5xx` statuses.

    Error responses have a `message` property with more information.


    ## Rate limiting


    When making requests to the Advanced Personalization API, you are limited to
    500 API calls per minute per application.


    The following headers provide information about your current limit:


    - `x-ratelimit-limit`: The number of requests allowed every 60 seconds.

    - `x-ratelimit-remaining`: The number of requests remaining in the current
    60 second period.

    - `x-ratelimit-reset`: Timestamp when the next time period starts, measured
    in seconds since the Unix epoch.


    ## Version


    The current version of the Advanced Personalization API is version 2,
    indicated by the `/2/` in each endpoint's URL.
  version: 2.0.0
servers:
  - url: https://ai-personalization.{region}.algolia.com
    variables:
      region:
        description: >
          Use the URL that matches your [analytics
          region](https://dashboard.algolia.com/account/infrastructure/analytics).
        enum:
          - eu
          - us
        default: eu
security:
  - appId: []
    apiKey: []
tags:
  - name: config
    x-displayName: Configuration
    description: >
      Manage your Advanced Personalization configuration.


      The configuration defines the indices, facet attributes and events that
      describe your user's 

      behaviour on your website or app. It helps Advanced Personalization
      determine how personalization should affect the search results.
  - name: users
    x-displayName: Users
    description: >
      Manage user profiles generated by Advanced Personalization.


      User profiles contain the affinities each user has for the different
      facets in your index.
    externalDocs:
      url: >-
        https://www.algolia.com/doc/guides/personalization/ai-personalization/what-is-ai-personalization/concepts/user-profiles
      description: User profiles.
externalDocs:
  url: >-
    https://www.algolia.com/doc/guides/personalization/ai-personalization/what-is-ai-personalization
  description: What is Advanced Personalization.
paths:
  /2/users:
    get:
      tags:
        - users
      summary: Get a list of user profiles
      description: >-
        Retrieves a list of user profiles in [lexicographical
        order](https://www.educative.io/answers/what-is-a-lexicographic-order).
      operationId: getUsers
      parameters:
        - $ref: '#/components/parameters/affinity'
        - $ref: '#/components/parameters/endDate'
        - $ref: '#/components/parameters/indices'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/nextPageToken'
        - $ref: '#/components/parameters/previousPageToken'
        - $ref: '#/components/parameters/startDate'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: getUsersResponse
                type: object
                properties:
                  users:
                    type: array
                    items:
                      $ref: '#/components/schemas/user'
                  nextPageToken:
                    type: string
                  previousPageToken:
                    type: string
                required:
                  - users
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/GenericUnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
      x-codeSamples:
        - lang: javascript
          label: JavaScript
          source: >-
            // Initialize the client

            // Replace 'eu' with your Algolia Application Region

            const client =
            advancedPersonalizationClient('ALGOLIA_APPLICATION_ID',
            'ALGOLIA_API_KEY', 'eu');


            // Call the API

            const response = await client.getUsers({ indices: ['indexName'] });



            // print the response

            console.log(response);
        - lang: cURL
          label: curl
          source: |-
            curl --request GET \
              --url 'https://ai-personalization.eu.algolia.com/2/users?startDate=2024-06-27T08%3A27%3A26Z&endDate=2024-06-28T08%3A27%3A26Z&indices=products_EN&affinity=brand&limit=10&nextPageToken=lorem&previousPageToken=lorem' \
              --header 'accept: application/json' \
              --header 'x-algolia-api-key: ALGOLIA_API_KEY' \
              --header 'x-algolia-application-id: ALGOLIA_APPLICATION_ID'
components:
  parameters:
    affinity:
      name: affinity
      description: |
        Filter users by affinity name and value.
        If multiple values are passed, returned users will match all values.
      in: query
      schema:
        type: array
        items:
          type: string
      examples:
        affinityName:
          value: brand
          summary: Filter by single affinity name
        affinityValuePair:
          value: brand:Nike
          summary: Filter by single affinity name and value
        multipleAffinityNames:
          value: brand,color
          summary: Filter by multiple affinity names
        multipleAffinityValuePairs:
          value: brand:Nike,color:white
          summary: Filter by multiple affinity name and value pairs
    endDate:
      name: endDate
      description: |
        Filter users by end date and time, in RFC 3339 format.
        Only users that were updated before the passed date will be returned.
      in: query
      schema:
        type: string
        example: '2024-06-28T08:27:26Z'
    indices:
      name: indices
      description: |
        Filter users by matching indices.
        If multiple indices are passed, returned users will match all indices.
      in: query
      schema:
        type: array
        items:
          type: string
      examples:
        singleIndex:
          value:
            - products_EN
          summary: Filter by single index
        multipleIndices:
          value:
            - products_EN
            - products_FR
          summary: Filter by multiple indices
      style: form
      explode: false
    limit:
      name: limit
      description: |
        Limit the number of users in the response.
        The value of this parameter ranges from 1 to 1000.
      in: query
      schema:
        type: integer
        default: 10
        minimum: 1
        maximum: 1000
    nextPageToken:
      name: nextPageToken
      description: |
        Reference for the next page, when navigating forward using pagination.
        Can't be used in the same request as `previousPageToken`.
      in: query
      schema:
        type: string
    previousPageToken:
      name: previousPageToken
      description: >
        Reference for the previous page, when navigating backward using
        pagination.

        Can't be used in the same request as `nextPageToken`.
      in: query
      schema:
        type: string
    startDate:
      name: startDate
      description: |
        Filter users by start date and time, in RFC 3339 format.
        Only users that were updated after the passed date will be returned.
      in: query
      schema:
        type: string
        example: '2024-06-27T08:27:26Z'
  schemas:
    user:
      type: object
      properties:
        affinities:
          type: array
          items:
            title: affinity
            type: object
            properties:
              indices:
                type: array
                items:
                  type: string
                  minimum: 1
              lastUpdatedAt:
                type: string
              name:
                type: string
              score:
                type: number
                minimum: 1
                maximum: 20
              value:
                type: string
            required:
              - name
              - indices
              - value
              - score
              - lastUpdatedAt
        lastUpdatedAt:
          type: string
        type:
          $ref: '#/components/schemas/userType'
        userID:
          type: string
      required:
        - userID
        - type
        - affinities
        - lastUpdatedAt
    userType:
      title: userType
      type: string
      enum:
        - basic
        - predictive
        - realtime
    ErrorResponses_unauthorized:
      type: object
      properties:
        message:
          $ref: '#/components/schemas/ErrorMessages_unauthorized'
        status:
          $ref: '#/components/schemas/unauthorized'
    ErrorResponses_genericUnprocessableEntity:
      type: object
      properties:
        message:
          $ref: '#/components/schemas/genericUnprocessableEntity'
        status:
          $ref: '#/components/schemas/unprocessableEntity'
    ErrorResponses_internalServerError:
      type: object
      properties:
        message:
          $ref: '#/components/schemas/ErrorMessages_internalServerError'
        status:
          $ref: '#/components/schemas/internalServerError'
    ErrorMessages_unauthorized:
      type: string
      description: Details about the response, such as error messages.
      enum:
        - Unauthorized
    unauthorized:
      type: integer
      description: HTTP status code for an authorization error.
      enum:
        - 401
    genericUnprocessableEntity:
      type: string
      description: Details about the response, such as error messages.
      enum:
        - Unprocessable Entity
    unprocessableEntity:
      type: integer
      description: HTTP status code for an unprocessable entity error.
      enum:
        - 422
    ErrorMessages_internalServerError:
      type: string
      description: Details about the response, such as error messages.
      enum:
        - Internal Server Error
    internalServerError:
      type: integer
      description: HTTP status code for an internal server error.
      enum:
        - 500
  responses:
    Unauthorized:
      description: Not authorized to access this resource.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponses_unauthorized'
    GenericUnprocessableEntity:
      description: Unprocessable entity.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponses_genericUnprocessableEntity'
    InternalServerError:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponses_internalServerError'
  securitySchemes:
    appId:
      type: apiKey
      in: header
      name: x-algolia-application-id
      description: Your Algolia application ID.
    apiKey:
      type: apiKey
      in: header
      name: x-algolia-api-key
      description: >
        Your Algolia API key with the necessary permissions to make the request.

        Permissions are controlled through access control lists (ACL) and access
        restrictions.

        The required ACL to make a request is listed in each endpoint's
        reference.

````