Skip to content

Create group

Request to create a new group:

POST /api/v2/groups.json

The request body contains the group object. name is required. When tenant_id is omitted, the group is created in the tenant of the API user.

For example:

{
    "group": {
        "name": "Sales Department",
        "tenant_id": "e00a4822-f288-11e4-b559-e03f497dbdff",
        "timezone": "Europe/London"
    }
}

Response contains HTTP status code as shown in the following table.

Response Description
201 Created

The group has been successfully created. The Location header and the response body contain the URL of the new group:

HTTP/1.1 201 Created
Location: /api/v2/groups/e011c408-f288-11e4-9b73-e03f497dbdff.json

{"url": "/api/v2/groups/e011c408-f288-11e4-9b73-e03f497dbdff.json"} | | 400 Bad Request |

The request cannot be completed because the supplied JSON object has invalid data.

The response contains a detailed description of the error, like:

{"error": "InvalidRecord", "explanation": "Record Validation errors", "details": {"name": "Such name is not available"}}
| | 403 Forbidden | The request cannot be completed because API user has no permission to create groups |