> This page is for mk.io.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://mediakind.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://mediakind.ferndocs.com/_mcp/server.

# Patch a Team

PATCH https://app.mk.io/api/v1/organization/teams/{team_name}
Content-Type: application/json

Modify a team using a JSON patch format document

RBAC Capability Required: `core.team.update`

Reference: https://mediakind.ferndocs.com/mkio/api/management/teams/patch-team

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `team_name` (string, required)

### Body (application/json)

This endpoint expects a list of JsonPatchEntry.

- `list of JsonPatchEntry`

## Response

### 200

Updated

- `metadata` (TeamMetadataSchema, required) — Team metadata.
- `spec` (TeamSpecSchemaRead, required) — Team specification.
- `kind` (string, optional) — The kind of record.

## Errors

### 400 Bad Request Error

Bad Request

- `error` (ErrorDetail, required) — Pertinent information about the error
- `ref` (string, required) — A reference to the request that caused the error.
- `status` (integer, required) — The HTTP status code

### 401 Unauthorized Error

Unauthorized

- `error` (ErrorDetail, required) — Pertinent information about the error
- `ref` (string, required) — A reference to the request that caused the error.
- `status` (integer, required) — The HTTP status code

### 403 Forbidden Error

Forbidden

- `error` (ErrorDetail, required) — Pertinent information about the error
- `ref` (string, required) — A reference to the request that caused the error.
- `status` (integer, required) — The HTTP status code

### 404 Not Found Error

Not Found

- `error` (ErrorDetail, required) — Pertinent information about the error
- `ref` (string, required) — A reference to the request that caused the error.
- `status` (integer, required) — The HTTP status code

### 429 Too Many Requests Error

Too Many Requests

- `error` (ErrorDetail, required) — Pertinent information about the error
- `ref` (string, required) — A reference to the request that caused the error.
- `status` (integer, required) — The HTTP status code

### 500 Internal Server Error

Internal Server Error

- `error` (ErrorDetail, required) — Pertinent information about the error
- `ref` (string, required) — A reference to the request that caused the error.
- `status` (integer, required) — The HTTP status code

## Types

### JsonPatchEntry

- `op` (enum, required) — Operation
  - Allowed values: `add`, `remove`, `replace`, `stringReplace`, `numberReplace`
- `path` (string, required) — Path
- `search` (string, optional) — Search string for 'stringReplace' and 'numberReplace' operations. 'numberReplace' replaces with JSON number type but only when the search string matches the entire value. I.e "audio_pid" would be replaced with 50, not "50".
- `value` (any, optional) — Value

### TeamMetadataSchema

- `id` (string, required) — The ID of the resource
- `name` (string, optional) — The name of the resource

### TeamSpecSchemaRead

- `description` (string, optional) — A description of the team.
- `members` (map from string to TeamMemberSchemaRead, optional) — The list of members.
- `scopes` (map from string to TeamScopeSchema, optional) — The set of scopes this team has access to, and the roles on each.

### ErrorDetail

- `code` (string, required) — The error code.
- `detail` (string, required) — The error message.
- `extraDetail` (map from string to any, optional) — Extra information regarding this error.

### TeamMemberSchemaRead

- `email` (string, required) — The email address of the team member
- `isTeamAdmin` (boolean, required) — Does this user have the ability to edit this team
- `name` (string, required) — The name of the team member

### TeamScopeSchema

- `roles` (list of string, required) — The names of the roles.

## Examples

### Add a new member to a team by ID

**Request**

```json
[
  {
    "op": "add",
    "path": "/spec/members/{user_id}",
    "value": {
      "isTeamAdmin": false
    }
  }
]
```

**Response**

```json
{
  "metadata": {
    "id": "string",
    "name": "string"
  },
  "spec": {
    "description": "string",
    "members": {
      "user-id": {
        "isTeamAdmin": true
      }
    },
    "scopes": {
      "scopeName": {
        "roles": [
          "roleName",
          "roleName2"
        ]
      }
    }
  },
  "kind": "string"
}
```

**SDK Code**

```python Add a new member to a team by ID
import requests

url = "https://app.mk.io/api/v1/organization/teams/team_name"

payload = [
    {
        "op": "add",
        "path": "/spec/members/{user_id}",
        "value": { "isTeamAdmin": False }
    }
]
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Add a new member to a team by ID
const url = 'https://app.mk.io/api/v1/organization/teams/team_name';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '[{"op":"add","path":"/spec/members/{user_id}","value":{"isTeamAdmin":false}}]'
};

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

```go Add a new member to a team by ID
package main

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

