---
title: "Set a memory node's visibility"
description: "Mark one entity node public or private.\n\nNodes are private until this is called — extraction never sets visibility,\nso nothing becomes public by inference. Marking a node public does **not**\nshare it: it keeps its group and is still served to its owner alone.\nCross-user sharing is what shared namespaces (``graph_id``) are for.\n\nThe ``agent_id`` path segment is accepted for URL symmetry with the other\n``/memories/{agent_id}/...`` routes but does not narrow the scope — the\nnode is matched across the caller's agents, because the memory browser\nthat lists nodes is itself cross-agent. Another user's node is never\nreachable.\n\nResponses: 404 when the node isn't in the requested scope; 422\n``MEMORY_NODE_PROTECTED`` for structural nodes (the user's own User node,\nTopic and Value taxonomy nodes) — the same set ``DELETE .../nodes/{id}``\nrefuses. Marking the User node public would make every fact hanging off\nit satisfy a ``visibility=public`` query at once."
---

> Documentation Index
> Fetch the complete documentation index at: https://truememory-docs.mvstg.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: AI Gateway API › Memory

`PATCH /memories/{agent_id}/nodes/{node_id}/visibility`

Mark one entity node public or private.

Nodes are private until this is called — extraction never sets visibility,
so nothing becomes public by inference. Marking a node public does **not**
share it: it keeps its group and is still served to its owner alone.
Cross-user sharing is what shared namespaces (``graph_id``) are for.

The ``agent_id`` path segment is accepted for URL symmetry with the other
``/memories/{agent_id}/...`` routes but does not narrow the scope — the
node is matched across the caller's agents, because the memory browser
that lists nodes is itself cross-agent. Another user's node is never
reachable.

Responses: 404 when the node isn't in the requested scope; 422
``MEMORY_NODE_PROTECTED`` for structural nodes (the user's own User node,
Topic and Value taxonomy nodes) — the same set ``DELETE .../nodes/{id}``
refuses. Marking the User node public would make every fact hanging off
it satisfy a ``visibility=public`` query at once.

## Authentication

- `HTTPBearer`, http, header `Authorization`

## Path parameters

- `agent_id` (`set_memory_node_visibility.path.agent_id`; string, required)
- `node_id` (`set_memory_node_visibility.path.node_id`; string, required)

## Header parameters

- `X-On-Behalf-Of` (`set_memory_node_visibility.header.X-On-Behalf-Of`; any of, optional)
  - any of: `string`, `null`
- `X-External-User-Id` (`set_memory_node_visibility.header.X-External-User-Id`; any of, optional)
  - any of: `string`, `null`
- `X-App-Id` (`set_memory_node_visibility.header.X-App-Id`; any of, optional)
  - any of: `string`, `null`

## Request body

_Required._

- `visibility` (`set_memory_node_visibility.visibility`; string, required) — 'public' un-privates the node; 'private' puts it back.
  - one of `"private"`, `"public"`
- `graph_id` (`set_memory_node_visibility.graph_id`; any of, optional) — Optional. Target a node in a shared namespace instead of the user's own memory. Requires a service token; the agent_id path segment is ignored.
  - any of: `string`, `null`

## Example request

```json
{
  "visibility": "private",
  "graph_id": "string"
}
```

## Code samples

### cURL

```bash
curl --request PATCH \
  --url 'https://truememory-api.mvstg.com/memories/<agent_id>/nodes/<node_id>/visibility' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "visibility": "private",
  "graph_id": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://truememory-api.mvstg.com/memories/<agent_id>/nodes/<node_id>/visibility';
const options = {
  method: 'PATCH',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({visibility: 'private', graph_id: 'string'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://truememory-api.mvstg.com/memories/<agent_id>/nodes/<node_id>/visibility"

payload = {
    "visibility": "private",
    "graph_id": "string"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Successful Response

#### Example

```json
{
  "id": "string",
  "name": "string",
  "labels": [
    "string"
  ],
  "group_id": "string",
  "visibility": "private"
}
```

- `id` (`set_memory_node_visibility.response.200.id`; string, required)
- `name` (`set_memory_node_visibility.response.200.name`; any of, required)
  - any of: `string`, `null`
- `labels` (`set_memory_node_visibility.response.200.labels`; array<string>, required)
- `group_id` (`set_memory_node_visibility.response.200.group_id`; any of, required)
  - any of: `string`, `null`
- `visibility` (`set_memory_node_visibility.response.200.visibility`; string, required)
  - one of `"private"`, `"public"`

### 422

Validation Error

#### Example

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}
```

- `detail` (`set_memory_node_visibility.response.422.detail`; array<object>, optional)
  - `loc` (`set_memory_node_visibility.response.422.detail.loc`; array<any of>, required)
    - any of: `string`, `integer`
  - `msg` (`set_memory_node_visibility.response.422.detail.msg`; string, required)
  - `type` (`set_memory_node_visibility.response.422.detail.type`; string, required)
  - `input` (`set_memory_node_visibility.response.422.detail.input`; unknown, optional)
  - `ctx` (`set_memory_node_visibility.response.422.detail.ctx`; object, optional)


Source: https://truememory-docs.mvstg.com/api/memories/nodes/visibility/index.md
