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

# Search Memories V2

## Image Memories

Search results may include image memories alongside text memories. Image memories are returned as objects with additional fields:

* `content_type: "image"` — identifies this as an image memory
* `image_url` — a signed URL to view the image (expires after 4 hours)
* `image_description` — AI-generated description of the image content

Image memories are ranked by relevance alongside text memories using multimodal embeddings that enable cross-modal search (e.g., a text query can find visually relevant images).

### Filtering by Content Type

Use the `contentType` query parameter to filter results:

```bash theme={null}
# Only text memories
curl "https://www.memoryplugin.com/api/v2/memory?query=architecture&contentType=text" \
  -H "Authorization: Bearer YOUR_API_KEY"

# Only image memories
curl "https://www.memoryplugin.com/api/v2/memory?query=diagram&contentType=image" \
  -H "Authorization: Bearer YOUR_API_KEY"

# All memories (default)
curl "https://www.memoryplugin.com/api/v2/memory?query=architecture" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

### Example Response with Image Memories

```json theme={null}
{
  "memories": [
    "User prefers dark mode in all applications",
    {
      "content_type": "image",
      "image_url": "https://memoryplugin.com/storage/v1/object/sign/memory-images/...",
      "image_description": "A whiteboard diagram showing the auth flow with three microservices connected via Redis pub/sub.",
      "metadata": {
        "createdAt": "2026-04-06T10:30:00Z",
        "bucketId": 65,
        "bucketName": "Work"
      }
    },
    "Meeting notes: decided to use PostgreSQL for the new service"
  ],
  "buckets": [
    { "id": 65, "name": "Work" },
    { "id": 66, "name": "Personal" }
  ]
}
```

<Note>
  Image URLs are temporary signed URLs that expire after 4 hours. If you need to access an image after the URL has expired, make another API request to get a fresh URL.
</Note>


## OpenAPI

````yaml GET /api/v2/memory
openapi: 3.1.0
info:
  title: MemoryPlugin
  version: 1.0.0
  description: API for managing and querying user memories
servers:
  - url: https://www.memoryplugin.com
security: []
paths:
  /api/v2/memory:
    get:
      summary: Get memories and buckets in a single request
      operationId: GetMemoriesAndBuckets
      parameters:
        - name: bucketId
          in: query
          schema:
            type: integer
          description: Optional bucket ID to filter memories
        - name: count
          in: query
          schema:
            type: integer
            default: 10
          description: Number of memories to retrieve
        - name: all
          in: query
          schema:
            type: boolean
          description: Fetch all memories
        - name: latest
          in: query
          schema:
            type: boolean
          description: Fetch latest memories
        - name: query
          in: query
          schema:
            type: string
          description: Search query for memories
        - name: source
          in: query
          schema:
            type: string
          description: Client source identifier (e.g., 'chatgpt' for ChatGPT requests)
        - name: skip
          in: query
          schema:
            type: integer
            default: 0
            minimum: 0
          description: >-
            Number of memories to skip for pagination. Zero-indexed: skip=0
            starts from first memory, skip=10 skips first 10 memories and starts
            from 11th. Used primarily with token limiting to load additional
            memories beyond the initial response.
        - name: includeIds
          in: query
          schema:
            type: boolean
            default: false
          description: >-
            When true, text memories are returned as objects with `id` and
            `text` fields instead of plain strings. Useful for clients that need
            to reference specific memories for edit or delete operations.
        - name: contentType
          in: query
          schema:
            type: string
            enum:
              - text
              - image
          description: >-
            Filter memories by content type. Use `text` for text-only memories,
            `image` for image-only memories. Omit to return all memories.
      responses:
        '200':
          description: Successful response with memories and buckets
          content:
            application/json:
              schema:
                type: object
                properties:
                  memories:
                    type: array
                    description: >-
                      Array of memories. Text memories are returned as plain
                      strings (or `{id, text}` objects when `includeIds=true`).
                      Image memories are always returned as objects with
                      `content_type`, `image_url`, and `image_description`
                      fields.
                    items:
                      oneOf:
                        - type: string
                          description: Text memory (plain string format)
                        - type: object
                          description: >-
                            Text memory with ID (when includeIds=true) or image
                            memory
                          properties:
                            id:
                              type: string
                              description: >-
                                Memory ID (present when includeIds=true or for
                                image memories)
                            text:
                              type: string
                              description: >-
                                Memory text content. For image memories, this
                                contains the AI-generated description.
                            content_type:
                              type: string
                              enum:
                                - text
                                - image
                              description: >-
                                Memory type. Omitted for text memories in plain
                                string format.
                            image_url:
                              type: string
                              format: uri
                              description: >-
                                Signed URL to view the image. Only present for
                                image memories. Expires after 4 hours.
                            image_description:
                              type: string
                              description: >-
                                AI-generated description of the image. Only
                                present for image memories.
                            metadata:
                              type: object
                              properties:
                                text:
                                  type: string
                                createdAt:
                                  type: string
                                  format: date-time
                                bucketId:
                                  type: integer
                                bucketName:
                                  type: string
                  buckets:
                    type: array
                    items:
                      $ref: '#/components/schemas/Bucket'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    Bucket:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the bucket
        name:
          type: string
          description: Display name of the bucket
        description:
          type: string
          description: Optional description of the bucket
        memoryCount:
          type: integer
          description: Number of memories in this bucket
      required:
        - id
        - name
        - memoryCount
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
        text:
          type: string
        score:
          type: number
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````