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

# Get Memories

> Retrieve memories with paginated results and advanced filtering using logical operators like AND, OR, NOT, and comparison queries.

List memories scoped by filters with paginated results. Entity IDs (`user_id`, `agent_id`, `app_id`, `run_id`) **must** be passed inside the `filters` object: top-level entity IDs are rejected with 400.

Expired memories are hidden by default. Pass `show_expired: true` to include memories whose `expiration_date` has passed.

Python uses `show_expired`; TypeScript uses `showExpired`.

The `filters` object supports complex logical operations (AND, OR, NOT) and comparison operators:

* `in`: Matches any of the values specified
* `gte`: Greater than or equal to
* `lte`: Less than or equal to
* `gt`: Greater than
* `lt`: Less than
* `ne`: Not equal to
* `icontains`: Case-insensitive containment check
* `*`: Wildcard character that matches everything

Pass `page` and `page_size` as query parameters to paginate through results.

<CodeGroup>
  ```python Code theme={null}
  memories = client.get_all(
      filters={
          "AND": [
              {
                  "user_id": "alex"
              },
              {
                  "created_at": {"gte": "2024-07-01", "lte": "2024-07-31"}
              }
          ]
      },
      show_expired=False,
      page=1,
      page_size=50
  )
  ```

  ```python Output theme={null}
  {
      "count": 2,
      "next": null,
      "previous": null,
      "results": [
          {
              "id": "f4cbdb08-7062-4f3e-8eb2-9f5c80dfe64c",
              "memory": "Alex is planning a trip to San Francisco from July 1st to July 10th",
              "expiration_date": null,
              "created_at": "2024-07-01T12:00:00Z",
              "updated_at": "2024-07-01T12:00:00Z"
          },
          {
              "id": "a2b8c3d4-5e6f-7g8h-9i0j-1k2l3m4n5o6p",
              "memory": "Alex prefers vegetarian restaurants",
              "expiration_date": null,
              "created_at": "2024-07-05T15:30:00Z",
              "updated_at": "2024-07-05T15:30:00Z"
          }
      ]
  }
  ```
</CodeGroup>

<Info>
  The response is a paginated envelope with `count`, `next`, `previous`, and `results`. Use `page` and `page_size` query params to step through results.
</Info>


## OpenAPI

````yaml post /v3/memories/
openapi: 3.0.1
info:
  title: Mem0 API Docs
  description: mem0.ai API Docs
  contact:
    email: support@mem0.ai
  license:
    name: Apache 2.0
  version: v1
servers:
  - url: https://api.mem0.ai/
security:
  - ApiKeyAuth: []
paths:
  /v3/memories/:
    post:
      tags:
        - memories
      summary: Get all memories (V3, paginated)
      description: >-
        List memories scoped by filters, paginated. Entity IDs **must** be
        passed inside the `filters` object — top-level `user_id` / `agent_id` /
        `run_id` are rejected with 400. `filters` supports the same operator set
        as V2 search (`AND`, `OR`, `NOT`, `in`, `gte`, `lte`, etc.). Response is
        a paginated envelope; pass `page` and `page_size` as query parameters to
        step through results.
      operationId: memories_list_v3
      parameters:
        - in: query
          name: page
          schema:
            type: integer
            minimum: 1
            default: 1
          description: 1-indexed page number.
        - in: query
          name: page_size
          schema:
            type: integer
            minimum: 1
            maximum: 200
            default: 100
          description: Results per page.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - filters
              properties:
                filters:
                  type: object
                  description: >-
                    Entity and metadata filters. Must include at least one
                    entity ID (`user_id`, `agent_id`, `app_id`, or `run_id`).
                  additionalProperties: true
                show_expired:
                  type: boolean
                  default: false
                  description: >-
                    When true, include memories whose `expiration_date` has
                    passed. Expired memories are hidden by default.
            example:
              filters:
                user_id: alice
      responses:
        '200':
          description: Paginated envelope of memories.
          content:
            application/json:
              schema:
                type: object
                properties:
                  count:
                    type: integer
                    description: Total number of memories matching the filters.
                  next:
                    type: string
                    format: uri
                    nullable: true
                    description: URL for the next page, or `null` if this is the last page.
                  previous:
                    type: string
                    format: uri
                    nullable: true
                    description: >-
                      URL for the previous page, or `null` if this is the first
                      page.
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          format: uuid
                          description: Unique memory identifier.
                        memory:
                          type: string
                          description: The extracted memory fact.
                        score:
                          type: number
                          format: float
                          minimum: 0
                          maximum: 1
                          description: >-
                            Combined multi-signal relevance score in [0, 1]
                            (search responses only).
                        metadata:
                          type: object
                          additionalProperties: true
                          description: User-supplied metadata attached to the memory.
                        categories:
                          type: array
                          items:
                            type: string
                        created_at:
                          type: string
                          format: date-time
                        updated_at:
                          type: string
                          format: date-time
                      required:
                        - id
                        - memory
                        - created_at
                required:
                  - count
                  - next
                  - previous
                  - results
              example:
                count: 123
                next: https://api.mem0.ai/v3/memories/?page=2&page_size=100
                previous: null
                results:
                  - id: mem-uuid
                    memory: User moved to San Francisco from New York in January 2026
                    metadata: {}
                    categories:
                      - location
                    created_at: '2026-01-15T10:30:00Z'
                    updated_at: '2026-01-15T10:30:00Z'
        '400':
          description: >-
            Validation error — e.g. empty `filters` or no positively-scoped
            entity ID.
        '401':
          description: Unauthorized — missing or invalid API key.
      security:
        - tokenAuth: []
      x-codeSamples:
        - lang: cURL
          source: >-
            curl -X POST 'https://api.mem0.ai/v3/memories/?page=1&page_size=50'
            \
              -H "Authorization: Token <api-key>" \
              -H "Content-Type: application/json" \
              -d '{"filters": {"user_id": "alice"}}'
        - lang: Python
          source: >-
            from mem0 import MemoryClient


            client = MemoryClient(api_key="your-api-key")


            page = client.get_all(filters={"user_id": "alice"}, page=1,
            page_size=50)

            # page == {"count": 123, "next": "...", "previous": None, "results":
            [...]}

            print(page["count"], len(page["results"]))
        - lang: JavaScript
          source: |-
            import MemoryClient from "mem0ai";

            const client = new MemoryClient({ apiKey: "your-api-key" });

            const page = await client.getAll({
              filters: { userId: "alice" },
              page: 1,
              pageSize: 50,
            });
            console.log(page.count, page.results.length);
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        API key authentication. Prefix your Mem0 API key with 'Token '. Example:
        'Token your_api_key'

````