Skip to main content

Create User Group

Create a new user group.

HTTP Request

POST/api/users/groups

Authorization

Authorization

  • Required: Yes
  • Permission: Staff or Admin
  • Authentication: Token-based (Authorization: Token <your_api_key>)

Request Body

FieldTypeRequiredDescription
nameStringYesUnique name of the group.
notesStringNoAdditional description or purpose of the group.

Example Requests

1import requests
2
3api = requests.Session()
4api.headers.update({'Authorization': 'Token f4e75eab6e0f663a972d145478d6fc4b81762070'})
5response = api.post(
6  'http://www.example.com/api/users/groups/',
7  json={
8      'name': 'Engineering Team',
9      'notes': 'Responsible for product development and maintenance.'
10  }
11)
12print(response.json())

Status Codes

CodeDescription
201User group created successfully
400Bad request — invalid input
401Unauthorized — authentication required
403Forbidden — insufficient permissions
500Internal server error

Response Fields

FieldTypeDescription
idIntegerUnique ID of the group.
nameStringName of the group.
notesStringDescription or purpose of the group.
users_countIntegerNumber of users in the group.
created_atString (ISO 8601)Timestamp when the group was created.
updated_atString (ISO 8601)Timestamp when the group was last updated.

Notes

  • The name field must be unique.
  • The notes field is optional.