> 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.

# Create or Edit a Team

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

Create a new team with a unique name, or Edit an existing team.

RBAC Capability Required: `core.team.create`

Reference: https://mediakind.ferndocs.com/mkio/api/management/teams/create-or-edit-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 TeamPutSchema.

- `spec` (TeamSpecSchemaCreate, required) — Team specification.

## Response

### 200

Updated

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

### 201

Created

- `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

### TeamSpecSchemaCreate

- `description` (string, optional) — A description of the team.
- `members` (map from string to TeamMemberSchemaCreate, 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.

### 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.

### TeamMemberSchemaCreate

- `isTeamAdmin` (boolean, required) — Does this user have the ability to edit this team

### TeamScopeSchema

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

### 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

## Examples

### Create a new Team with no members or scopes

**Request**

```json
{
  "spec": {
    "description": "A description of the Team",
    "members": {},
    "scopes": {}
  }
}
```

**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 Create a new Team with no members or scopes
import requests

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

payload = { "spec": {
        "description": "A description of the Team",
        "members": {},
        "scopes": {}
    } }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create a new Team with no members or scopes
const url = 'https://app.mk.io/api/v1/organization/teams/team_name';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"spec":{"description":"A description of the Team","members":{},"scopes":{}}}'
};

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

```go Create a new Team with no members or scopes
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  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {},\n    \"scopes\": {}\n  }\n}")

	req, _ := http.NewRequest("PUT", 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 Create a new Team with no members or scopes
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::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {},\n    \"scopes\": {}\n  }\n}"

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

```java Create a new Team with no members or scopes
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://app.mk.io/api/v1/organization/teams/team_name")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {},\n    \"scopes\": {}\n  }\n}")
  .asString();
```

```php Create a new Team with no members or scopes
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://app.mk.io/api/v1/organization/teams/team_name', [
  'body' => '{
  "spec": {
    "description": "A description of the Team",
    "members": {},
    "scopes": {}
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Create a new Team with no members or scopes
using RestSharp;

var client = new RestClient("https://app.mk.io/api/v1/organization/teams/team_name");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {},\n    \"scopes\": {}\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create a new Team with no members or scopes
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["spec": [
    "description": "A description of the Team",
    "members": [],
    "scopes": []
  ]] 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 = "PUT"
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()
```

### Create a new Team with no members or scopes

**Request**

```json
{
  "spec": {
    "description": "A description of the Team",
    "members": {},
    "scopes": {}
  }
}
```

**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 Create a new Team with no members or scopes
import requests

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

payload = { "spec": {
        "description": "A description of the Team",
        "members": {},
        "scopes": {}
    } }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create a new Team with no members or scopes
const url = 'https://app.mk.io/api/v1/organization/teams/team_name';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"spec":{"description":"A description of the Team","members":{},"scopes":{}}}'
};

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

```go Create a new Team with no members or scopes
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  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {},\n    \"scopes\": {}\n  }\n}")

	req, _ := http.NewRequest("PUT", 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 Create a new Team with no members or scopes
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::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {},\n    \"scopes\": {}\n  }\n}"

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

```java Create a new Team with no members or scopes
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://app.mk.io/api/v1/organization/teams/team_name")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {},\n    \"scopes\": {}\n  }\n}")
  .asString();
