> ## 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.

# Upload Chat History

> Upload a single conversation from any platform. Supports upsert semantics — re-sending a conversation with the same ID will update it with new messages. The conversation is processed asynchronously (chunked, embedded, and indexed for search).

## Overview

Upload chat history from any platform to MemoryPlugin. This endpoint accepts a single conversation per request with your own unique identifiers for conversations and messages.

### Key features

* **Upsert semantics**: Re-sending a conversation with the same `conversation.id` updates it with any new messages rather than duplicating it.
* **Dynamic platform naming**: Supply a `platform` identifier to group conversations by source. Each platform is scoped to your user account.
* **Full processing pipeline**: Conversations are chunked, embedded, and indexed for semantic search — just like conversations imported via the browser extension.

### Limits

* Conversations exceeding **100,000 tokens** are rejected during background processing.
* Maximum payload size: **50 MB**.
* Platform identifier: alphanumeric, hyphens, underscores, dots. Max 100 characters.

### Processing

Conversations are processed **asynchronously**. The endpoint returns immediately with `status: "queued"`. Background processing (chunking, embedding, vector indexing) typically completes within a few seconds for normal-sized conversations.

### Example

```bash theme={null}
curl -X POST https://www.memoryplugin.com/api/chat-history/ingest/custom-online \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "platform": "my-slack-bot",
    "platformDisplayName": "My Slack Bot",
    "conversation": {
      "id": "conv-abc-123",
      "title": "Discussion about architecture",
      "createdAt": "2026-04-27T10:00:00Z",
      "updatedAt": "2026-04-27T11:30:00Z",
      "messages": [
        {
          "id": "msg-1",
          "role": "human",
          "content": "How should we structure the API?",
          "createdAt": "2026-04-27T10:00:00Z"
        },
        {
          "id": "msg-2",
          "role": "assistant",
          "content": "I would recommend a RESTful approach with versioned endpoints...",
          "createdAt": "2026-04-27T10:01:00Z"
        }
      ]
    }
  }'
```


## OpenAPI

````yaml POST /api/chat-history/ingest/custom-online
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/chat-history/ingest/custom-online:
    post:
      summary: Upload chat history
      description: >-
        Upload a single conversation from any platform. Supports upsert
        semantics — re-sending a conversation with the same ID will update it
        with new messages. The conversation is processed asynchronously
        (chunked, embedded, and indexed for search).
      operationId: UploadChatHistory
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomChatHistoryInput'
      responses:
        '200':
          description: Conversation queued for processing
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatHistoryIngestResponse'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '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:
    CustomChatHistoryInput:
      type: object
      properties:
        platform:
          type: string
          description: >-
            Platform identifier for your integration (e.g., 'my-slack-bot',
            'internal-tool'). Alphanumeric, hyphens, underscores, dots. Max 100
            chars. Defaults to 'custom' if omitted.
          pattern: ^[a-zA-Z0-9\-_.]{1,100}$
          example: my-custom-app
        platformDisplayName:
          type: string
          description: >-
            Human-readable display name for the platform shown in the UI. Max
            200 chars. Overwrites previous value if supplied again for the same
            platform.
          maxLength: 200
          example: My Custom App
        conversation:
          type: object
          description: The conversation to upload.
          properties:
            id:
              type: string
              description: >-
                Your unique identifier for this conversation. Used for upsert
                deduplication — sending the same ID again updates the existing
                conversation.
              maxLength: 500
              example: conv-abc-123
            title:
              type: string
              description: Display title of the conversation.
              example: Discussion about API design
            createdAt:
              type: string
              format: date-time
              description: When the conversation was created (ISO 8601).
              example: '2026-04-27T10:00:00Z'
            updatedAt:
              type: string
              format: date-time
              description: >-
                When the conversation was last updated (ISO 8601). Defaults to
                createdAt if omitted.
              example: '2026-04-27T11:30:00Z'
            messages:
              type: array
              description: >-
                The messages in the conversation. Must contain at least one
                message.
              minItems: 1
              items:
                type: object
                properties:
                  id:
                    type: string
                    description: >-
                      Your unique identifier for this message. Used for
                      deduplication on re-upload.
                    example: msg-001
                  role:
                    type: string
                    enum:
                      - human
                      - assistant
                    description: Who sent this message.
                  content:
                    type: string
                    description: The message text content.
                    example: How should we structure the API?
                  createdAt:
                    type: string
                    format: date-time
                    description: >-
                      When this message was sent (ISO 8601). Optional but
                      recommended for correct ordering.
                    example: '2026-04-27T10:00:00Z'
                required:
                  - id
                  - role
                  - content
          required:
            - id
            - title
            - createdAt
            - messages
      required:
        - conversation
    ChatHistoryIngestResponse:
      type: object
      properties:
        queued:
          type: boolean
          description: Whether the conversation was accepted for processing.
        importId:
          type: string
          description: The import record ID for this platform.
        conversationId:
          type: string
          description: The internal conversation ID assigned by MemoryPlugin.
        platform:
          type: string
          description: The resolved platform identifier.
        conversation:
          type: object
          description: Conversation details after upsert.
          properties:
            id:
              type: string
              description: Internal conversation ID.
            platformConversationId:
              type: string
              description: Your supplied conversation ID.
            title:
              type: string
            updatedAt:
              type: string
              format: date-time
            messageCount:
              type: integer
            status:
              type: string
              enum:
                - queued
              description: >-
                Processing status. 'queued' means the conversation is stored and
                background processing (chunking, embedding) is in progress.
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
        text:
          type: string
        score:
          type: number
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````