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

# Retrieve Memory Payload

> Retrieve assisted or non-assisted memory from the knowledge graph



## OpenAPI

````yaml GET /memory/
openapi: 3.1.0
info:
  title: duohub Retriever API
  description: >-
    Retrieve assisted or non-assisted memory from a duohub knowledge graph. For
    best performance, use the official `duohub` Python package.
  version: 1.0.0
servers:
  - url: https://api.duohub.ai
security:
  - APIKeyHeader: []
paths:
  /memory/:
    get:
      tags:
        - Memory Retrieval
      summary: Retrieve Memory
      description: Retrieve assisted or non-assisted memory from the knowledge graph
      operationId: retrieve_memory
      parameters:
        - name: memoryID
          in: query
          required: true
          description: Unique identifier for the knowledge graph memory to query
          schema:
            type: string
        - name: query
          in: query
          required: true
          description: The question or query to search for in the knowledge graph
          schema:
            type: string
        - name: assisted
          in: query
          required: false
          description: >-
            When true, uses AI to assist in retrieving and formatting the
            response. When false, returns raw memory matches.
          schema:
            type: boolean
            default: false
        - name: facts
          in: query
          required: false
          description: >-
            When true, returns three supporting facts from the knowledge graph
            along with the response
          schema:
            type: boolean
            default: false
        - name: top_k
          in: query
          required: false
          description: The number of top memories to return
          schema:
            type: integer
            default: 5
      responses:
        '200':
          description: Memory retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  payload:
                    type: array
                    description: The retrieved memory or AI-assisted response
                    minItems: 1
                    items:
                      type: object
                      properties:
                        content:
                          type: string
                          description: The retrieved memory or AI-assisted response
                        score:
                          type: number
                          description: >-
                            The score of the memory or AI-assisted response (if
                            applicable, else 1)
                  facts:
                    type: array
                    items:
                      type: object
                      properties:
                        content:
                          type: string
                          description: Supporting fact content
                      required:
                        - content
                    minItems: 3
                    maxItems: 3
                    nullable: true
                    description: Three supporting facts when facts parameter is true
                  sources:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        name:
                          type: string
                        url:
                          type: string
                        score:
                          type: number
                required:
                  - payload
                  - token_count
                example:
                  payload:
                    - content: The capital of France is Paris.
                      score: 1
                  facts:
                    - content: Paris is the capital of France
                    - content: Paris has been France's capital since 987 CE
                    - content: Paris is located in northern France
                  sources:
                    - id: 123e4567-e89b-12d3-a456-426614174000
                      name: Wikipedia
                      url: https://en.wikipedia.org/wiki/Paris
                      score: 1
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: Error message
                example:
                  detail: API key is required
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: Error message
                example:
                  detail: Error retrieving memory
components:
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: 'Your duohub API key. Type: str'

````