# Source: https://gitbook.com/docs/developers/gitbook-api/api-reference/spaces/space-teams.md

# Space teams

Assign entire teams to your spaces and streamline the process of granting or revoking access at scale, without dealing with individual user roles.

## DELETE /spaces/{spaceId}/permissions/teams/{teamId}

> Remove a space team

```json
{"openapi":"3.0.3","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"space-teams","description":"Assign entire teams to your spaces and streamline the process of granting or revoking access at scale, without dealing with individual user roles.\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user":[]}],"components":{"securitySchemes":{"user":{"type":"http","scheme":"bearer"}},"parameters":{"spaceId":{"name":"spaceId","in":"path","required":true,"description":"The unique id of the space","schema":{"type":"string"}},"teamId":{"name":"teamId","in":"path","required":true,"description":"The unique ID of the Team","schema":{"type":"string"}}},"responses":{"BadRequestError":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","enum":[400]},"message":{"type":"string"}},"required":["code","message"]}}}}}}}},"paths":{"/spaces/{spaceId}/permissions/teams/{teamId}":{"delete":{"operationId":"removeTeamFromSpace","summary":"Remove a space team","tags":["space-teams"],"parameters":[{"$ref":"#/components/parameters/spaceId"},{"$ref":"#/components/parameters/teamId"}],"responses":{"204":{"description":"The team was not found in the space"},"205":{"description":"The team has been removed from the space"},"400":{"description":"Team does not have access to space","$ref":"#/components/responses/BadRequestError"}}}}}}
```

## PATCH /spaces/{spaceId}/permissions/teams/{teamId}

> Update a space team permission

```json
{"openapi":"3.0.3","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"space-teams","description":"Assign entire teams to your spaces and streamline the process of granting or revoking access at scale, without dealing with individual user roles.\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user":[]}],"components":{"securitySchemes":{"user":{"type":"http","scheme":"bearer"}},"parameters":{"spaceId":{"name":"spaceId","in":"path","required":true,"description":"The unique id of the space","schema":{"type":"string"}},"teamId":{"name":"teamId","in":"path","required":true,"description":"The unique ID of the Team","schema":{"type":"string"}}},"schemas":{"MemberRoleOrGuest":{"description":"The role of a member in an organization, null for guests","oneOf":[{"$ref":"#/components/schemas/MemberRole"},{"type":"string","nullable":true,"enum":[null]}]},"MemberRole":{"type":"string","description":"\"The role of a member in an organization.\n\"admin\": Can administrate the content: create, delete spaces, ...\n\"create\": Can create content.\n\"review\": Can review content.\n\"edit\": Can edit the content (live or change requests).\n\"comment\": Can access the content and its discussions.\n\"read\": Can access the content, but cannot update it in any way.\n","enum":["admin","create","edit","review","comment","read"]}},"responses":{"NotFoundError":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","enum":[404]},"message":{"type":"string"}},"required":["code","message"]}}}}}}}},"paths":{"/spaces/{spaceId}/permissions/teams/{teamId}":{"patch":{"operationId":"updateTeamPermissionInSpace","summary":"Update a space team permission","tags":["space-teams"],"parameters":[{"$ref":"#/components/parameters/spaceId"},{"$ref":"#/components/parameters/teamId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"$ref":"#/components/schemas/MemberRoleOrGuest"}}}}}},"responses":{"204":{"description":"Team permission was updated"},"404":{"description":"No team found with the given ID","$ref":"#/components/responses/NotFoundError"}}}}}}
```

## GET /spaces/{spaceId}/permissions/teams

> List space team persmissions

```json
{"openapi":"3.0.3","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"space-teams","description":"Assign entire teams to your spaces and streamline the process of granting or revoking access at scale, without dealing with individual user roles.\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user":[]}],"components":{"securitySchemes":{"user":{"type":"http","scheme":"bearer"}},"parameters":{"spaceId":{"name":"spaceId","in":"path","required":true,"description":"The unique id of the space","schema":{"type":"string"}},"listPage":{"name":"page","in":"query","description":"Identifier of the page results to fetch.","schema":{"type":"string"}},"listLimit":{"name":"limit","in":"query","description":"The number of results per page","schema":{"type":"number","minimum":0,"maximum":1000}}},"schemas":{"List":{"type":"object","properties":{"next":{"type":"object","properties":{"page":{"type":"string","description":"Unique identifier to query the next results page"}},"required":["page"]},"count":{"type":"number","description":"Total count of objects in the list"}}},"MemberRole":{"type":"string","description":"\"The role of a member in an organization.\n\"admin\": Can administrate the content: create, delete spaces, ...\n\"create\": Can create content.\n\"review\": Can review content.\n\"edit\": Can edit the content (live or change requests).\n\"comment\": Can access the content and its discussions.\n\"read\": Can access the content, but cannot update it in any way.\n","enum":["admin","create","edit","review","comment","read"]},"OrganizationTeam":{"type":"object","properties":{"object":{"type":"string","description":"Type of Object, always equals to \"team\"","enum":["team"]},"id":{"type":"string","description":"Unique identifier for the team."},"title":{"$ref":"#/components/schemas/OrganizationTeamTitle"},"members":{"type":"integer","description":"Count of members in this team."},"spaces":{"type":"number","description":"Count of spaces this team has access to."},"createdAt":{"description":"Date at which the team was created.","$ref":"#/components/schemas/Timestamp"},"permissions":{"type":"object","description":"The set of permissions for the team","properties":{"admin":{"type":"boolean","description":"Can the user manage the team"},"view":{"type":"boolean","description":"Can the user view the team and list its members"}},"required":["admin","view"]}},"required":["object","id","title","members","spaces","createdAt","permissions"]},"OrganizationTeamTitle":{"type":"string","description":"Title of the team","minLength":1,"maxLength":64},"Timestamp":{"type":"string","format":"date-time"}},"responses":{"NotFoundError":{"description":"Not Found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"code":{"type":"integer","format":"int32","enum":[404]},"message":{"type":"string"}},"required":["code","message"]}}}}}}}},"paths":{"/spaces/{spaceId}/permissions/teams":{"get":{"operationId":"listTeamPermissionsInSpace","summary":"List space team persmissions","tags":["space-teams"],"parameters":[{"$ref":"#/components/parameters/spaceId"},{"$ref":"#/components/parameters/listPage"},{"$ref":"#/components/parameters/listLimit"}],"responses":{"200":{"description":"Listing of teams who have been added to a space.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/List"},{"type":"object","required":["items"],"properties":{"items":{"type":"array","items":{"type":"object","description":"Permission of a team in a space.","properties":{"permission":{"$ref":"#/components/schemas/MemberRole"},"team":{"$ref":"#/components/schemas/OrganizationTeam"}},"required":["permission","team"]}}}}]}}}},"404":{"description":"No space was found with the given Id","$ref":"#/components/responses/NotFoundError"}}}}}}
```