# Invite to topic

`POST /t/{id}/invite.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

- `user` (optional)
  Type: string

- `email` (optional)
  Type: string

Responses:

- 200: topic updated

Content type: application/json

Type: object

- `user` (optional)
  Type: object
  
  - `id` (optional)
    Type: integer
  
  - `username` (optional)
    Type: string
  
  - `name` (optional)
    Type: string
  
  - `avatar_template` (optional)
    Type: string

## Examples

### cURL

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

### JavaScript

```javascript
const body = `{
  "user": "string",
  "email": "string"
}`;

const response = await fetch('https://discourse.example.com/t/string/invite.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 = '''{
  "user": "string",
  "email": "string"
}'''

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