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

# Resolve Conflict

> Resolve one conflict from the conflict report by index.

## Overview

Applies a resolution action to a single conflict identified by its **index** in the full conflict array for that agent and date (same ordering as the JSON report file). This uses the same resolution logic as the Memanto CLI conflict flow (updates Moorcheh memories and marks the row resolved in the report).

## Authentication

API clients do not send an API key or `Authorization` header.

<ParamField header="X-Session-Token" type="string" required>
  Session token from [Activate Agent](/api-reference/sessions/activate-agent). Must match `agent_id`.
</ParamField>

<ParamField header="Content-Type" type="string" required>
  Must be `application/json`
</ParamField>

## Path Parameters

<ParamField path="agent_id" type="string" required>
  The unique identifier of the agent.
</ParamField>

## Body

<ParamField body="conflict_index" type="integer" required>
  Zero-based index into the **full** conflicts list for that `date` (not only unresolved rows). Use the `index` field returned by [List Conflicts](/api-reference/data/list-conflicts) — not the conflict's position in that filtered response. An already-resolved index is rejected.
</ParamField>

<ParamField body="action" type="string" required>
  One of: `keep_old`, `keep_new`, `keep_both`, `remove_both`, `expire_old`,
  `expire_new`, `expire_both`, `manual`.

  The `keep_*` / `remove_both` / `manual` actions **delete** the losing memory
  permanently. The `expire_*` actions retire it reversibly instead — content is
  kept, the memory stays recallable, and it is stamped
  `expired_by: "conflict-resolution"`. See
  [Memory Lifecycle](/reference/memory-lifecycle).

  | Action        | Effect                                                    |
  | ------------- | --------------------------------------------------------- |
  | `keep_old`    | Deletes the new memory                                    |
  | `keep_new`    | Deletes the old memory                                    |
  | `keep_both`   | No-op; both stay active                                   |
  | `remove_both` | Deletes both                                              |
  | `expire_old`  | Expires the old memory                                    |
  | `expire_new`  | Expires the new memory                                    |
  | `expire_both` | Expires both                                              |
  | `manual`      | Deletes both and stores `manual_content` as a replacement |
</ParamField>

<ParamField body="date" type="string">
  Report date `YYYY-MM-DD`. Defaults to **today (UTC)** on the server when omitted.
</ParamField>

<ParamField body="manual_content" type="string">
  Required when `action` is `manual`: replacement memory text (both conflicting memories are removed and this content is stored).
</ParamField>

<ParamField body="manual_type" type="string">
  Optional memory type for the manual replacement (defaults follow implementation when omitted).
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "http://localhost:8000/api/v2/agents/my-agent/conflicts/resolve" \
    -H "X-Session-Token: your_session_token" \
    -H "Content-Type: application/json" \
    -d '{
      "date": "2026-05-08",
      "conflict_index": 0,
      "action": "keep_new"
    }'
  ```

  ```bash cURL (manual resolution) theme={null}
  curl -X POST "http://localhost:8000/api/v2/agents/my-agent/conflicts/resolve" \
    -H "X-Session-Token: your_session_token" \
    -H "Content-Type: application/json" \
    -d '{
      "date": "2026-05-08",
      "conflict_index": 0,
      "action": "manual",
      "manual_content": "We use PostgreSQL for OLTP and MongoDB only for analytics.",
      "manual_type": "fact"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - OK theme={null}
  {
    "agent_id": "my-agent",
    "session_id": "sess_982287b6a5f5",
    "date": "2026-05-08",
    "action": "keep_new",
    "deleted": "abc-123",
    "status": "resolved"
  }
  ```

  ```json 401 - Unauthorized (Missing Token) theme={null}
  {
    "detail": "Missing session token. Use X-Session-Token header."
  }
  ```

  ```json 422 - Validation Error theme={null}
  {
    "detail": [
      {
        "type": "missing",
        "loc": ["body", "conflict_index"],
        "msg": "Field required",
        "input": {}
      }
    ]
  }
  ```

  ```json 500 - Server Error theme={null}
  {
    "detail": {
      "error": "InternalServerError",
      "message": "An unexpected error occurred",
      "details": {
        "original_error": "..."
      }
    }
  }
  ```
</ResponseExample>

Invalid `action`, missing conflict report, out-of-range index, or missing `manual_content` for `manual` typically surface as **500** with details from the underlying resolver.

## Next Steps

* [List Conflicts](/api-reference/data/list-conflicts) to fetch remaining unresolved rows
* [Recall](/api-reference/search/recall) to verify memory state after resolution
