---
title: "Store Message"
method: POST
path: "/v1/messages"
tags: ["v1", "Messages"]
---

# Store Message

`POST /v1/messages`

Store a chat message and queue it for AI analysis and memory creation.
    
    **Authentication Required**: Bearer token, API key, or session token
    
    **Processing Control**:
    - Set `process_messages: true` (default) to enable full AI analysis and memory creation
    - Set `process_messages: false` to store messages only without processing into memories
    
    **Processing Flow** (when process_messages=true):
    1. Message is immediately stored in PostMessage class
    2. Background processing analyzes the message for memory-worthiness
    3. If worthy, creates a memory with appropriate role-based categorization
    4. Links the message to the created memory
    
    **Role-Based Categories**:
    - **User messages**: preference, task, goal, facts, context
    - **Assistant messages**: skills, learning
    
    **Session Management**:
    - `sessionId` is required to group related messages
    - Use the same `sessionId` for an entire conversation
    - Retrieve conversation history using GET /messages/sessions/{sessionId}

## Request body

- MessageRequest — Request model for storing a chat message
  - `content` union, required — The content of the chat message - can be a simple string or structured content objects
    - string
    - object[]
  - `role` 'user' | 'assistant', required — Role of the message sender
  - `sessionId` string, required — Session ID to group related messages in a conversation
  - `metadata` MemoryMetadata — Metadata for memory request
    - `hierarchical_structures` string, nullable — Hierarchical structures to enable navigation from broad topics to specific ones
    - `createdAt` string, nullable — ISO datetime when the memory was created
    - `location` string, nullable
    - `topics` string[], nullable
    - `emoji tags` string[], nullable
    - `emotion tags` string[], nullable
    - `conversationId` string, nullable
    - `sourceUrl` string, nullable
    - `role` 'user' | 'assistant' — Role of the message sender
    - `category` union — Memory category based on role. For users: preference, task, goal, fact, context. For assistants: skills, learning, task, goal, fact, context.
      - 'preference' | 'task' | 'goal' | 'fact' | 'context' — Memory categories for user messages
      - 'skills' | 'learning' | 'task' | 'goal' | 'fact' | 'context' — Memory categories for assistant messages
    - `user_id` string, nullable
    - `external_user_id` string, nullable
    - `external_user_read_access` string[], nullable
    - `external_user_write_access` string[], nullable
    - `user_read_access` string[], nullable
    - `user_write_access` string[], nullable
    - `workspace_read_access` string[], nullable
    - `workspace_write_access` string[], nullable
    - `role_read_access` string[], nullable
    - `role_write_access` string[], nullable
    - `pageId` string, nullable
    - `sourceType` string, nullable
    - `workspace_id` string, nullable
    - `upload_id` string, nullable — Upload ID for document processing workflows
    - `organization_id` string, nullable
    - `namespace_id` string, nullable
    - `sessionId` string, nullable
    - `post` string, nullable
    - `userMessage` string, nullable
    - `assistantMessage` string, nullable
    - `relatedGoals` string[], nullable
    - `relatedUseCases` string[], nullable
    - `relatedSteps` string[], nullable
    - `goalClassificationScores` number[], nullable
    - `useCaseClassificationScores` number[], nullable
    - `stepClassificationScores` number[], nullable
    - `customMetadata` object, nullable — Optional object for arbitrary custom metadata fields. Only string, number, boolean, or list of strings allowed. Nested dicts are not allowed.
  - `process_messages` boolean — Whether to process messages into memories (true) or just store them (false). Default is true.
  - `organization_id` string, nullable — Optional organization ID for multi-tenant message scoping
  - `namespace_id` string, nullable — Optional namespace ID for multi-tenant message scoping

## Response `200`

Message stored and queued for processing

- MessageResponse — Response model for message storage
  - `objectId` string, required — Parse Server objectId of the stored message
  - `sessionId` string, required — Session ID of the conversation
  - `role` 'user' | 'assistant', required — Role of the message sender
  - `content` union, required — Content of the message - can be a simple string or structured content objects
    - string
    - object[]
  - `createdAt` string, date-time, required — When the message was created
  - `processing_status` string — Status of background processing (queued, analyzing, completed, failed)

## Other responses

- `400` — Bad request
- `401` — Unauthorized
- `422` — Validation Error
- `500` — Internal server error

## Changes

- **2025-11-07** `14ff13755871` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/papr-ai/apis/papr-memory-api/changes/v1/messages/post.md)

---

[API](https://skmtc.dev/papr-ai/apis/papr-memory-api.md) · [All operations](https://skmtc.dev/papr-ai/apis/papr-memory-api/llms.txt) · [OpenAPI document](https://skmtc.dev/papr-ai/apis/papr-memory-api/revisions/34b5e739fd20?raw)