func main() {

	url := "https://app.mk.io/api/v1/organization/teams/team_name"

	payload := strings.NewReader("[\n  {\n    \"op\": \"add\",\n    \"path\": \"/spec/members/{user_id}\",\n    \"value\": {\n      \"isTeamAdmin\": false\n    }\n  }\n]")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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 Add a new member to a team by ID
require 'uri'
require 'net/http'

url = URI("https://app.mk.io/api/v1/organization/teams/team_name")

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n  {\n    \"op\": \"add\",\n    \"path\": \"/spec/members/{user_id}\",\n    \"value\": {\n      \"isTeamAdmin\": false\n    }\n  }\n]"

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

```java Add a new member to a team by ID
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://app.mk.io/api/v1/organization/teams/team_name")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"op\": \"add\",\n    \"path\": \"/spec/members/{user_id}\",\n    \"value\": {\n      \"isTeamAdmin\": false\n    }\n  }\n]")
  .asString();
```

```php Add a new member to a team by ID
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://app.mk.io/api/v1/organization/teams/team_name', [
  'body' => '[
  {
    "op": "add",
    "path": "/spec/members/{user_id}",
    "value": {
      "isTeamAdmin": false
    }
  }
]',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Add a new member to a team by ID
using RestSharp;

var client = new RestClient("https://app.mk.io/api/v1/organization/teams/team_name");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {\n    \"op\": \"add\",\n    \"path\": \"/spec/members/{user_id}\",\n    \"value\": {\n      \"isTeamAdmin\": false\n    }\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Add a new member to a team by ID
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  [
    "op": "add",
    "path": "/spec/members/{user_id}",
    "value": ["isTeamAdmin": false]
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://app.mk.io/api/v1/organization/teams/team_name")! 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()
```

### Add a new scope/role combination to the team

**Request**

```json
[
  {
    "op": "add",
    "path": "/spec/scopes/{scopeName}/roles/-",
    "value": "{roleName}"
  }
]
```

**Response**

```json
{
  "metadata": {
    "id": "string",
    "name": "string"
  },
  "spec": {
    "description": "string",
    "members": {
      "user-id": {
        "isTeamAdmin": true
      }
    },
    "scopes": {
      "scopeName": {
        "roles": [
          "roleName",
          "roleName2"
        ]
      }
    }
  },
  "kind": "string"
}
```

**SDK Code**

```python Add a new scope/role combination to the team
import requests

url = "https://app.mk.io/api/v1/organization/teams/team_name"

payload = [
    {
        "op": "add",
        "path": "/spec/scopes/{scopeName}/roles/-",
        "value": "{roleName}"
    }
]
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Add a new scope/role combination to the team
const url = 'https://app.mk.io/api/v1/organization/teams/team_name';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '[{"op":"add","path":"/spec/scopes/{scopeName}/roles/-","value":"{roleName}"}]'
};

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

```go Add a new scope/role combination to the team
package main

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

func main() {

	url := "https://app.mk.io/api/v1/organization/teams/team_name"

	payload := strings.NewReader("[\n  {\n    \"op\": \"add\",\n    \"path\": \"/spec/scopes/{scopeName}/roles/-\",\n    \"value\": \"{roleName}\"\n  }\n]")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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 Add a new scope/role combination to the team
require 'uri'
require 'net/http'

url = URI("https://app.mk.io/api/v1/organization/teams/team_name")

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n  {\n    \"op\": \"add\",\n    \"path\": \"/spec/scopes/{scopeName}/roles/-\",\n    \"value\": \"{roleName}\"\n  }\n]"

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

```java Add a new scope/role combination to the team
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://app.mk.io/api/v1/organization/teams/team_name")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"op\": \"add\",\n    \"path\": \"/spec/scopes/{scopeName}/roles/-\",\n    \"value\": \"{roleName}\"\n  }\n]")
  .asString();
```

```php Add a new scope/role combination to the team
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://app.mk.io/api/v1/organization/teams/team_name', [
  'body' => '[
  {
    "op": "add",
    "path": "/spec/scopes/{scopeName}/roles/-",
    "value": "{roleName}"
  }
]',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Add a new scope/role combination to the team
using RestSharp;

var client = new RestClient("https://app.mk.io/api/v1/organization/teams/team_name");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {\n    \"op\": \"add\",\n    \"path\": \"/spec/scopes/{scopeName}/roles/-\",\n    \"value\": \"{roleName}\"\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Add a new scope/role combination to the team
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  [
    "op": "add",
    "path": "/spec/scopes/{scopeName}/roles/-",
    "value": "{roleName}"
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://app.mk.io/api/v1/organization/teams/team_name")! 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()
```

### Grant a user the ability to change team membership

**Request**

```json
[
  {
    "op": "replace",
    "path": "/spec/members/{user_id}/isTeamAdmin",
    "value": true
  }
]
```

**Response**

```json
{
  "metadata": {
    "id": "string",
    "name": "string"
  },
  "spec": {
    "description": "string",
    "members": {
      "user-id": {
        "isTeamAdmin": true
      }
    },
    "scopes": {
      "scopeName": {
        "roles": [
          "roleName",
          "roleName2"
        ]
      }
    }
  },
  "kind": "string"
}
```

**SDK Code**

```python Grant a user the ability to change team membership
import requests

url = "https://app.mk.io/api/v1/organization/teams/team_name"

payload = [
    {
        "op": "replace",
        "path": "/spec/members/{user_id}/isTeamAdmin",
        "value": True
    }
]
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Grant a user the ability to change team membership
const url = 'https://app.mk.io/api/v1/organization/teams/team_name';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '[{"op":"replace","path":"/spec/members/{user_id}/isTeamAdmin","value":true}]'
};

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

```go Grant a user the ability to change team membership
package main

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

func main() {

	url := "https://app.mk.io/api/v1/organization/teams/team_name"

	payload := strings.NewReader("[\n  {\n    \"op\": \"replace\",\n    \"path\": \"/spec/members/{user_id}/isTeamAdmin\",\n    \"value\": true\n  }\n]")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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 Grant a user the ability to change team membership
require 'uri'
require 'net/http'

url = URI("https://app.mk.io/api/v1/organization/teams/team_name")

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n  {\n    \"op\": \"replace\",\n    \"path\": \"/spec/members/{user_id}/isTeamAdmin\",\n    \"value\": true\n  }\n]"

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

```java Grant a user the ability to change team membership
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://app.mk.io/api/v1/organization/teams/team_name")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"op\": \"replace\",\n    \"path\": \"/spec/members/{user_id}/isTeamAdmin\",\n    \"value\": true\n  }\n]")
  .asString();
```

```php Grant a user the ability to change team membership
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://app.mk.io/api/v1/organization/teams/team_name', [
  'body' => '[
  {
    "op": "replace",
    "path": "/spec/members/{user_id}/isTeamAdmin",
    "value": true
  }
]',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Grant a user the ability to change team membership
using RestSharp;

var client = new RestClient("https://app.mk.io/api/v1/organization/teams/team_name");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {\n    \"op\": \"replace\",\n    \"path\": \"/spec/members/{user_id}/isTeamAdmin\",\n    \"value\": true\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Grant a user the ability to change team membership
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  [
    "op": "replace",
    "path": "/spec/members/{user_id}/isTeamAdmin",
    "value": true
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://app.mk.io/api/v1/organization/teams/team_name")! 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()
```

### Remove a member from a team

**Request**

```json
[
  {
    "op": "remove",
    "path": "/spec/members/{user_id}"
  }
]
```

**Response**

```json
{
  "metadata": {
    "id": "string",
    "name": "string"
  },
  "spec": {
    "description": "string",
    "members": {
      "user-id": {
        "isTeamAdmin": true
      }
    },
    "scopes": {
      "scopeName": {
        "roles": [
          "roleName",
          "roleName2"
        ]
      }
    }
  },
  "kind": "string"
}
```

**SDK Code**

```python Remove a member from a team
import requests

url = "https://app.mk.io/api/v1/organization/teams/team_name"

payload = [
    {
        "op": "remove",
        "path": "/spec/members/{user_id}"
    }
]
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Remove a member from a team
const url = 'https://app.mk.io/api/v1/organization/teams/team_name';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '[{"op":"remove","path":"/spec/members/{user_id}"}]'
};

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

```go Remove a member from a team
package main

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

func main() {

	url := "https://app.mk.io/api/v1/organization/teams/team_name"

	payload := strings.NewReader("[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/spec/members/{user_id}\"\n  }\n]")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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 Remove a member from a team
require 'uri'
require 'net/http'

url = URI("https://app.mk.io/api/v1/organization/teams/team_name")

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/spec/members/{user_id}\"\n  }\n]"

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

```java Remove a member from a team
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://app.mk.io/api/v1/organization/teams/team_name")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/spec/members/{user_id}\"\n  }\n]")
  .asString();
```

```php Remove a member from a team
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://app.mk.io/api/v1/organization/teams/team_name', [
  'body' => '[
  {
    "op": "remove",
    "path": "/spec/members/{user_id}"
  }
]',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Remove a member from a team
using RestSharp;

var client = new RestClient("https://app.mk.io/api/v1/organization/teams/team_name");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/spec/members/{user_id}\"\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Remove a member from a team
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  [
    "op": "remove",
    "path": "/spec/members/{user_id}"
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://app.mk.io/api/v1/organization/teams/team_name")! 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()
```

### Remove the named scope/role combination from this team

**Request**

```json
[
  {
    "op": "remove",
    "path": "/spec/scopes/{scopeName}/roles/{roleName}"
  }
]
```

**Response**

```json
{
  "metadata": {
    "id": "string",
    "name": "string"
  },
  "spec": {
    "description": "string",
    "members": {
      "user-id": {
        "isTeamAdmin": true
      }
    },
    "scopes": {
      "scopeName": {
        "roles": [
          "roleName",
          "roleName2"
        ]
      }
    }
  },
  "kind": "string"
}
```

**SDK Code**

```python Remove the named scope/role combination from this team
import requests

url = "https://app.mk.io/api/v1/organization/teams/team_name"

payload = [
    {
        "op": "remove",
        "path": "/spec/scopes/{scopeName}/roles/{roleName}"
    }
]
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Remove the named scope/role combination from this team
const url = 'https://app.mk.io/api/v1/organization/teams/team_name';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '[{"op":"remove","path":"/spec/scopes/{scopeName}/roles/{roleName}"}]'
};

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

```go Remove the named scope/role combination from this team
package main

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

func main() {

	url := "https://app.mk.io/api/v1/organization/teams/team_name"

	payload := strings.NewReader("[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/spec/scopes/{scopeName}/roles/{roleName}\"\n  }\n]")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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 Remove the named scope/role combination from this team
require 'uri'
require 'net/http'

url = URI("https://app.mk.io/api/v1/organization/teams/team_name")

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/spec/scopes/{scopeName}/roles/{roleName}\"\n  }\n]"

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

```java Remove the named scope/role combination from this team
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://app.mk.io/api/v1/organization/teams/team_name")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/spec/scopes/{scopeName}/roles/{roleName}\"\n  }\n]")
  .asString();
```

```php Remove the named scope/role combination from this team
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://app.mk.io/api/v1/organization/teams/team_name', [
  'body' => '[
  {
    "op": "remove",
    "path": "/spec/scopes/{scopeName}/roles/{roleName}"
  }
]',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Remove the named scope/role combination from this team
using RestSharp;

var client = new RestClient("https://app.mk.io/api/v1/organization/teams/team_name");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/spec/scopes/{scopeName}/roles/{roleName}\"\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Remove the named scope/role combination from this team
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  [
    "op": "remove",
    "path": "/spec/scopes/{scopeName}/roles/{roleName}"
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://app.mk.io/api/v1/organization/teams/team_name")! 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()
```

### Remove all access to the named scope from this team

**Request**

```json
[
  {
    "op": "remove",
    "path": "/spec/scopes/{scopeName}"
  }
]
```

**Response**

```json
{
  "metadata": {
    "id": "string",
    "name": "string"
  },
  "spec": {
    "description": "string",
    "members": {
      "user-id": {
        "isTeamAdmin": true
      }
    },
    "scopes": {
      "scopeName": {
        "roles": [
          "roleName",
          "roleName2"
        ]
      }
    }
  },
  "kind": "string"
}
```

**SDK Code**

```python Remove all access to the named scope from this team
import requests

url = "https://app.mk.io/api/v1/organization/teams/team_name"

payload = [
    {
        "op": "remove",
        "path": "/spec/scopes/{scopeName}"
    }
]
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Remove all access to the named scope from this team
const url = 'https://app.mk.io/api/v1/organization/teams/team_name';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '[{"op":"remove","path":"/spec/scopes/{scopeName}"}]'
};

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

```go Remove all access to the named scope from this team
package main

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

func main() {

	url := "https://app.mk.io/api/v1/organization/teams/team_name"

	payload := strings.NewReader("[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/spec/scopes/{scopeName}\"\n  }\n]")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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 Remove all access to the named scope from this team
require 'uri'
require 'net/http'

url = URI("https://app.mk.io/api/v1/organization/teams/team_name")

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/spec/scopes/{scopeName}\"\n  }\n]"

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

```java Remove all access to the named scope from this team
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://app.mk.io/api/v1/organization/teams/team_name")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/spec/scopes/{scopeName}\"\n  }\n]")
  .asString();
```

```php Remove all access to the named scope from this team
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://app.mk.io/api/v1/organization/teams/team_name', [
  'body' => '[
  {
    "op": "remove",
    "path": "/spec/scopes/{scopeName}"
  }
]',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Remove all access to the named scope from this team
using RestSharp;

var client = new RestClient("https://app.mk.io/api/v1/organization/teams/team_name");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {\n    \"op\": \"remove\",\n    \"path\": \"/spec/scopes/{scopeName}\"\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Remove all access to the named scope from this team
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  [
    "op": "remove",
    "path": "/spec/scopes/{scopeName}"
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://app.mk.io/api/v1/organization/teams/team_name")! 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()
```