> ## 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 Data By User Token

> Retrieves all memories, conversations and their messages for the given user token.

<Callout icon="flask-conical" color="#14b8a6">
  This is a **beta feature** according to [Algolia's Terms of Service ("Beta Services")](https://www.algolia.com/policies/terms/).
</Callout>

**Required ACL:** `logs`


## OpenAPI

````yaml specs/agent-studio.yml get /1/user-data/{userToken}
openapi: 3.1.0
info:
  title: Agent Studio API
  description: >
    The Agent Studio API lets you build and operate generative AI agents that
    use Algolia data, tools, and your chosen LLM provider.


    Use it to create, configure, publish, and update agents, then generate chat
    completions grounded in live data from your Algolia indices. You can manage
    LLM providers, Agent Studio tools, conversations, feedback, secret keys,
    user data, caching, and application settings for your AI experiences.


    ## Client libraries


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


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


    ## Base URL


    Base URL for the Agent Studio API:


    - `https://{APPLICATION_ID}.algolia.net/agent-studio`


    **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 necessary permissions to make the
    request.
      The required access control list (ACL) to make a request is listed in each endpoint's reference.

    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 Agent Studio 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.


    ## Version


    The current version of the Agent Studio API is version 1, indicated by the
    `/1/` in each endpoint's URL.
  version: 0.1.0
servers:
  - url: https://{APPLICATION_ID}.algolia.net/agent-studio
    description: Agent Studio API.
    variables:
      APPLICATION_ID:
        default: EXAMPLE
        description: Your Algolia application ID.
security:
  - appId: []
    apiKey: []
tags:
  - name: Agents
    description: Manage your agents.
  - name: Allowed Domains
    description: Restrict where an agent's API key may be used.
  - name: Completions
    description: Generate completions.
  - name: Configurations
    description: Manage Agent Studio related application configurations.
  - name: Conversations
    description: View, export, and delete conversation history.
  - name: Feedback
    description: Capture user feedback on agent responses.
  - name: Internal
    description: Endpoints that are needed for internal or integration logic.
  - name: Providers
    description: Manage your LLM providers.
  - name: Secret Keys
    description: Manage secret keys used to authenticate requests.
  - name: User Data
    description: Manage end-user data associated with conversations.
paths:
  /1/user-data/{userToken}:
    get:
      tags:
        - User Data
      summary: Get Data By User Token
      description: >-
        Retrieves all memories, conversations and their messages for the given
        user token.
      operationId: getUserData
      parameters:
        - name: userToken
          in: path
          required: true
          schema:
            type: string
            title: userToken
          description: The userToken.
      responses:
        '200':
          description: Successful Response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserDataResponse'
        '422':
          description: Validation Error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: csharp
          label: C#
          source: |-
            // Initialize the client
            var client = new AgentStudioClient(
              new AgentStudioConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")
            );

            // Call the API
            var response = await client.GetUserDataAsync("test-user-token");

            // print the response
            Console.WriteLine(response);
        - lang: dart
          label: Dart
          source: |-
            // Initialize the client
            final client = AgentStudioClient(
                appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY');

            // Call the API
            final response = await client.getUserData(
              userToken: "test-user-token",
            );

            // print the response
            print(response);
        - lang: go
          label: Go
          source: >-
            // Initialize the client

            client, err := agentStudio.NewClient("ALGOLIA_APPLICATION_ID",
            "ALGOLIA_API_KEY")

            if err != nil {
              // The client can fail to initialize if you pass an invalid parameter.
              panic(err)
            }


            // Call the API

            response, err := client.GetUserData(client.NewApiGetUserDataRequest(
              "test-user-token"))
            if err != nil {
              // handle the eventual error
              panic(err)
            }



            // print the response

            print(response)
        - lang: java
          label: Java
          source: >-
            // Initialize the client

            AgentStudioClient client = new
            AgentStudioClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY");


            // Call the API

            UserDataResponse response = client.getUserData("test-user-token");


            // print the response

            System.out.println(response);
        - lang: javascript
          label: JavaScript
          source: >-
            // Initialize the client

            const client = agentStudioClient('ALGOLIA_APPLICATION_ID',
            'ALGOLIA_API_KEY');


            // Call the API

            const response = await client.getUserData({ userToken:
            'test-user-token' });



            // print the response

            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: >-
            // Initialize the client

            val client = AgentStudioClient(appId = "ALGOLIA_APPLICATION_ID",
            apiKey = "ALGOLIA_API_KEY")


            // Call the API

            var response = client.getUserData(userToken = "test-user-token")



            // print the response

            println(response)
        - lang: php
          label: PHP
          source: >-
            // Initialize the client

            $client = AgentStudioClient::create('ALGOLIA_APPLICATION_ID',
            'ALGOLIA_API_KEY');


            // Call the API

            $response = $client->getUserData(
                'test-user-token',
            );



            // print the response

            var_dump($response);
        - lang: python
          label: Python
          source: >-
            # Initialize the client

            # In an asynchronous context, you can use AgentStudioClient instead,
            which exposes the exact same methods.

            client = AgentStudioClientSync("ALGOLIA_APPLICATION_ID",
            "ALGOLIA_API_KEY")


            # Call the API

            response = client.get_user_data(
                user_token="test-user-token",
            )



            # print the response

            print(response)
        - lang: ruby
          label: Ruby
          source: >-
            # Initialize the client

            client = Algolia::AgentStudioClient.create("ALGOLIA_APPLICATION_ID",
            "ALGOLIA_API_KEY")


            # Call the API

            response = client.get_user_data("test-user-token")



            # print the response

            puts(response)
        - lang: scala
          label: Scala
          source: >-
            // Initialize the client

            val client = AgentStudioClient(appId = "ALGOLIA_APPLICATION_ID",
            apiKey = "ALGOLIA_API_KEY")


            // Call the API

            val response = Await.result(
              client.getUserData(
                userToken = "test-user-token"
              ),
              Duration(100, "sec")
            )


            // print the response

            println(response)
        - lang: swift
          label: Swift
          source: >-
            // Initialize the client

            let client = try AgentStudioClient(appID: "ALGOLIA_APPLICATION_ID",
            apiKey: "ALGOLIA_API_KEY")


            // Call the API

            let response = try await client.getUserData(userToken:
            "test-user-token")


            // print the response

            print(response)
        - lang: cURL
          label: curl
          source: |-
            curl --request GET \
              --url https://example.algolia.net/agent-studio/1/user-data/lorem \
              --header 'accept: application/json' \
              --header 'x-algolia-api-key: ALGOLIA_API_KEY' \
              --header 'x-algolia-application-id: ALGOLIA_APPLICATION_ID'
components:
  schemas:
    UserDataResponse:
      properties:
        conversations:
          items:
            $ref: '#/components/schemas/ConversationFullResponse'
          type: array
          title: conversations
        memories:
          items:
            $ref: '#/components/schemas/MemoryRecord'
          type: array
          title: memories
      type: object
      required:
        - conversations
        - memories
      title: userDataResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: detail
      type: object
      title: hTTPValidationError
    ConversationFullResponse:
      properties:
        agentId:
          type: string
          title: agentid
        createdAt:
          type: string
          title: createdat
        id:
          type: string
          title: id
        messages:
          items:
            $ref: '#/components/schemas/MessageResponse'
          type: array
          title: messages
        updatedAt:
          type: string
          title: updatedat
        conversationMetadata:
          oneOf:
            - $ref: '#/components/schemas/ConversationMetadata'
            - type: 'null'
        feedback:
          $ref: '#/components/schemas/FeedbackUnion'
        isFromDashboard:
          type: boolean
          title: isfromdashboard
          default: false
        lastActivityAt:
          oneOf:
            - type: string
            - type: 'null'
          title: lastactivityat
        messageCount:
          type: integer
          title: messagecount
          default: 0
        title:
          oneOf:
            - type: string
            - type: 'null'
          title: title
        totalInputTokens:
          type: integer
          title: totalinputtokens
          default: 0
        totalOutputTokens:
          type: integer
          title: totaloutputtokens
          default: 0
        totalTokens:
          type: integer
          title: totaltokens
          default: 0
        userToken:
          oneOf:
            - type: string
            - type: 'null'
          title: usertoken
      type: object
      required:
        - id
        - agentId
        - createdAt
        - updatedAt
        - messages
      title: conversationFullResponse
      description: Response model for a conversation with all its messages.
    MemoryRecord:
      properties:
        rawExtract:
          type: string
          maxLength: 5000
          minLength: 1
          title: rawextract
          description: Verbatim conversation extract, not paraphrased.
        text:
          type: string
          maxLength: 2000
          minLength: 1
          title: text
          description: Self-contained, first-person memory for long-term recall.
        _tags:
          items:
            type: string
          type: array
          title: tags
          description: >-
            Arbitrary labels/themes for flexible categorization (e.g.,
            'Q1-goals', 'paris-trip', 'vip-customer').
        agentIDs:
          items:
            type: string
          type: array
          title: agentids
          description: >-
            Agent IDs with access: ['agent1'], ['*'] for all, ['*', '-agent1']
            to exclude.
        appId:
          type: string
          title: appid
          description: Application ID.
          default: ''
        createdAt:
          type: integer
          title: createdat
          description: Epoch seconds.
          default: 0
        episode:
          oneOf:
            - $ref: '#/components/schemas/Episode'
            - type: 'null'
        keywords:
          items:
            type: string
          type: array
          title: keywords
          description: >-
            5-20 free-form keywords: entities, context, search terms (any
            words).
        memoryType:
          $ref: '#/components/schemas/MemoryType'
        objectID:
          oneOf:
            - type: string
            - type: 'null'
          title: objectid
          description: ObjectID of existing memory to update. Leave empty for new memory.
        recallTriggers:
          items:
            type: string
          type: array
          title: recalltriggers
          description: 3-5 natural phrases that should trigger this memory.
        topics:
          items:
            type: string
          type: array
          title: topics
          description: >-
            2-4 topics ONLY from this list: [complaints, entertainment, family,
            feedback, finance, food, goals, health, history, hobbies, learning,
            praise, preferences, schedule, shopping, technical, travel, work].
        updatedAt:
          type: integer
          title: updatedat
          description: Epoch seconds.
          default: 0
        userID:
          type: string
          title: userid
          description: User ID.
          default: ''
      type: object
      required:
        - text
        - rawExtract
      title: memoryRecord
      description: >-
        Universal storage model for all memory types (semantic, episodic).


        This is the ONLY model that touches storage (Algolia). Domain models
        (SemanticMemory, EpisodicMemory)

        are used for LLM extraction and converted to MemoryRecord before saving.


        See
        https://langchain-ai.github.io/langmem/concepts/conceptual_guide/#memory-types
        for memory type definitions.
    ValidationError:
      properties:
        loc:
          items:
            $ref: '#/components/schemas/LocationItemUnion'
          type: array
          title: location
        msg:
          type: string
          title: message
        type:
          type: string
          title: errorType
        ctx:
          type: object
          title: context
        input:
          title: input
      type: object
      required:
        - loc
        - msg
        - type
      title: validationError
    MessageResponse:
      properties:
        conversationId:
          type: string
          title: conversationid
        createdAt:
          type: string
          title: createdat
        id:
          type: string
          title: id
        parts:
          items:
            $ref: '#/components/schemas/MessagePart'
          type: array
          title: parts
        role:
          $ref: '#/components/schemas/MessageRole'
        updatedAt:
          type: string
          title: updatedat
        inputTokens:
          oneOf:
            - type: integer
            - type: 'null'
          title: inputtokens
        model:
          oneOf:
            - type: string
            - type: 'null'
          title: model
        outputTokens:
          oneOf:
            - type: integer
            - type: 'null'
          title: outputtokens
        turnContext:
          oneOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: turncontext
      type: object
      required:
        - id
        - conversationId
        - role
        - parts
        - createdAt
        - updatedAt
      title: messageResponse
      description: Response model for a message.
    ConversationMetadata:
      properties:
        cachedAt:
          oneOf:
            - type: string
            - type: 'null'
          title: cachedat
      type: object
      title: conversationMetadata
      description: Public metadata exposed on conversation responses.
    FeedbackUnion:
      oneOf:
        - items:
            $ref: '#/components/schemas/FeedbackResponse'
          type: array
        - type: 'null'
    Episode:
      properties:
        action:
          type: string
          maxLength: 5000
          minLength: 1
          title: action
          description: >-
            What was done with PRECISE details (1-3 sentences). WITH tool calls:
            use arrow notation `tool(param:value) → feedback →
            tool(refined_param:new_value)`. WITHOUT tool calls: capture
            communication/workflow pattern.
        observation:
          type: string
          maxLength: 5000
          minLength: 1
          title: observation
          description: >-
            What user wanted + key context (1-2 sentences). Include prior failed
            attempts if they informed the approach.
        result:
          type: string
          maxLength: 5000
          minLength: 1
          title: result
          description: >-
            Learned pattern + effectiveness (1-3 sentences). What worked and WHY
            it's replicable. Note efficiency: multi-turn refinements, which
            results were relevant, what made final attempt succeed. Use strict
            `param:value` syntax for learnings. Format: 'For [context], use
            [param:value] because [reason]'.
        thoughts:
          type: string
          maxLength: 5000
          minLength: 1
          title: thoughts
          description: >-
            WHY this approach was chosen, which constraints/preferences drove
            decisions (1-3 sentences). Capture reasoning that applies to similar
            future scenarios.
      type: object
      required:
        - observation
        - thoughts
        - action
        - result
      title: episode
      description: >-
        Episodic memory schema following LangMem's OTAR pattern:

        Observation → Thoughts → Action → Result


        Captures complete interaction experiences for agent learning.

        See
        https://langchain-ai.github.io/langmem/concepts/conceptual_guide/#episodic-memory-past-experiences.
    MemoryType:
      type: string
      enum:
        - semantic
        - episodic
      title: memoryType
      description: >-
        Memory types implemented so far.

        Follows LangMem's ontology:
        https://langchain-ai.github.io/langmem/concepts/conceptual_guide/#memory-types.
    LocationItemUnion:
      oneOf:
        - type: string
        - type: integer
    MessagePart:
      oneOf:
        - $ref: '#/components/schemas/TextPart'
        - $ref: '#/components/schemas/ToolCallPart'
        - $ref: '#/components/schemas/ToolResultPart'
        - $ref: '#/components/schemas/StartPart'
        - $ref: '#/components/schemas/StartStepPart'
        - $ref: '#/components/schemas/ReasoningPart'
        - $ref: '#/components/schemas/ToolApprovalRequestPart'
      discriminator:
        propertyName: type
        mapping:
          reasoning:
            $ref: '#/components/schemas/ReasoningPart'
          start:
            $ref: '#/components/schemas/StartPart'
          start-step:
            $ref: '#/components/schemas/StartStepPart'
          text:
            $ref: '#/components/schemas/TextPart'
          tool-approval-request:
            $ref: '#/components/schemas/ToolApprovalRequestPart'
          tool-call:
            $ref: '#/components/schemas/ToolCallPart'
          tool-result:
            $ref: '#/components/schemas/ToolResultPart'
    MessageRole:
      type: string
      enum:
        - user
        - assistant
      title: messageRole
      description: Role of a message in the conversation.
    FeedbackResponse:
      properties:
        agentId:
          type: string
          title: agentid
        createdAt:
          type: string
          title: createdat
        id:
          type: string
          title: id
        messageId:
          type: string
          title: messageid
        tags:
          items:
            type: string
          type: array
          title: tags
        updatedAt:
          type: string
          title: updatedat
        vote:
          type: integer
          title: vote
        model:
          oneOf:
            - type: string
            - type: 'null'
          title: model
        notes:
          oneOf:
            - type: string
            - type: 'null'
          title: notes
      type: object
      required:
        - id
        - agentId
        - messageId
        - vote
        - tags
        - createdAt
        - updatedAt
      title: feedbackResponse
    TextPart:
      properties:
        text:
          type: string
          title: text
        type:
          type: string
          const: text
          title: type
          default: text
      type: object
      required:
        - type
        - text
      title: textPart
    ToolCallPart:
      properties:
        args:
          title: args
        toolCallId:
          type: string
          title: toolcallid
        toolName:
          type: string
          title: toolname
        type:
          type: string
          const: tool-call
          title: type
          default: tool-call
        providerOptions:
          oneOf:
            - type: object
              additionalProperties: true
            - type: 'null'
          title: provideroptions
        requiresApproval:
          oneOf:
            - type: boolean
            - type: 'null'
          title: requiresapproval
      type: object
      required:
        - type
        - toolCallId
        - toolName
        - args
      title: toolCallPart
    ToolResultPart:
      properties:
        output:
          $ref: '#/components/schemas/ToolResultOutput'
        toolCallId:
          type: string
          title: toolcallid
        toolName:
          type: string
          title: toolname
        type:
          type: string
          const: tool-result
          title: type
          default: tool-result
        providerOptions:
          oneOf:
            - type: object
              additionalProperties: true
            - type: 'null'
          title: provideroptions
      type: object
      required:
        - type
        - toolCallId
        - toolName
        - output
      title: toolResultPart
    StartPart:
      properties:
        type:
          type: string
          const: start
          title: type
          default: start
      type: object
      title: startPart
      required:
        - type
    StartStepPart:
      properties:
        type:
          type: string
          const: start-step
          title: type
          default: start-step
      type: object
      title: startStepPart
      required:
        - type
    ReasoningPart:
      properties:
        text:
          type: string
          title: text
        type:
          type: string
          const: reasoning
          title: type
          default: reasoning
      type: object
      required:
        - type
        - text
      title: reasoningPart
    ToolApprovalRequestPart:
      properties:
        args:
          title: args
        toolCallId:
          type: string
          title: toolcallid
        toolName:
          type: string
          title: toolname
        type:
          type: string
          const: tool-approval-request
          title: type
          default: tool-approval-request
        appId:
          oneOf:
            - type: string
            - type: 'null'
          title: appid
        argsHash:
          oneOf:
            - type: string
            - type: 'null'
          title: argshash
        description:
          oneOf:
            - type: string
            - type: 'null'
          title: description
        providerOptions:
          oneOf:
            - type: object
              additionalProperties: true
            - type: 'null'
          title: provideroptions
      type: object
      required:
        - type
        - toolCallId
        - toolName
        - args
      title: toolApprovalRequestPart
    ToolResultOutput:
      properties:
        type:
          $ref: '#/components/schemas/ToolResultOutputType'
        value:
          title: value
      type: object
      required:
        - type
        - value
      title: toolResultOutput
    ToolResultOutputType:
      type: string
      enum:
        - text
        - json
        - error-text
        - error-json
        - content
      title: toolResultOutputType
      description: The valid 'type' of tool results.
  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.

````