Skip to content

Make a subgroup

POST
/groups/{groupId}/subgroups
curl --request POST \
--url https://app.grouperly.com/api/v2/groups/example/subgroups \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "type": "example", "name": "example", "metadata": {}, "roleIds": [ "example" ], "parentId": "example" }'

Of one of the group’s types (a vertical’s type is added to the group the first time it’s used), or made from roles: send roleIds instead of type, and its people are whoever holds them (2.33.0). With parentId it’s made inside that subgroup, at most three levels deep; a subgroup made from roles sits inside nothing and holds nothing (2.36.0). Returns the subgroup (added in 2.14.0).

  • appToken
    https://api.grouperly.com/groups.write
groupId
required
string

The credential’s group

Media typeapplication/json
object
type

The key of one of the group’s subgroup types (GET /subgroup-types), e.g. “den”. Not “leaders” or “parents”: those are worked out, not made. Required unless roleIds is sent.

string
<= 60 characters
name
required

Unique in its type, e.g. “Wolf Den”

string
<= 60 characters
metadata

What the group’s vertical keeps about it, e.g. a den’s rank: { “rank”: “Wolf” }

object
roleIds

Instead of type: make it from these roles of the group (Role.id), e.g. a PLC from Senior Patrol Leader and Patrol Leader. Its people are whoever holds them, kept up to date, and nobody puts people in it by hand (2.33.0)

Array<string>
<= 50 items
parentId

Make it inside this subgroup of the group (Subgroup.id), e.g. Popcorn Sale inside Fundraising. At most three levels deep; not inside, or for, a subgroup made from roles; not inside an archived one (2.36.0)

string | null
<= 64 characters
Examplegenerated
{
"type": "example",
"name": "example",
"metadata": {},
"roleIds": [
"example"
],
"parentId": "example"
}

Created

Media typeapplication/json
object
id
required
string
name
required

Unique in its type, e.g. “Wolf Den”

string
type
required
object
key
required

E.g. “den”

string
singular
required

E.g. “Den”

string
plural
required

E.g. “Dens”

string
metadata
required
One of:
object
archived
required

Kept for its history; takes no one new

boolean
memberCount
required
integer
leaderCount
required
integer
source
required

Picked: its leaders choose its people. roles: whoever holds roleIds, kept up to date (a PLC from Senior Patrol Leader and Patrol Leader); nobody puts people in it by hand, and its type is the hidden _roles (added in 2.33.0)

string
Allowed values: picked roles
roleIds
required

The roles a subgroup made from roles is made from (Role.id); empty for picked (added in 2.33.0)

Array<string>
parentId
required

The subgroup it sits inside (Subgroup.id), or null at the top: Popcorn Sale inside Fundraising. At most three levels. An audience, a shared document or a role held in a subgroup reaches the ones inside it too (added in 2.36.0)

string | null
ledByRoleIds
required

The roles held across the group that lead it (Role.id): whoever holds one is its LEADER while their term lasts, kept up to date, and stops being one after (unless an owner or admin made them a leader by hand). A role held in its type can lead its own as well (Role.leadsSubgroup). Empty for none, and always for a subgroup made from roles (added in 2.57.0)

Array<string>
customFields

The group’s custom fields on the subgroup that the caller may see (GET /field-definitions?entity=SUBGROUP), by key, null where one isn’t set: a key, whoever changes the group’s subgroups and the subgroup’s own leaders (and those of one it sits inside) see every one, anyone else those the whole group sees. On GET /subgroups and /subgroups/{subgroupId} (added in 2.40.0).

object
key
additional properties
string | number | boolean | null
Example
{
"source": "picked"
}
X-RateLimit-Limit
integer

Requests allowed per minute for this credential

X-RateLimit-Remaining
integer

Requests left in this window

X-RateLimit-Reset
integer

When the window ends (Unix seconds)

The body isn’t a JSON object of at most 16 KB, or a field is unknown, missing or malformed (invalid_body, with parameter), or the group has no such type (with parameter type), or a roleId isn’t one of its roles (with parameter roleIds), or both or neither of type and roleIds were sent, or it can’t go inside parentId (with parameter parentId)

Media typeapplication/json
object
error
required
object
code
required

Stable and machine-readable: unauthorized, forbidden, insufficient_scope, key_owner_not_leader, app_not_installed, scope_not_allowed, app_suspended, rate_limited, not_found, invalid_parameter, invalid_body, invalid_profile, invalid_descriptor, no_profile, already_exists, not_a_member, wrong_holder, role_inactive, role_full, already_assigned, assignment_ended, version_not_current, nothing_to_pay, payments_not_ready, payload_too_large, first_party_only, terms_required, child_account, assistant_off, not_for_assistant, assistant_failed, not_a_draft, storage_full, made_from_roles, type_removed, invalid_reporting, led_by_role, unavailable, internal_error. New codes may be added.

string
message
required

For people; wording may change.

string
parameter

The query parameter (invalid_parameter) or body field (invalid_body, not_a_member, wrong_holder, invalid_reporting) at fault.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"parameter": "example"
}
}
X-RateLimit-Limit
integer

Requests allowed per minute for this credential

X-RateLimit-Remaining
integer

Requests left in this window

X-RateLimit-Reset
integer

When the window ends (Unix seconds)

Missing, unknown, revoked or expired credential (unauthorized)

Media typeapplication/json
object
error
required
object
code
required

