# Share a connection

> Source: https://elaichi.ai/docs/api-reference/connections/connection/shareconnection/

`POST /connection/{id}/share`

Resource: **Connection** · API: **Connections**

## Path parameters

- **`id`** _(string, required)_
  Connection id (`conn_…`).

## Request body

- **`grantee_type`** _(string)_
  Allowed: `user`, `team`, `org`
- **`grantee_id`** _(string,null)_
  User id (`usr_…`) or team id (`team_…`). Omitted or null for an org-wide grant.
- **`level`** _(string)_
  Allowed: `view`, `use`

## Code examples

### curl

```bash
curl -X POST 'https://api.elaichi.ai/connection/<id>/share' \
  -H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"grantee_type":"user","level":"view"}'
```

### JavaScript

```javascript
const body = {
  "grantee_type": "user",
  "level": "view"
};

const response = await fetch('https://api.elaichi.ai/connection/<id>/share', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ' + process.env.ELAICHI_API_TOKEN,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import os
import requests

url = "https://api.elaichi.ai/connection/<id>/share"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}
payload = {
    "grantee_type": "user",
    "level": "view"
}

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