Update a Group API

On this page

This API is used to update an existing Group.

You must specify all of the properties of the Group when calling this API with the PUT HTTP method. When used with PUT, this API doesn't merge the existing Group and your new data. It replaces the existing Group with your new data.

Utilize the PATCH HTTP method to send specific changes to merge into an existing Group.

Request#

Send the full Group with your changes applied, identifying it by the Id on the URI.

API Key Authentication
Update the Group with the given Id
PUT/api/group/{groupId}
OpenAPI Spec
PATCH/api/group/{groupId}
OpenAPI Spec
Note

For backward compatibility, a PATCH request with a Content-Type of application/json accepts the same body as the PUT request. FusionAuth merges the request into the existing object:

  • FusionAuth keeps every field that the request leaves out, so send only the fields you want to change.
  • FusionAuth merges a map, such as data, by key. To remove a key, set the key to null.
  • FusionAuth appends the values in a request array to the existing array, unless this API documents otherwise. An empty array leaves the existing array unchanged, so you can't remove values from an appending array.
  • FusionAuth adds each object in an array of objects as a new element. FusionAuth doesn't match the object to an existing element by Id or by position.
  • Don't send a value that an array of Ids already contains, such as a key Id or a Tenant Id. Some of these arrays then return a 500 status code.
  • Don't set an array to null. Depending on the field, FusionAuth clears the array or returns a 500 status code.

To remove values from an array, PUT the full object, or set the Content-Type to one of the following media types:

For more information, see The PATCH HTTP Method.

On this API, PATCH appends to roleIds. To remove a role, PUT the full Group. To remove every role, set roleIds to null.

Path Parameters#

groupId
  • Type: UUID
  • Required
  • Immutable

The Id of the Group to update.

Request Headers#

X-FusionAuth-TenantId
  • Type: String
  • Optional

The unique Id of the tenant used to scope this API request.

The tenant Id is not required on this request even when more than one tenant has been configured because the tenant can be identified based upon other values in the request or it is otherwise not required.

Specify a tenant Id on this request when you want to ensure the request is scoped to a specific tenant. The tenant Id may be provided through this header or by using a tenant locked API key to achieve the same result.

See Making an API request using a Tenant Id for additional information.

Request Body#
group.data
  • Type: Object
  • Optional

An object that can hold any information about the Group that should be persisted.

group.name
  • Type: String
  • Required

The name of the Group.

roleIds
  • Type: Array<UUID>
  • Optional

The Application Roles to assign to this group.

Example Request JSON
{
  "group": {
    "data": {
      "description": "This group assigns members admin access to all applications.",
      "external": {
        "createdAt": 1503000771468
      }
    },
    "name": "Company Admins"
  },
  "roleIds": [
    "68259c40-0b4e-4245-8956-7e5af0959c2b",
    "00f24e72-52e2-4f55-8ea1-6a06bfe10df5",
    "11a5b1b8-7ef5-476f-af7d-69e19796fa8b"
  ]
}

Response#

The response for this API contains the Group that was updated.

Response Codes
CodeDescription
200The request succeeded. The response contains a JSON body.
400The request was invalid or malformed. The response contains an Errors JSON object with the specific errors. FusionAuth also returns a 400 when the request needs a paid FusionAuth license and no license is present.
401FusionAuth didn't authorize the request. The Authorization header is missing, the API key isn't valid, or the API key doesn't have permission for this endpoint and method. The response is empty. For more information, see Unauthorized Responses.
404The object you're updating doesn't exist. The response is empty.
500FusionAuth had an internal error and logged a stack trace in the FusionAuth log files. The response usually contains an Errors JSON object with the [Exception] general error code. On MySQL, a data field larger than the database column also returns 500. For more information, see Data Field Sizes.

Response Body#

group.data
  • Type: Object

An object that can hold any information about the Group that should be persisted.

group.id
  • Type: UUID

The unique Id of the Group.

group.insertInstant
  • Type: Long

The instant that the Group was added to the FusionAuth database.

group.lastUpdateInstant
  • Type: Long

The instant that the Group was updated in the FusionAuth database.

group.name
  • Type: String

The name of the Group.

group.roles
  • Type: Map<UUID, List<Object>

The roles assigned to this Group. The map key is the Application Id, the value is an array of Application Roles.

group.roles[applicationId][x].description
  • Type: String

The description of the role.

group.roles[applicationId][x].id
  • Type: UUID

The Application Role Unique Id

group.roles[applicationId][x].name
  • Type: String

The name of the Group.

group.roles[applicationId][x].isDefault
  • Type: Boolean

Whether or not the Role is a default role. A default role is automatically assigned to a user during registration if no roles are provided.

group.roles[applicationId][x].isSuperRole
  • Type: Boolean

Whether or not the Role is considered to be a super user role. This is a marker to indicate that it supersedes all other roles. FusionAuth will attempt to enforce this contract when using the web UI, it is not enforced programmatically when using the API.

group.tenantId
  • Type: UUID

The unique Id of the Tenant.

Example Response JSON
{
  "group": {
    "data": {
      "description": "This group assigns members admin access to all applications.",
      "external": {
        "createdAt": 1503000771468
      }
    },
    "id": "1188edfc-cef3-4555-910e-181ddf6153c0",
    "insertInstant": 1595361142909,
    "lastUpdateInstant": 1595361143101,
    "name": "Company Admins",
    "roles": {
      "931fded0-f917-439d-b447-d7f21b37a134": [
        {
          "id": "68259c40-0b4e-4245-8956-7e5af0959c2b",
          "isDefault": false,
          "isSuperRole": true,
          "name": "admin"
        }
      ],
      "07d1efe7-9a14-433d-8247-2235e67736f0": [
        {
          "id": "00f24e72-52e2-4f55-8ea1-6a06bfe10df5",
          "isDefault": false,
          "isSuperRole": true,
          "name": "ADMIN"
        }
      ],
      "d23e9a51-2b20-4384-9c74-432e12219aad": [
        {
          "id": "11a5b1b8-7ef5-476f-af7d-69e19796fa8b",
          "isDefault": false,
          "isSuperRole": true,
          "name": "Administrator"
        }
      ]
    },
    "tenantId": "30663132-6464-6665-3032-326466613934"
  }
}