```

```php Create a new Team with no members or scopes
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://app.mk.io/api/v1/organization/teams/team_name', [
  'body' => '{
  "spec": {
    "description": "A description of the Team",
    "members": {},
    "scopes": {}
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Create a new Team with no members or scopes
using RestSharp;

var client = new RestClient("https://app.mk.io/api/v1/organization/teams/team_name");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {},\n    \"scopes\": {}\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create a new Team with no members or scopes
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["spec": [
    "description": "A description of the Team",
    "members": [],
    "scopes": []
  ]] 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 = "PUT"
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()
```

### Create a new Team

**Request**

```json
{
  "spec": {
    "description": "A description of the Team",
    "members": {
      "{user_id2}": {
        "isTeamAdmin": false
      },
      "{user_id}": {
        "isTeamAdmin": true
      }
    },
    "scopes": {
      "{scope_name}": {
        "roles": [
          "{role_name}",
          "{role_name2}"
        ]
      }
    }
  }
}
```

**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 Create a new Team
import requests

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

payload = { "spec": {
        "description": "A description of the Team",
        "members": {
            "{user_id2}": { "isTeamAdmin": False },
            "{user_id}": { "isTeamAdmin": True }
        },
        "scopes": { "{scope_name}": { "roles": ["{role_name}", "{role_name2}"] } }
    } }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create a new Team
const url = 'https://app.mk.io/api/v1/organization/teams/team_name';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"spec":{"description":"A description of the Team","members":{"{user_id2}":{"isTeamAdmin":false},"{user_id}":{"isTeamAdmin":true}},"scopes":{"{scope_name}":{"roles":["{role_name}","{role_name2}"]}}}}'
};

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

```go Create a new 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  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {\n      \"{user_id2}\": {\n        \"isTeamAdmin\": false\n      },\n      \"{user_id}\": {\n        \"isTeamAdmin\": true\n      }\n    },\n    \"scopes\": {\n      \"{scope_name}\": {\n        \"roles\": [\n          \"{role_name}\",\n          \"{role_name2}\"\n        ]\n      }\n    }\n  }\n}")

	req, _ := http.NewRequest("PUT", 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 Create a new 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::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {\n      \"{user_id2}\": {\n        \"isTeamAdmin\": false\n      },\n      \"{user_id}\": {\n        \"isTeamAdmin\": true\n      }\n    },\n    \"scopes\": {\n      \"{scope_name}\": {\n        \"roles\": [\n          \"{role_name}\",\n          \"{role_name2}\"\n        ]\n      }\n    }\n  }\n}"

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

```java Create a new Team
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://app.mk.io/api/v1/organization/teams/team_name")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {\n      \"{user_id2}\": {\n        \"isTeamAdmin\": false\n      },\n      \"{user_id}\": {\n        \"isTeamAdmin\": true\n      }\n    },\n    \"scopes\": {\n      \"{scope_name}\": {\n        \"roles\": [\n          \"{role_name}\",\n          \"{role_name2}\"\n        ]\n      }\n    }\n  }\n}")
  .asString();
```

```php Create a new Team
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://app.mk.io/api/v1/organization/teams/team_name', [
  'body' => '{
  "spec": {
    "description": "A description of the Team",
    "members": {
      "{user_id2}": {
        "isTeamAdmin": false
      },
      "{user_id}": {
        "isTeamAdmin": true
      }
    },
    "scopes": {
      "{scope_name}": {
        "roles": [
          "{role_name}",
          "{role_name2}"
        ]
      }
    }
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Create a new Team
using RestSharp;

var client = new RestClient("https://app.mk.io/api/v1/organization/teams/team_name");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {\n      \"{user_id2}\": {\n        \"isTeamAdmin\": false\n      },\n      \"{user_id}\": {\n        \"isTeamAdmin\": true\n      }\n    },\n    \"scopes\": {\n      \"{scope_name}\": {\n        \"roles\": [\n          \"{role_name}\",\n          \"{role_name2}\"\n        ]\n      }\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create a new Team
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["spec": [
    "description": "A description of the Team",
    "members": [
      "{user_id2}": ["isTeamAdmin": false],
      "{user_id}": ["isTeamAdmin": true]
    ],
    "scopes": ["{scope_name}": ["roles": ["{role_name}", "{role_name2}"]]]
  ]] 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 = "PUT"
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()
```

### Create a new Team for read access to a Project called "myproject"

**Request**

```json
{
  "spec": {
    "description": "A description of the Team",
    "members": {
      "{user_id}": {
        "isTeamAdmin": false
      }
    },
    "scopes": {
      "myprojectScope": {
        "roles": [
          "reader"
        ]
      }
    }
  }
}
```

**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 Create a new Team for read access to a Project called "myproject"
import requests

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

payload = { "spec": {
        "description": "A description of the Team",
        "members": { "{user_id}": { "isTeamAdmin": False } },
        "scopes": { "myprojectScope": { "roles": ["reader"] } }
    } }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create a new Team for read access to a Project called "myproject"
const url = 'https://app.mk.io/api/v1/organization/teams/team_name';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"spec":{"description":"A description of the Team","members":{"{user_id}":{"isTeamAdmin":false}},"scopes":{"myprojectScope":{"roles":["reader"]}}}}'
};

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

```go Create a new Team for read access to a Project called "myproject"
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  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {\n      \"{user_id}\": {\n        \"isTeamAdmin\": false\n      }\n    },\n    \"scopes\": {\n      \"myprojectScope\": {\n        \"roles\": [\n          \"reader\"\n        ]\n      }\n    }\n  }\n}")

	req, _ := http.NewRequest("PUT", 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 Create a new Team for read access to a Project called "myproject"
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::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {\n      \"{user_id}\": {\n        \"isTeamAdmin\": false\n      }\n    },\n    \"scopes\": {\n      \"myprojectScope\": {\n        \"roles\": [\n          \"reader\"\n        ]\n      }\n    }\n  }\n}"

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

```java Create a new Team for read access to a Project called "myproject"
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://app.mk.io/api/v1/organization/teams/team_name")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {\n      \"{user_id}\": {\n        \"isTeamAdmin\": false\n      }\n    },\n    \"scopes\": {\n      \"myprojectScope\": {\n        \"roles\": [\n          \"reader\"\n        ]\n      }\n    }\n  }\n}")
  .asString();
```

```php Create a new Team for read access to a Project called "myproject"
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://app.mk.io/api/v1/organization/teams/team_name', [
  'body' => '{
  "spec": {
    "description": "A description of the Team",
    "members": {
      "{user_id}": {
        "isTeamAdmin": false
      }
    },
    "scopes": {
      "myprojectScope": {
        "roles": [
          "reader"
        ]
      }
    }
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Create a new Team for read access to a Project called "myproject"
using RestSharp;

var client = new RestClient("https://app.mk.io/api/v1/organization/teams/team_name");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {\n      \"{user_id}\": {\n        \"isTeamAdmin\": false\n      }\n    },\n    \"scopes\": {\n      \"myprojectScope\": {\n        \"roles\": [\n          \"reader\"\n        ]\n      }\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create a new Team for read access to a Project called "myproject"
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["spec": [
    "description": "A description of the Team",
    "members": ["{user_id}": ["isTeamAdmin": false]],
    "scopes": ["myprojectScope": ["roles": ["reader"]]]
  ]] 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 = "PUT"
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()
```

### Create a new Team all Project access and generic management read capabilities for the Organization

**Request**

```json
{
  "spec": {
    "description": "A description of the Team",
    "members": {
      "{user_id}": {
        "isTeamAdmin": true
      }
    },
    "scopes": {
      "allProjectsScope": {
        "roles": [
          "user"
        ]
      },
      "managementScope": {
        "roles": [
          "managementReader"
        ]
      }
    }
  }
}
```

**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 Create a new Team all Project access and generic management read capabilities for the Organization
import requests

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

payload = { "spec": {
        "description": "A description of the Team",
        "members": { "{user_id}": { "isTeamAdmin": True } },
        "scopes": {
            "allProjectsScope": { "roles": ["user"] },
            "managementScope": { "roles": ["managementReader"] }
        }
    } }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Create a new Team all Project access and generic management read capabilities for the Organization
const url = 'https://app.mk.io/api/v1/organization/teams/team_name';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"spec":{"description":"A description of the Team","members":{"{user_id}":{"isTeamAdmin":true}},"scopes":{"allProjectsScope":{"roles":["user"]},"managementScope":{"roles":["managementReader"]}}}}'
};

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

```go Create a new Team all Project access and generic management read capabilities for the Organization
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  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {\n      \"{user_id}\": {\n        \"isTeamAdmin\": true\n      }\n    },\n    \"scopes\": {\n      \"allProjectsScope\": {\n        \"roles\": [\n          \"user\"\n        ]\n      },\n      \"managementScope\": {\n        \"roles\": [\n          \"managementReader\"\n        ]\n      }\n    }\n  }\n}")

	req, _ := http.NewRequest("PUT", 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 Create a new Team all Project access and generic management read capabilities for the Organization
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::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {\n      \"{user_id}\": {\n        \"isTeamAdmin\": true\n      }\n    },\n    \"scopes\": {\n      \"allProjectsScope\": {\n        \"roles\": [\n          \"user\"\n        ]\n      },\n      \"managementScope\": {\n        \"roles\": [\n          \"managementReader\"\n        ]\n      }\n    }\n  }\n}"

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

```java Create a new Team all Project access and generic management read capabilities for the Organization
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://app.mk.io/api/v1/organization/teams/team_name")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {\n      \"{user_id}\": {\n        \"isTeamAdmin\": true\n      }\n    },\n    \"scopes\": {\n      \"allProjectsScope\": {\n        \"roles\": [\n          \"user\"\n        ]\n      },\n      \"managementScope\": {\n        \"roles\": [\n          \"managementReader\"\n        ]\n      }\n    }\n  }\n}")
  .asString();
```

```php Create a new Team all Project access and generic management read capabilities for the Organization
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://app.mk.io/api/v1/organization/teams/team_name', [
  'body' => '{
  "spec": {
    "description": "A description of the Team",
    "members": {
      "{user_id}": {
        "isTeamAdmin": true
      }
    },
    "scopes": {
      "allProjectsScope": {
        "roles": [
          "user"
        ]
      },
      "managementScope": {
        "roles": [
          "managementReader"
        ]
      }
    }
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Create a new Team all Project access and generic management read capabilities for the Organization
using RestSharp;

var client = new RestClient("https://app.mk.io/api/v1/organization/teams/team_name");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"spec\": {\n    \"description\": \"A description of the Team\",\n    \"members\": {\n      \"{user_id}\": {\n        \"isTeamAdmin\": true\n      }\n    },\n    \"scopes\": {\n      \"allProjectsScope\": {\n        \"roles\": [\n          \"user\"\n        ]\n      },\n      \"managementScope\": {\n        \"roles\": [\n          \"managementReader\"\n        ]\n      }\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create a new Team all Project access and generic management read capabilities for the Organization
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["spec": [
    "description": "A description of the Team",
    "members": ["{user_id}": ["isTeamAdmin": true]],
    "scopes": [
      "allProjectsScope": ["roles": ["user"]],
      "managementScope": ["roles": ["managementReader"]]
    ]
  ]] 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 = "PUT"
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()
```