# Invite group to topic

`POST /t/{id}/invite-group.json`

Authentication: no security requirement declared for this operation.

Parameters:

- `Api-Key` (header, string, required)
  Type: string

- `Api-Username` (header, string, required)
  Type: string

- `id` (path, string, required)
  Type: string

Request body: application/json

Type: object

- `group` (optional)
  Type: string
  
  The name of the group to invite

- `should_notify` (optional)
  Type: boolean
  
  Whether to notify the group, it defaults to true

Responses:

- 200: invites to a PM

Content type: application/json

Type: object

- `group` (optional)
  Type: object
  
  - `id` (optional)
    Type: integer
  
  - `name` (optional)
    Type: string

## Examples

### cURL

```bash
curl -X POST 'https://discourse.example.com/t/string/invite-group.json' \
  -H 'Api-Key: string' \
  -H 'Api-Username: string' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "group": "string",
  "should_notify": true
}'
```

### JavaScript

```javascript
const body = `{
  "group": "string",
  "should_notify": true
}`;

const response = await fetch('https://discourse.example.com/t/string/invite-group.json', {
  method: 'POST',
  headers: {
    'Api-Key': 'string',
    'Api-Username': 'string',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "group": "string",
  "should_notify": true
}'''

response = requests.post(
    'https://discourse.example.com/t/string/invite-group.json',
    data=body.encode('utf-8'),
    headers={
        'Api-Key': 'string',
        'Api-Username': 'string',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
