# Update team

PATCH https://app.launchdarkly.com/api/v2/teams/{teamKey}
Content-Type: application/json

Perform a partial update to a team. Updating a team uses the semantic patch format.

To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](https://launchdarkly.com/docs/api#updates-using-semantic-patch).

### Instructions

Semantic patch requests support the following `kind` instructions for updating teams. Several of the instructions require one or more member IDs as parameters. The member ID is returned as part of the [List account members](https://launchdarkly.com/docs/api/account-members/get-members) response. It is the `_id` field of each element in the `items` array.


<details>
<summary>Click to expand instructions for <strong>updating teams</strong></summary>

#### addCustomRoles

Adds custom roles to the team. Team members will have these custom roles granted to them.

##### Parameters

- `values`: List of custom role keys.

Here's an example:

```json
{
  "instructions": [{
    "kind": "addCustomRoles",
    "values": [ "example-custom-role" ]
  }]
}
```

#### addMembers

Adds members to the team.

##### Parameters

- `values`: List of member IDs to add.

Here's an example:

```json
{
  "instructions": [{
    "kind": "addMembers",
    "values": [ "1234a56b7c89d012345e678f", "507f1f77bcf86cd799439011" ]
  }]
}
```

#### addPermissionGrants

Adds permission grants to members for the team. For example, a permission grant could allow a member to act as a team maintainer. A permission grant may have either an `actionSet` or a list of `actions` but not both at the same time. The members do not have to be team members to have a permission grant for the team.

##### Parameters

- `actionSet`: Name of the action set.
- `actions`: List of actions.
- `memberIDs`: List of member IDs.

Here's an example:

```json
{
  "instructions": [{
    "kind": "addPermissionGrants",
    "actions": [ "updateTeamName", "updateTeamDescription" ],
    "memberIDs": [ "1234a56b7c89d012345e678f", "507f1f77bcf86cd799439011" ]
  }]
}
```

#### addRoleAttribute

Adds a role attribute to a team. Team members will have these role attribute values scoped for all custom roles granted to them.

##### Parameters

- `key`: The role attribute key to add.
- `values`: List of role attribute values for that key.

Here's an example:

```json
{
  "instructions": [
    {
      "kind": "addRoleAttribute",
      "key": "testAttribute",
      "values": ["someNewValue", "someOtherNewValue"]
    }
  ]
}
```

#### removeCustomRoles

Removes custom roles from the team. The app will no longer grant these custom roles to the team members.

##### Parameters

- `values`: List of custom role keys.

Here's an example:

```json
{
  "instructions": [{
    "kind": "removeCustomRoles",
    "values": [ "example-custom-role" ]
  }]
}
```

#### removeMembers

Removes members from the team.

##### Parameters

- `values`: List of member IDs to remove.

Here's an example:

```json
{
  "instructions": [{
    "kind": "removeMembers",
    "values": [ "1234a56b7c89d012345e678f", "507f1f77bcf86cd799439011" ]
  }]
}
```

#### removePermissionGrants

Removes permission grants from members for the team. A permission grant may have either an `actionSet` or a list of `actions` but not both at the same time. The `actionSet` and `actions` must match an existing permission grant.

##### Parameters

- `actionSet`: Name of the action set.
- `actions`: List of actions.
- `memberIDs`: List of member IDs.

Here's an example:

```json
{
  "instructions": [{
    "kind": "removePermissionGrants",
    "actions": [ "updateTeamName", "updateTeamDescription" ],
    "memberIDs": [ "1234a56b7c89d012345e678f", "507f1f77bcf86cd799439011" ]
  }]
}
```

#### removeRoleAttribute

Removes a role attribute from the team.

##### Parameters

- `key`: The role attribute key to remove.

Here's an example:
```json
{
  "instructions": [
    {
      "kind": "removeRoleAttribute",
      "key": "testAttribute"
    }
  ]
}
```

#### replaceMembers

Replaces the existing members of the team with the new members.

##### Parameters

- `values`: List of member IDs of the new members.

Here's an example:

```json
{
  "instructions": [{
    "kind": "replaceMembers",
    "values": [ "1234a56b7c89d012345e678f", "507f1f77bcf86cd799439011" ]
  }]
}
```

#### replaceRoleAttributes

Replaces the existing role attributes for the team with new role attributes.

##### Parameters

- `value`: A map of role attribute keys to lists of role attribute values

Here's an example:

```json
{
  "instructions": [{
    "kind": "replaceRoleAttributes",
    "value": {
      "testAttribute": [ "someNewValue", "someOtherNewValue" ],
      "projectRoleAttribute": [ "project1", "project2"]
    }
  }]
}
```

#### updateDescription

Updates the description of the team.

##### Parameters

- `value`: The new description.

Here's an example:

```json
{
  "instructions": [{
    "kind": "updateDescription",
    "value": "Updated team description"
  }]
}
```

#### updateName

Updates the name of the team.

##### Parameters

- `value`: The new name.

Here's an example:

```json
{
  "instructions": [{
    "kind": "updateName",
    "value": "Updated team name"
  }]
}
```

#### updateRoleAttribute

Updates a role attribute on the team. Any existing values for the given key will be replaced with the new values. Team members will have these role attribute values scoped for all custom roles granted to them.

##### Parameters

- `key`: The role attribute key to update.
- `values`: List of role attribute values for that key.

Here's an example:
```json
{
  "instructions": [
    {
      "kind": "updateRoleAttribute",
      "key": "testAttribute",
      "values": ["someNewValue", "someOtherNewValue"]
    }
  ]
}
```

</details>

### Expanding the teams response
LaunchDarkly supports four fields for expanding the "Update team" response. By default, these fields are **not** included in the response.

To expand the response, append the `expand` query parameter and add a comma-separated list with any of the following fields:

* `members` includes the total count of members that belong to the team.
* `roles` includes a paginated list of the custom roles that you have assigned to the team.
* `projects` includes a paginated list of the projects that the team has any write access to.
* `maintainers` includes a paginated list of the maintainers that you have assigned to the team.

For example, `expand=members,roles` includes the `members` and `roles` fields in the response.


Reference: https://launchdarkly.com/docs/api/teams/patch-team

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: LaunchDarkly REST API
  version: 1.0.0
paths:
  /api/v2/teams/{teamKey}:
    patch:
      operationId: patch-team
      summary: Update team
      description: >
        Perform a partial update to a team. Updating a team uses the semantic
        patch format.


        To make a semantic patch request, you must append
        `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header.
        To learn more, read [Updates using semantic
        patch](https://launchdarkly.com/docs/api#updates-using-semantic-patch).


        ### Instructions


        Semantic patch requests support the following `kind` instructions for
        updating teams. Several of the instructions require one or more member
        IDs as parameters. The member ID is returned as part of the [List
        account
        members](https://launchdarkly.com/docs/api/account-members/get-members)
        response. It is the `_id` field of each element in the `items` array.



        <details>

        <summary>Click to expand instructions for <strong>updating
        teams</strong></summary>


        #### addCustomRoles


        Adds custom roles to the team. Team members will have these custom roles
        granted to them.


        ##### Parameters


        - `values`: List of custom role keys.


        Here's an example:


        ```json

        {
          "instructions": [{
            "kind": "addCustomRoles",
            "values": [ "example-custom-role" ]
          }]
        }

        ```


        #### addMembers


        Adds members to the team.


        ##### Parameters


        - `values`: List of member IDs to add.


        Here's an example:


        ```json

        {
          "instructions": [{
            "kind": "addMembers",
            "values": [ "1234a56b7c89d012345e678f", "507f1f77bcf86cd799439011" ]
          }]
        }

        ```


        #### addPermissionGrants


        Adds permission grants to members for the team. For example, a
        permission grant could allow a member to act as a team maintainer. A
        permission grant may have either an `actionSet` or a list of `actions`
        but not both at the same time. The members do not have to be team
        members to have a permission grant for the team.


        ##### Parameters


        - `actionSet`: Name of the action set.

        - `actions`: List of actions.

        - `memberIDs`: List of member IDs.


        Here's an example:


        ```json

        {
          "instructions": [{
            "kind": "addPermissionGrants",
            "actions": [ "updateTeamName", "updateTeamDescription" ],
            "memberIDs": [ "1234a56b7c89d012345e678f", "507f1f77bcf86cd799439011" ]
          }]
        }

        ```


        #### addRoleAttribute


        Adds a role attribute to a team. Team members will have these role
        attribute values scoped for all custom roles granted to them.


        ##### Parameters


        - `key`: The role attribute key to add.

        - `values`: List of role attribute values for that key.


        Here's an example:


        ```json

        {
          "instructions": [
            {
              "kind": "addRoleAttribute",
              "key": "testAttribute",
              "values": ["someNewValue", "someOtherNewValue"]
            }
          ]
        }

        ```


        #### removeCustomRoles


        Removes custom roles from the team. The app will no longer grant these
        custom roles to the team members.


        ##### Parameters


        - `values`: List of custom role keys.


        Here's an example:


        ```json

        {
          "instructions": [{
            "kind": "removeCustomRoles",
            "values": [ "example-custom-role" ]
          }]
        }

        ```


        #### removeMembers


        Removes members from the team.


        ##### Parameters


        - `values`: List of member IDs to remove.


        Here's an example:


        ```json

        {
          "instructions": [{
            "kind": "removeMembers",
            "values": [ "1234a56b7c89d012345e678f", "507f1f77bcf86cd799439011" ]
          }]
        }

        ```


        #### removePermissionGrants


        Removes permission grants from members for the team. A permission grant
        may have either an `actionSet` or a list of `actions` but not both at
        the same time. The `actionSet` and `actions` must match an existing
        permission grant.


        ##### Parameters


        - `actionSet`: Name of the action set.

        - `actions`: List of actions.

        - `memberIDs`: List of member IDs.


        Here's an example:


        ```json

        {
          "instructions": [{
            "kind": "removePermissionGrants",
            "actions": [ "updateTeamName", "updateTeamDescription" ],
            "memberIDs": [ "1234a56b7c89d012345e678f", "507f1f77bcf86cd799439011" ]
          }]
        }

        ```


        #### removeRoleAttribute


        Removes a role attribute from the team.


        ##### Parameters


        - `key`: The role attribute key to remove.


        Here's an example:

        ```json

        {
          "instructions": [
            {
              "kind": "removeRoleAttribute",
              "key": "testAttribute"
            }
          ]
        }

        ```


        #### replaceMembers


        Replaces the existing members of the team with the new members.


        ##### Parameters


        - `values`: List of member IDs of the new members.


        Here's an example:


        ```json

        {
          "instructions": [{
            "kind": "replaceMembers",
            "values": [ "1234a56b7c89d012345e678f", "507f1f77bcf86cd799439011" ]
          }]
        }

        ```


        #### replaceRoleAttributes


        Replaces the existing role attributes for the team with new role
        attributes.


        ##### Parameters


        - `value`: A map of role attribute keys to lists of role attribute
        values


        Here's an example:


        ```json

        {
          "instructions": [{
            "kind": "replaceRoleAttributes",
            "value": {
              "testAttribute": [ "someNewValue", "someOtherNewValue" ],
              "projectRoleAttribute": [ "project1", "project2"]
            }
          }]
        }

        ```


        #### updateDescription


        Updates the description of the team.


        ##### Parameters


        - `value`: The new description.


        Here's an example:


        ```json

        {
          "instructions": [{
            "kind": "updateDescription",
            "value": "Updated team description"
          }]
        }

        ```


        #### updateName


        Updates the name of the team.


        ##### Parameters


        - `value`: The new name.


        Here's an example:


        ```json

        {
          "instructions": [{
            "kind": "updateName",
            "value": "Updated team name"
          }]
        }

        ```


        #### updateRoleAttribute


        Updates a role attribute on the team. Any existing values for the given
        key will be replaced with the new values. Team members will have these
        role attribute values scoped for all custom roles granted to them.


        ##### Parameters


        - `key`: The role attribute key to update.

        - `values`: List of role attribute values for that key.


        Here's an example:

        ```json

        {
          "instructions": [
            {
              "kind": "updateRoleAttribute",
              "key": "testAttribute",
              "values": ["someNewValue", "someOtherNewValue"]
            }
          ]
        }

        ```


        </details>


        ### Expanding the teams response

        LaunchDarkly supports four fields for expanding the "Update team"
        response. By default, these fields are **not** included in the response.


        To expand the response, append the `expand` query parameter and add a
        comma-separated list with any of the following fields:


        * `members` includes the total count of members that belong to the team.

        * `roles` includes a paginated list of the custom roles that you have
        assigned to the team.

        * `projects` includes a paginated list of the projects that the team has
        any write access to.

        * `maintainers` includes a paginated list of the maintainers that you
        have assigned to the team.


        For example, `expand=members,roles` includes the `members` and `roles`
        fields in the response.
      tags:
        - subpackage_teams
      parameters:
        - name: teamKey
          in: path
          description: The team key
          required: true
          schema:
            type: string
            format: string
        - name: expand
          in: query
          description: >-
            A comma-separated list of properties that can reveal additional
            information in the response. Supported fields are explained above.
          required: false
          schema:
            type: string
            format: string
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Teams response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Team'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidRequestErrorRep'
        '401':
          description: Invalid access token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedErrorRep'
        '404':
          description: Invalid resource identifier
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundErrorRep'
        '405':
          description: Method not allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MethodNotAllowedErrorRep'
        '409':
          description: Status conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusConflictErrorRep'
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitedErrorRep'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/teamPatchInput'
servers:
  - url: https://app.launchdarkly.com
  - url: https://app.launchdarkly.us
components:
  schemas:
    Instruction:
      type: object
      additionalProperties:
        description: Any type
      title: Instruction
    Instructions:
      type: array
      items:
        $ref: '#/components/schemas/Instruction'
      title: Instructions
    teamPatchInput:
      type: object
      properties:
        comment:
          type: string
          description: Optional comment describing the update
        instructions:
          $ref: '#/components/schemas/Instructions'
          description: >-
            The instructions to perform when updating. This should be an array
            with objects that look like <code>{"kind": "update_action"}</code>.
            Some instructions also require additional parameters as part of this
            object.
      required:
        - instructions
      title: teamPatchInput
    ActionIdentifier:
      type: string
      title: ActionIdentifier
    ActionSpecifier:
      type: string
      title: ActionSpecifier
    AccessDeniedReasonEffect:
      type: string
      enum:
        - allow
        - deny
      description: Whether this statement should allow or deny actions on the resources.
      title: AccessDeniedReasonEffect
    AccessDeniedReason:
      type: object
      properties:
        resources:
          type: array
          items:
            type: string
          description: Resource specifier strings
        notResources:
          type: array
          items:
            type: string
          description: >-
            Targeted resources are the resources NOT in this list. The
            <code>resources</code> and <code>notActions</code> fields must be
            empty to use this field.
        actions:
          type: array
          items:
            $ref: '#/components/schemas/ActionSpecifier'
          description: Actions to perform on a resource
        notActions:
          type: array
          items:
            $ref: '#/components/schemas/ActionSpecifier'
          description: >-
            Targeted actions are the actions NOT in this list. The
            <code>actions</code> and <code>notResources</code> fields must be
            empty to use this field.
        effect:
          $ref: '#/components/schemas/AccessDeniedReasonEffect'
          description: >-
            Whether this statement should allow or deny actions on the
            resources.
        role_name:
          type: string
      required:
        - effect
      title: AccessDeniedReason
    AccessDenied:
      type: object
      properties:
        action:
          $ref: '#/components/schemas/ActionIdentifier'
        reason:
          $ref: '#/components/schemas/AccessDeniedReason'
      required:
        - action
        - reason
      title: AccessDenied
    AccessAllowedReasonEffect:
      type: string
      enum:
        - allow
        - deny
      description: Whether this statement should allow or deny actions on the resources.
      title: AccessAllowedReasonEffect
    AccessAllowedReason:
      type: object
      properties:
        resources:
          type: array
          items:
            type: string
          description: Resource specifier strings
        notResources:
          type: array
          items:
            type: string
          description: >-
            Targeted resources are the resources NOT in this list. The
            <code>resources</code> and <code>notActions</code> fields must be
            empty to use this field.
        actions:
          type: array
          items:
            $ref: '#/components/schemas/ActionSpecifier'
          description: Actions to perform on a resource
        notActions:
          type: array
          items:
            $ref: '#/components/schemas/ActionSpecifier'
          description: >-
            Targeted actions are the actions NOT in this list. The
            <code>actions</code> and <code>notResources</code> fields must be
            empty to use this field.
        effect:
          $ref: '#/components/schemas/AccessAllowedReasonEffect'
          description: >-
            Whether this statement should allow or deny actions on the
            resources.
        role_name:
          type: string
      required:
        - effect
      title: AccessAllowedReason
    AccessAllowedRep:
      type: object
      properties:
        action:
          $ref: '#/components/schemas/ActionIdentifier'
        reason:
          $ref: '#/components/schemas/AccessAllowedReason'
      required:
        - action
        - reason
      title: AccessAllowedRep
    Access:
      type: object
      properties:
        denied:
          type: array
          items:
            $ref: '#/components/schemas/AccessDenied'
        allowed:
          type: array
          items:
            $ref: '#/components/schemas/AccessAllowedRep'
      required:
        - denied
        - allowed
      title: Access
    UnixMillis:
      type: integer
      format: int64
      title: UnixMillis
    Link:
      type: object
      properties:
        href:
          type: string
          description: The URL of the link
        type:
          type: string
          description: The type of the link
      title: Link
    RoleAttributeValues:
      type: array
      items:
        type: string
      title: RoleAttributeValues
    RoleAttributeMap:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/RoleAttributeValues'
      title: RoleAttributeMap
    ProjectSummary:
      type: object
      properties:
        _id:
          type: string
          description: The ID of this project
        _links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          description: The location and content type of related resources
        key:
          type: string
          description: The project key
        name:
          type: string
          description: The project name
      required:
        - _id
        - _links
        - key
        - name
      title: ProjectSummary
    TeamProjects:
      type: object
      properties:
        totalCount:
          type: integer
        items:
          type: array
          items:
            $ref: '#/components/schemas/ProjectSummary'
          description: >-
            Details on each project where team members have write privileges on
            at least one resource type (e.g. flags)
      title: TeamProjects
    TeamCustomRole:
      type: object
      properties:
        key:
          type: string
          description: The key of the custom role
        name:
          type: string
          description: The name of the custom role
        projects:
          $ref: '#/components/schemas/TeamProjects'
          description: >-
            Details on the projects where team members have write privileges on
            at least one resource type (e.g. flags)
        appliedOn:
          $ref: '#/components/schemas/UnixMillis'
          description: Timestamp of when the custom role was assigned to this team
      title: TeamCustomRole
    TeamCustomRoles:
      type: object
      properties:
        totalCount:
          type: integer
          description: The number of custom roles assigned to this team
        items:
          type: array
          items:
            $ref: '#/components/schemas/TeamCustomRole'
          description: An array of the custom roles that have been assigned to this team
        _links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          description: The location and content type of related resources
      title: TeamCustomRoles
    TeamMembers:
      type: object
      properties:
        totalCount:
          type: integer
          description: The total count of members that belong to the team
      title: TeamMembers
    MemberSummary:
      type: object
      properties:
        _links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          description: The location and content type of related resources
        _id:
          type: string
          description: The member's ID
        firstName:
          type: string
          description: The member's first name
        lastName:
          type: string
          description: The member's last name
        role:
          type: string
          description: >-
            The member's base role. If the member has no additional roles, this
            role will be in effect.
        email:
          type: string
          description: The member's email address
      required:
        - _links
        - _id
        - role
        - email
      title: MemberSummary
    TeamMaintainers:
      type: object
      properties:
        totalCount:
          type: integer
          description: The number of maintainers of the team
        items:
          type: array
          items:
            $ref: '#/components/schemas/MemberSummary'
          description: >-
            Details on the members that have been assigned as maintainers of the
            team
        _links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          description: The location and content type of related resources
      title: TeamMaintainers
    Team:
      type: object
      properties:
        description:
          type: string
          description: A description of the team
        key:
          type: string
          description: The team key
        name:
          type: string
          description: A human-friendly name for the team
        _access:
          $ref: '#/components/schemas/Access'
          description: Details on the allowed and denied actions for this team
        _creationDate:
          $ref: '#/components/schemas/UnixMillis'
          description: Timestamp of when the team was created
        _links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          description: The location and content type of related resources
        _lastModified:
          $ref: '#/components/schemas/UnixMillis'
          description: Timestamp of when the team was most recently updated
        _version:
          type: integer
          description: The team version
        _idpSynced:
          type: boolean
          description: >-
            Whether the team has been synced with an external identity provider
            (IdP). Team sync is available to customers on an Enterprise plan.
        roleAttributes:
          $ref: '#/components/schemas/RoleAttributeMap'
          description: A map of role attributes for the team
        roles:
          $ref: '#/components/schemas/TeamCustomRoles'
          description: >-
            Paginated list of the custom roles assigned to this team. Only
            included if specified in the <code>expand</code> query parameter.
        members:
          $ref: '#/components/schemas/TeamMembers'
          description: >-
            Details on the total count of members that belong to the team. Only
            included if specified in the <code>expand</code> query parameter.
        projects:
          $ref: '#/components/schemas/TeamProjects'
          description: >-
            Paginated list of the projects that the team has any write access
            to. Only included if specified in the <code>expand</code> query
            parameter.
        maintainers:
          $ref: '#/components/schemas/TeamMaintainers'
          description: >-
            Paginated list of the maintainers assigned to this team. Only
            included if specified in the <code>expand</code> query parameter.
      title: Team
    InvalidRequestErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: InvalidRequestErrorRep
    UnauthorizedErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: UnauthorizedErrorRep
    NotFoundErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: NotFoundErrorRep
    MethodNotAllowedErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: MethodNotAllowedErrorRep
    StatusConflictErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: StatusConflictErrorRep
    RateLimitedErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: RateLimitedErrorRep
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: Authorization

```

## SDK Code Examples

```python
import requests

url = "https://app.launchdarkly.com/api/v2/teams/teamKey"

payload = {
    "instructions": [
        {
            "kind": "updateDescription",
            "value": "New description for the team"
        }
    ],
    "comment": "Optional comment about the update"
}
headers = {
    "Authorization": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://app.launchdarkly.com/api/v2/teams/teamKey';
const options = {
  method: 'PATCH',
  headers: {Authorization: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"instructions":[{"kind":"updateDescription","value":"New description for the team"}],"comment":"Optional comment about the update"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.launchdarkly.com/api/v2/teams/teamKey"

	payload := strings.NewReader("{\n  \"instructions\": [\n    {\n      \"kind\": \"updateDescription\",\n      \"value\": \"New description for the team\"\n    }\n  ],\n  \"comment\": \"Optional comment about the update\"\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://app.launchdarkly.com/api/v2/teams/teamKey")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"instructions\": [\n    {\n      \"kind\": \"updateDescription\",\n      \"value\": \"New description for the team\"\n    }\n  ],\n  \"comment\": \"Optional comment about the update\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://app.launchdarkly.com/api/v2/teams/teamKey")
  .header("Authorization", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"instructions\": [\n    {\n      \"kind\": \"updateDescription\",\n      \"value\": \"New description for the team\"\n    }\n  ],\n  \"comment\": \"Optional comment about the update\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://app.launchdarkly.com/api/v2/teams/teamKey', [
  'body' => '{
  "instructions": [
    {
      "kind": "updateDescription",
      "value": "New description for the team"
    }
  ],
  "comment": "Optional comment about the update"
}',
  'headers' => [
    'Authorization' => '<apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://app.launchdarkly.com/api/v2/teams/teamKey");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"instructions\": [\n    {\n      \"kind\": \"updateDescription\",\n      \"value\": \"New description for the team\"\n    }\n  ],\n  \"comment\": \"Optional comment about the update\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "instructions": [
    [
      "kind": "updateDescription",
      "value": "New description for the team"
    ]
  ],
  "comment": "Optional comment about the update"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://app.launchdarkly.com/api/v2/teams/teamKey")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```