---
title: "Share a mind with a user"
description: "Give one user access to this mind. Re-granting changes their role.\n\nSelf-service: the owner, or an admin the owner appointed. **Only the owner\nmay grant `admin`** — an admin sharing onward as admin would let write\naccess propagate with no step at which the owner is consulted.\n\nA `viewer` reads the mind and everything it reaches: the brains it holds\nand the skills it carries. That is the point of sharing a mind, and it is a\nwider grant than sharing a brain — the skills become instructions in the\nrecipient's context. Share deliberately."
---

> 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 › Minds

`POST /minds/{mind_id}/grants`

Give one user access to this mind. Re-granting changes their role.

Self-service: the owner, or an admin the owner appointed. **Only the owner
may grant `admin`** — an admin sharing onward as admin would let write
access propagate with no step at which the owner is consulted.

A `viewer` reads the mind and everything it reaches: the brains it holds
and the skills it carries. That is the point of sharing a mind, and it is a
wider grant than sharing a brain — the skills become instructions in the
recipient's context. Share deliberately.

## Authentication

- `HTTPBearer`, http, header `Authorization`

## Path parameters

- `mind_id` (`grant_mind_access.path.mind_id`; string, required)
  - format `uuid`

## Header parameters

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

## Request body

_Required._

- `user_id` (`grant_mind_access.user_id`; string, required)
  - minLength 1; maxLength 255
- `role` (`grant_mind_access.role`; string, optional)
  - one of `"viewer"`, `"admin"`; default `"viewer"`

## Example request

```json
{
  "user_id": "string",
  "role": "viewer"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://truememory-api.mvstg.com/minds/<mind_id>/grants' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "user_id": "string",
  "role": "viewer"
}
'
```

### TypeScript

```typescript
const url = 'https://truememory-api.mvstg.com/minds/<mind_id>/grants';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({user_id: 'string', role: 'viewer'})
};

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/minds/<mind_id>/grants"

payload = {
    "user_id": "string",
    "role": "viewer"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 201

Successful Response

#### Example

```json
{
  "mind_id": "string",
  "user_id": "string",
  "role": "viewer",
  "app_id": "string",
  "granted_at": "2019-08-24T14:15:22Z",
  "display_name": "string",
  "email": "string"
}
```

- `mind_id` (`grant_mind_access.response.201.mind_id`; string, required)
- `user_id` (`grant_mind_access.response.201.user_id`; string, required)
- `role` (`grant_mind_access.response.201.role`; string, required)
  - one of `"viewer"`, `"admin"`
- `granted_at` (`grant_mind_access.response.201.granted_at`; string, required)
  - format `date-time`
- `app_id` (`grant_mind_access.response.201.app_id`; any of, optional)
  - any of: `string`, `null`
- `display_name` (`grant_mind_access.response.201.display_name`; any of, optional)
  - any of: `string`, `null`
- `email` (`grant_mind_access.response.201.email`; any of, optional)
  - any of: `string`, `null`

### 422

Validation Error

#### Example

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

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


Source: https://truememory-docs.mvstg.com/api/minds/grants/create/index.md
