Create or regenerate invitation code for a user
Create/Regenerate an invitation code for a user
HTTP Request
POST/api/users/:id/invite_code
Authorization
Authorization
- Required: Yes
- Permission: Staff with UserInviteCodePermission or Admin
- Permission Code: 1226
- Authentication: Token-based (Authorization: Token <your_api_key>)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | Integer | Yes | Unique ID of the user to retrieve |
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| regenerate | boolean | - | Specify if the invitation code should be regenerated |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3api = requests.Session()
4api.headers.update({'Authorization': 'Token XXXXXXXXXXXXXXXXXXXXXX'})
5response = api.post('http://www.example.com/api/users/2/invite_code', params={'regenerate': true})
6print(response.json())1curl "http://www.example.com/api/users/2/invite_code?regenerate=true" -H "Authorization: Token XXXXXXXXXXXXXXXXXXXXXX"Response Fields
| Field | Type | Description |
|---|---|---|
| invite_code | String | Invitation code of the user(nullable) |
Example Response
{
"invite_code": "egiZXBO"
}
Notes
- If
regeneratequery param is not set or set to false, a new invitation code will be created only if the user does not have an existing invitation code.