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

# Reorder User Memories

> Set the display order of a member's memories (admin)

Reorders a specific member's memories. Pass **every** memory id for that member in the desired order — the request is rejected if the set of ids doesn't match the member's memories exactly. Returns the memories in their new order.

<Note>
  This endpoint requires admin privileges. To reorder your own memories, use the [self-service endpoint](/api-reference/user-memories/reorder-user-memories).
</Note>

<ParamField header="Authorization" type="string" required>
  Bearer token obtained from the [authenticate](/api-reference/authentication/authenticate) endpoint. The authenticated user must be an admin.
</ParamField>

<ParamField body="member_id" type="string" required>
  The member whose memories to reorder.
</ParamField>

<ParamField body="memory_ids" type="string[]" required>
  All of that member's memory ids, in the order you want them stored.
</ParamField>

## Response

<ResponseField name="user_memories" type="array" required>
  The member's memories in the new order. Each object matches the [List User Memories (admin)](/api-reference/admin/list-user-memories) shape.
</ResponseField>

<RequestExample>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X POST https://api.trellis.sh/v1/admin/user-memories/reorder \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "member_id": "member_01HX...",
      "memory_ids": ["a1b2c3d4-e5f6-7890-abcd-ef1234567890", "b2c3d4e5-f6a7-8901-bcde-f12345678901"]
    }'
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import requests

  response = requests.post(
      "https://api.trellis.sh/v1/admin/user-memories/reorder",
      headers={
          "Authorization": "Bearer YOUR_TOKEN",
          "Content-Type": "application/json",
      },
      json={
          "member_id": "member_01HX...",
          "memory_ids": ["a1b2c3d4-e5f6-7890-abcd-ef1234567890", "b2c3d4e5-f6a7-8901-bcde-f12345678901"],
      },
  )
  memories = response.json()["user_memories"]
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const response = await fetch("https://api.trellis.sh/v1/admin/user-memories/reorder", {
    method: "POST",
    headers: {
      Authorization: "Bearer YOUR_TOKEN",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      member_id: "member_01HX...",
      memory_ids: ["a1b2c3d4-e5f6-7890-abcd-ef1234567890", "b2c3d4e5-f6a7-8901-bcde-f12345678901"],
    }),
  });
  const { user_memories } = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "user_memories": [
      {
        "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "organization_id": "org_01HX...",
        "member_id": "member_01HX...",
        "content": "Prefers responses in bullet points",
        "idx": 0,
        "tier": "preference",
        "created_at": "2025-03-01T10:00:00+00:00",
        "updated_at": "2025-03-15T14:30:00+00:00"
      }
    ]
  }
  ```

  ```json 400 Incomplete id set theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "detail": "Expected 3 memory IDs, got 2"
  }
  ```

  ```json 403 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "detail": "Admin privileges required"
  }
  ```
</ResponseExample>