Stable and machine-readable: unauthorized, forbidden, insufficient_scope, key_owner_not_leader, app_not_installed, scope_not_allowed, app_suspended, rate_limited, not_found, invalid_parameter, invalid_body, invalid_profile, invalid_descriptor, no_profile, already_exists, not_a_member, wrong_holder, role_inactive, role_full, already_assigned, assignment_ended, version_not_current, nothing_to_pay, payments_not_ready, payload_too_large, first_party_only, terms_required, child_account, assistant_off, not_for_assistant, assistant_failed, not_a_draft, storage_full, made_from_roles, type_removed, invalid_reporting, led_by_role, unavailable, internal_error. New codes may be added.

string
message
required

For people; wording may change.

string
parameter

The query parameter (invalid_parameter) or body field (invalid_body, not_a_member, wrong_holder, invalid_reporting) at fault.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"parameter": "example"
}
}

A key: wrong group (forbidden), missing scope (insufficient_scope), or its creator no longer leads the group (key_owner_not_leader). An app’s token: missing scope (insufficient_scope), the group hasn’t installed the app (app_not_installed) or allowed the scope (scope_not_allowed, the message has the consent link), the person may not do this in the group (forbidden), Grouperly paused the app (app_suspended), the person hasn’t accepted Grouperly’s current Terms (terms_required: refresh their token, then send them to the hub’s /account/welcome), or it’s a child’s account (child_account). A viewer token: the same, and forbidden in any group but its own

Media typeapplication/json
object
error
required
object
code
required

Stable and machine-readable: unauthorized, forbidden, insufficient_scope, key_owner_not_leader, app_not_installed, scope_not_allowed, app_suspended, rate_limited, not_found, invalid_parameter, invalid_body, invalid_profile, invalid_descriptor, no_profile, already_exists, not_a_member, wrong_holder, role_inactive, role_full, already_assigned, assignment_ended, version_not_current, nothing_to_pay, payments_not_ready, payload_too_large, first_party_only, terms_required, child_account, assistant_off, not_for_assistant, assistant_failed, not_a_draft, storage_full, made_from_roles, type_removed, invalid_reporting, led_by_role, unavailable, internal_error. New codes may be added.

string
message
required

For people; wording may change.

string
parameter

The query parameter (invalid_parameter) or body field (invalid_body, not_a_member, wrong_holder, invalid_reporting) at fault.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"parameter": "example"
}
}
X-RateLimit-Limit
integer

Requests allowed per minute for this credential

X-RateLimit-Remaining
integer

Requests left in this window

X-RateLimit-Reset
integer

When the window ends (Unix seconds)

The type already has a subgroup with that name (already_exists)

Media typeapplication/json
object
error
required
object
code
required

Stable and machine-readable: unauthorized, forbidden, insufficient_scope, key_owner_not_leader, app_not_installed, scope_not_allowed, app_suspended, rate_limited, not_found, invalid_parameter, invalid_body, invalid_profile, invalid_descriptor, no_profile, already_exists, not_a_member, wrong_holder, role_inactive, role_full, already_assigned, assignment_ended, version_not_current, nothing_to_pay, payments_not_ready, payload_too_large, first_party_only, terms_required, child_account, assistant_off, not_for_assistant, assistant_failed, not_a_draft, storage_full, made_from_roles, type_removed, invalid_reporting, led_by_role, unavailable, internal_error. New codes may be added.

string
message
required

For people; wording may change.

string
parameter

The query parameter (invalid_parameter) or body field (invalid_body, not_a_member, wrong_holder, invalid_reporting) at fault.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"parameter": "example"
}
}
X-RateLimit-Limit
integer

Requests allowed per minute for this credential

X-RateLimit-Remaining
integer

Requests left in this window

X-RateLimit-Reset
integer

When the window ends (Unix seconds)

Rate limited (rate_limited)

Media typeapplication/json
object
error
required
object
code
required

Stable and machine-readable: unauthorized, forbidden, insufficient_scope, key_owner_not_leader, app_not_installed, scope_not_allowed, app_suspended, rate_limited, not_found, invalid_parameter, invalid_body, invalid_profile, invalid_descriptor, no_profile, already_exists, not_a_member, wrong_holder, role_inactive, role_full, already_assigned, assignment_ended, version_not_current, nothing_to_pay, payments_not_ready, payload_too_large, first_party_only, terms_required, child_account, assistant_off, not_for_assistant, assistant_failed, not_a_draft, storage_full, made_from_roles, type_removed, invalid_reporting, led_by_role, unavailable, internal_error. New codes may be added.

string
message
required

For people; wording may change.

string
parameter

The query parameter (invalid_parameter) or body field (invalid_body, not_a_member, wrong_holder, invalid_reporting) at fault.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"parameter": "example"
}
}
X-RateLimit-Limit
integer

Requests allowed per minute for this credential

X-RateLimit-Remaining
integer

Requests left in this window

X-RateLimit-Reset
integer

When the window ends (Unix seconds)

Retry-After
integer

Seconds to wait

An app’s token for someone new, while Grouperly’s sign-in can’t be reached (unavailable); try again

Media typeapplication/json
object
error
required
object
code
required

Stable and machine-readable: unauthorized, forbidden, insufficient_scope, key_owner_not_leader, app_not_installed, scope_not_allowed, app_suspended, rate_limited, not_found, invalid_parameter, invalid_body, invalid_profile, invalid_descriptor, no_profile, already_exists, not_a_member, wrong_holder, role_inactive, role_full, already_assigned, assignment_ended, version_not_current, nothing_to_pay, payments_not_ready, payload_too_large, first_party_only, terms_required, child_account, assistant_off, not_for_assistant, assistant_failed, not_a_draft, storage_full, made_from_roles, type_removed, invalid_reporting, led_by_role, unavailable, internal_error. New codes may be added.

string
message
required

For people; wording may change.

string
parameter

The query parameter (invalid_parameter) or body field (invalid_body, not_a_member, wrong_holder, invalid_reporting) at fault.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"parameter": "example"
}
}