---
title: "POST /v1/{+parent}/memories:retrieve"
method: POST
path: "/v1/{+parent}/memories:retrieve"
tags: ["projects"]
---

# POST /v1/{+parent}/memories:retrieve

`POST /v1/{+parent}/memories:retrieve`

Retrieve memories.

## Path parameters

- `parent` string, required

## Request body

- GoogleCloudAiplatformV1RetrieveMemoriesRequest — Request message for MemoryBankService.RetrieveMemories.
  - `filterGroups` GoogleCloudAiplatformV1MemoryConjunctionFilter[] — Optional. Metadata filters that will be applied to the retrieved memories' `metadata` using OR logic. Filters are defined using disjunctive normal form (OR of ANDs). For example: `filter_groups: [{filters: [{key: "author", value: {string_value: "agent 123"}, op: EQUAL}]}, {filters: [{key: "label", value: {string_value: "travel"}, op: EQUAL}, {key: "author", value: {string_value: "agent 321"}, op: EQUAL}]}]` would be equivalent to the logical expression: `(metadata.author = "agent 123" OR (metadata.label = "travel" AND metadata.author = "agent 321"))`.
    - `filters` GoogleCloudAiplatformV1MemoryFilter[] — Represents filters that will be combined using AND logic.
      - `key` string — Represents the key of the filter. For example, "author" would apply to `metadata` entries with the key "author".
      - `value` GoogleCloudAiplatformV1MemoryMetadataValue — Memory metadata.
        - `stringValue` string — Represents a string value.
        - `timestampValue` string, google-datetime — Represents a timestamp value. When filtering on timestamp values, only the seconds field will be compared.
        - `doubleValue` number, double — Represents a double value.
        - `boolValue` boolean — Represents a boolean value.
      - `op` 'OPERATOR_UNSPECIFIED' | 'EQUAL' | 'GREATER_THAN' | 'LESS_THAN' — Represents the operator to apply to the filter. If not set, then EQUAL will be used.
      - `negate` boolean — Indicates whether the filter will be negated.
  - `scope` object — Required. The scope of the memories to retrieve. A memory must have exactly the same scope (`Memory.scope`) as the scope provided here to be retrieved (same keys and values). Order does not matter, but it is case-sensitive.
  - `similaritySearchParams` GoogleCloudAiplatformV1RetrieveMemoriesRequestSimilaritySearchParams — Parameters for semantic similarity search based retrieval.
    - `searchQuery` string — Required. Query to use for similarity search retrieval. If provided, then the parent ReasoningEngine must have ReasoningEngineContextSpec.MemoryBankConfig.SimilaritySearchConfig set.
    - `topK` integer — Optional. The maximum number of memories to return. The service may return fewer than this value. If unspecified, at most 3 memories will be returned. The maximum value is 100; values above 100 will be coerced to 100.
  - `memoryTypes` string[] — Optional. Specifies the types of memories to retrieve. If this field is empty or not provided, the request will default to retrieving only memories of type `NATURAL_LANGUAGE_COLLECTION`. If populated, the request will retrieve memories matching any of the specified `MemoryType` values.
  - `simpleRetrievalParams` GoogleCloudAiplatformV1RetrieveMemoriesRequestSimpleRetrievalParams — Parameters for simple (non-similarity search) retrieval.
    - `pageToken` string — Optional. A page token, received from a previous `RetrieveMemories` call. Provide this to retrieve the subsequent page.
    - `pageSize` integer — Optional. The maximum number of memories to return. The service may return fewer than this value. If unspecified, at most 3 memories will be returned. The maximum value is 100; values above 100 will be coerced to 100.
  - `filter` string — Optional. The standard list filter that will be applied to the retrieved memories. More detail in [AIP-160](https://google.aip.dev/160). Supported fields: * `fact` * `create_time` * `update_time` * `topics` (i.e. `topics.custom_memory_topic_label: "example topic" OR topics.managed_memory_topic: USER_PREFERENCES`)

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/aiplatform.md) · [All operations](https://skmtc.net/google/apis/aiplatform/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/aiplatform/versions/b608d71b91f0/schema)
