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

# conversation.record_messages_batch

> Record multiple conversation messages in a single batched call.

```python theme={null}
await sdk.conversation.record_messages_batch(
    messages: List[Dict[str, Any]],
) -> Dict[str, Any]
```

Records many messages in one call. Use this when backfilling an existing transcript, syncing a buffered queue, or recording a multi-turn exchange after it completes. Each entry in `messages` follows the same shape as the arguments to [`record_message`](/sdk-reference/conversation/record-message).

### Parameters

<ParamField path="messages" type="List[Dict[str, Any]]" required={true}>
  List of message dicts. Each dict supports the following keys:

  * `conversation_id` (str, **required**): conversation identifier; must be a valid UUID registered via [`record_message`](/concepts/context-end-to-end#short-term-context)
  * `role` (str, **required**): must be `"user"` or `"assistant"`
  * `content` (str, **required**): message text
  * `user_id` (str, optional): external user id
  * `customer_id` (str, optional): external customer id; required on B2B, auto-resolved on B2C ([B2C vs B2B](/concepts/memory-scopes#b2c-vs-b2b-which-scopes-apply-to-you))
  * `session_id` (str, optional): session identifier
  * `metadata` (dict, optional): free-form metadata

  Unlike [`record_message`](/sdk-reference/conversation/record-message), `user_id` and `customer_id` are optional in batch mode. If omitted, the entry is recorded without explicit user/customer attribution.
</ParamField>

### Returns

A dict summarising the batch outcome.

<ResponseField name="total" type="int">Number of messages submitted.</ResponseField>
<ResponseField name="succeeded" type="int">Number of messages accepted.</ResponseField>
<ResponseField name="failed" type="int">Number of messages rejected.</ResponseField>
<ResponseField name="results" type="List[Dict[str, Any]]">Per-message results in submission order. Successful entries include `message_id` and `recorded_at`; failed entries include an `error` field.</ResponseField>

### Example

```python theme={null}
import uuid
from maximem_synap import MaximemSynapSDK

sdk = MaximemSynapSDK(api_key="synap_your_key_here")
await sdk.initialize()

# conversation_id must be a valid UUID; reuse one id across the whole transcript
conversation_id = str(uuid.uuid4())

result = await sdk.conversation.record_messages_batch(
    messages=[
        {
            "conversation_id": conversation_id,
            "role": "user",
            "content": "What's on my calendar today?",
            "user_id": "user_alice",
            "customer_id": "customer_acme",
        },
        {
            "conversation_id": conversation_id,
            "role": "assistant",
            "content": "You have two meetings and a dentist appointment.",
            "user_id": "user_alice",
            "customer_id": "customer_acme",
        },
    ]
)

print(f"Recorded {result['succeeded']} of {result['total']} messages")
```

### Raises

* `InvalidInputError`: when an entry is missing required keys or `role` is invalid.
* `AuthenticationError`: when the API key is missing or invalid.
* `NetworkError`: when the SDK cannot reach Synap.

### See also

* [conversation.record\_message](/sdk-reference/conversation/record-message)
* [conversation.context.fetch](/sdk-reference/conversation-context/fetch)
