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

# Retrieve the real-time user's personalization profile

> Retrieves the real-time user's personalization profiles containing search filters.

**Required ACL:** `recommendation`


## OpenAPI

````yaml specs/advanced-personalization.yml get /2/realtime/users/{userToken}
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/realtime/users/{userToken}:
    get:
      tags:
        - users
      summary: Retrieve the real-time user's personalization profile
      description: >-
        Retrieves the real-time user's personalization profiles containing
        search filters.
      operationId: getRealtimeUser
      parameters:
        - $ref: '#/components/parameters/UserToken'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RealtimeUser'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '421':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
      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.getRealtimeUser({ userToken: 'foo' });



            // print the response

            console.log(response);
        - lang: cURL
          label: curl
          source: |-
            curl --request GET \
              --url https://ai-personalization.eu.algolia.com/2/realtime/users/test-user-123 \
              --header 'accept: application/json' \
              --header 'x-algolia-api-key: ALGOLIA_API_KEY' \
              --header 'x-algolia-application-id: ALGOLIA_APPLICATION_ID'
components:
  parameters:
    UserToken:
      name: userToken
      in: path
      required: true
      description: >-
        Unique identifier representing a user for which to fetch the
        personalization profile.
      schema:
        $ref: '#/components/schemas/userToken'
  schemas:
    RealtimeUser:
      title: RealtimeUser
      type: object
      additionalProperties: false
      required:
        - version
        - userID
        - lastUpdatedAt
        - search
      properties:
        lastUpdatedAt:
          type: string
          description: >-
            Date and time when the profile was last computed, in RFC 3339
            format.
          example: '2023-06-15T15:06:04.249906Z'
        search:
          type: object
          description: |
            Index personalization filters by index name.
          additionalProperties:
            $ref: '#/components/schemas/searchFilters'
        userID:
          type: string
          description: User ID of the user.
        version:
          type: string
          description: Version of the response format.
    userToken:
      type: string
      description: >
        Unique pseudonymous or anonymous user identifier.


        This helps with analytics and click and conversion events.

        For more information, see [user
        token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken).
      example: test-user-123
      x-categories:
        - Personalization
    searchFilters:
      type: object
      additionalProperties: false
      properties:
        filters:
          $ref: '#/components/schemas/searchFilter'
        indices:
          type: array
          items:
            type: string
          example:
            - storefront
            - storefront_price_asc
            - storefront_price_desc
        strategy:
          $ref: '#/components/schemas/strategy'
    ErrorBase:
      description: Error.
      type: object
      x-keep-model: true
      additionalProperties: true
      properties:
        message:
          type: string
          example: Invalid Application-Id or API-Key
    searchFilter:
      type: object
      additionalProperties: false
      properties:
        session:
          type: array
          items:
            type: string
          example:
            - brand:Dyson<score=12>
    strategy:
      type: string
      enum:
        - session
        - historical
        - hybrid
      example: session
  responses:
    BadRequest:
      description: Bad request or request arguments.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBase'
    FeatureNotEnabled:
      description: This feature is not enabled on your Algolia account.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBase'
    TooManyRequests:
      description: Too Many Requests.
      content:
        application/json:
          schema:
            title: tooManyRequestsResponse
            type: object
            additionalProperties: false
            required:
              - status
              - message
            properties:
              message:
                type: string
                example: Too Many Requests
                description: Response message.
              status:
                type: integer
                example: 421
                description: Status code.
    InternalError:
      description: Internal error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBase'
  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.

````