API and MCP

Teams

The teams of an organization: who is on each, which roles it grants and which projects it reaches

List teams

GET /api/v1/org/{orgId}/team

Credentials: API token or dashboard sign-in.

Every team in the organization, including the built-in ones. Each entry carries the team's name, whether it reaches all projects, its member count, its project count (absent when it reaches all projects) and the names of the roles it grants. Requires org:manage_teams.

Parameters

Name In Type Description
orgId required path string (uuid) The organization's id.

Responses

Status Description Body
200 The organization's teams. TeamList
401 The token is missing, expired, revoked or of the wrong kind. Error
403 You do not hold org:manage_teams in this organization. Error
500 A fault on our side. Error

Example

curl -X GET "https://api.spicelabs.io/api/v1/org/<orgId>/team" \
  -H "Authorization: Bearer $SPICE_API_TOKEN"

Create a team

POST /api/v1/org/{orgId}/team

Credentials: API token or dashboard sign-in.

Creates a team in the organization with the name you give, unique within the organization. Set allProjects to let it reach every project, or list the projects it reaches in projectIds; you cannot do both. roleIds names the roles it grants, which may be built-in roles or this organization's own. Requires org:manage_teams.

Parameters

Name In Type Description
orgId required path string (uuid) The organization's id.

Request body

application/json (required)

CreateTeam

Responses

Status Description Body
201 The new team with its members, projects and roles. Team
400 The name is blank or already taken, both allProjects and projectIds are set, or a role or project in the request does not exist in this organization. Error
401 The token is missing, expired, revoked or of the wrong kind. Error
403 The token is valid but not allowed to do this. Error
500 A fault on our side. Error

Example

curl -X POST "https://api.spicelabs.io/api/v1/org/<orgId>/team" \
  -H "Authorization: Bearer $SPICE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '<JSON body>'

Get a team

GET /api/v1/org/{orgId}/team/{teamId}

Credentials: API token or dashboard sign-in.

One team in full: its name, whether it reaches all projects, whether it is built in, its members, the projects it reaches and the roles it grants with each role's permissions. Requires org:manage_teams.

Parameters

Name In Type Description
orgId required path string (uuid) The organization's id.
teamId required path string (uuid)

Responses

Status Description Body
200 The team with its members, projects and roles. Team
401 The token is missing, expired, revoked or of the wrong kind. Error
403 The token is valid but not allowed to do this. Error
404 No team with this id exists in this organization. Error
500 A fault on our side. Error

Example

curl -X GET "https://api.spicelabs.io/api/v1/org/<orgId>/team/<teamId>" \
  -H "Authorization: Bearer $SPICE_API_TOKEN"

Update a team

PUT /api/v1/org/{orgId}/team/{teamId}

Credentials: API token or dashboard sign-in.

Renames a team or changes whether it reaches all projects. Both fields are optional; a field you leave out is unchanged. Turning allProjects on drops the team's individual project assignments. Built-in teams cannot be changed. Requires org:manage_teams.

Parameters

Name In Type Description
orgId required path string (uuid) The organization's id.
teamId required path string (uuid)

Request body

application/json (required)

UpdateTeam

Responses

Status Description Body
200 The updated team with its members, projects and roles. Team
400 The team is built in, or the new name is already taken in this organization. Error
401 The token is missing, expired, revoked or of the wrong kind. Error
403 The token is valid but not allowed to do this. Error
404 No team with this id exists in this organization. Error
500 A fault on our side. Error

Example

curl -X PUT "https://api.spicelabs.io/api/v1/org/<orgId>/team/<teamId>" \
  -H "Authorization: Bearer $SPICE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '<JSON body>'

Delete a team

DELETE /api/v1/org/{orgId}/team/{teamId}

What it changes: Everyone on the team loses the projects and roles it gave them.

Credentials: API token or dashboard sign-in.

Deletes a team. Its memberships and its role and project assignments go with it, at once, and cannot be restored. The users themselves stay in the organization. Built-in teams cannot be deleted. Requires org:manage_teams.

Parameters

Name In Type Description
orgId required path string (uuid) The organization's id.
teamId required path string (uuid)

Responses

Status Description Body
204 The team is deleted.
400 The team is built in and cannot be deleted. Error
401 The token is missing, expired, revoked or of the wrong kind. Error
403 The token is valid but not allowed to do this. Error
404 No team with this id exists in this organization. Error
500 A fault on our side. Error

Example

curl -X DELETE "https://api.spicelabs.io/api/v1/org/<orgId>/team/<teamId>" \
  -H "Authorization: Bearer $SPICE_API_TOKEN"

Add projects to a team

POST /api/v1/org/{orgId}/team/{teamId}/project

Credentials: API token or dashboard sign-in.

Adds the projects in projectIds to the ones a team already reaches. Projects the team already has are skipped, not rejected. Every project must belong to this organization. Not allowed on a team that reaches all projects. Requires org:manage_teams.

Parameters

Name In Type Description
orgId required path string (uuid) The organization's id.
teamId required path string (uuid)

Request body

application/json (required)

SetTeamProjects

Responses

Status Description Body
200 The team with its members, projects and roles. Team
400 The team reaches all projects, projectIds is missing, or a project in the list does not exist in this organization. Error
401 The token is missing, expired, revoked or of the wrong kind. Error
403 The token is valid but not allowed to do this. Error
404 No team with this id exists in this organization. Error
500 A fault on our side. Error

Example

curl -X POST "https://api.spicelabs.io/api/v1/org/<orgId>/team/<teamId>/project" \
  -H "Authorization: Bearer $SPICE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '<JSON body>'

Replace a team's projects

PUT /api/v1/org/{orgId}/team/{teamId}/project

What it changes: Projects left out of the list stop being reachable through this team.

Credentials: API token or dashboard sign-in.

Replaces the whole set of projects a team reaches with the projects in projectIds. Projects not in the list are removed; an empty list leaves the team with no projects. Every project must belong to this organization. Not allowed on a team that reaches all projects; turn allProjects off first. Requires org:manage_teams.

Parameters

Name In Type Description
orgId required path string (uuid) The organization's id.
teamId required path string (uuid)

Request body

application/json (required)

SetTeamProjects

Responses

Status Description Body
200 The team with its members, new projects and roles. Team
400 The team reaches all projects, projectIds is missing, or a project in the list does not exist in this organization. Error
401 The token is missing, expired, revoked or of the wrong kind. Error
403 The token is valid but not allowed to do this. Error
404 No team with this id exists in this organization. Error
500 A fault on our side. Error

Example

curl -X PUT "https://api.spicelabs.io/api/v1/org/<orgId>/team/<teamId>/project" \
  -H "Authorization: Bearer $SPICE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '<JSON body>'

Remove a project from a team

DELETE /api/v1/org/{orgId}/team/{teamId}/project/{projectId}

What it changes: The team's members lose access to this project through this team.

Credentials: API token or dashboard sign-in.

Takes one project out of the set a team reaches. The project itself is untouched. Not allowed on a team that reaches all projects. Requires org:manage_teams.

Parameters

Name In Type Description
orgId required path string (uuid) The organization's id.
teamId required path string (uuid)
projectId required path string (uuid)

Responses

Status Description Body
204 The team no longer reaches the project.
400 The team reaches all projects, or the project is not assigned to this team. Error
401 The token is missing, expired, revoked or of the wrong kind. Error
403 Your token was issued for a project, and projectId in the path is a different one. Error
404 No team with this id exists in this organization, or no project with this id exists. Error
500 A fault on our side. Error

Example

curl -X DELETE "https://api.spicelabs.io/api/v1/org/<orgId>/team/<teamId>/project/<projectId>" \
  -H "Authorization: Bearer $SPICE_API_TOKEN"

Add roles to a team

POST /api/v1/org/{orgId}/team/{teamId}/role

Credentials: API token or dashboard sign-in.

Adds the roles in roleIds to the ones a team already grants. Roles the team already has are skipped, not rejected. Each role must be a built-in role or one of this organization's own. The roles of a built-in team cannot be changed. Requires org:manage_teams.

Parameters

Name In Type Description
orgId required path string (uuid) The organization's id.
teamId required path string (uuid)

Request body

application/json (required)

SetTeamRoles

Responses

Status Description Body
200 The team with its members, projects and roles. Team
400 The team is built in, roleIds is missing, or a role in the list does not exist or is not available to this organization. Error
401 The token is missing, expired, revoked or of the wrong kind. Error
403 The token is valid but not allowed to do this. Error
404 No team with this id exists in this organization. Error
500 A fault on our side. Error

Example

curl -X POST "https://api.spicelabs.io/api/v1/org/<orgId>/team/<teamId>/role" \
  -H "Authorization: Bearer $SPICE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '<JSON body>'

Replace a team's roles

PUT /api/v1/org/{orgId}/team/{teamId}/role

What it changes: Roles left out of the list are taken from every member of the team.

Credentials: API token or dashboard sign-in.

Replaces the whole set of roles a team grants with the roles in roleIds. Roles not in the list are removed; an empty list leaves the team with no roles. Each role must be a built-in role or one of this organization's own. The roles of a built-in team cannot be changed. Requires org:manage_teams.

Parameters

Name In Type Description
orgId required path string (uuid) The organization's id.
teamId required path string (uuid)

Request body

application/json (required)

SetTeamRoles

Responses

Status Description Body
200 The team with its members, projects and new roles. Team
400 The team is built in, roleIds is missing, or a role in the list does not exist or is not available to this organization. Error
401 The token is missing, expired, revoked or of the wrong kind. Error
403 The token is valid but not allowed to do this. Error
404 No team with this id exists in this organization. Error
500 A fault on our side. Error

Example

curl -X PUT "https://api.spicelabs.io/api/v1/org/<orgId>/team/<teamId>/role" \
  -H "Authorization: Bearer $SPICE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '<JSON body>'

List team members

GET /api/v1/org/{orgId}/team/{teamId}/user

Credentials: API token or dashboard sign-in.

The users on a team, each with their id, email and name. Requires org:manage_teams.

Parameters

Name In Type Description
orgId required path string (uuid) The organization's id.
teamId required path string (uuid)

Responses

Status Description Body
200 The team's members. TeamMemberList
401 The token is missing, expired, revoked or of the wrong kind. Error
403 The token is valid but not allowed to do this. Error
404 No team with this id exists in this organization. Error
500 A fault on our side. Error

Example

curl -X GET "https://api.spicelabs.io/api/v1/org/<orgId>/team/<teamId>/user" \
  -H "Authorization: Bearer $SPICE_API_TOKEN"

Add a member to a team

POST /api/v1/org/{orgId}/team/{teamId}/user

Credentials: API token or dashboard sign-in.

Adds the user named by userId to a team. The user must already belong to the organization. The addition is recorded in the organization's activity log. Requires org:manage_teams.

Parameters

Name In Type Description
orgId required path string (uuid) The organization's id.
teamId required path string (uuid)

Request body

application/json (required)

AddTeamMember

Responses

Status Description Body
201 The added member: id, email and name. TeamMember
400 The user is already on this team, or userId is blank. Error
401 The token is missing, expired, revoked or of the wrong kind. Error
403 The token is valid but not allowed to do this. Error
404 No team with this id exists in this organization, or no user with userId belongs to it. Error
500 A fault on our side. Error

Example

curl -X POST "https://api.spicelabs.io/api/v1/org/<orgId>/team/<teamId>/user" \
  -H "Authorization: Bearer $SPICE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '<JSON body>'

Remove a member from a team

DELETE /api/v1/org/{orgId}/team/{teamId}/user/{userId}

What it changes: This person loses the projects and roles this team gave them.

Credentials: API token or dashboard sign-in.

Takes a user off a team. The user stays in the organization and on their other teams. The removal is recorded in the organization's activity log. Requires org:manage_teams.

Parameters

Name In Type Description
orgId required path string (uuid) The organization's id.
teamId required path string (uuid)
userId required path string (uuid)

Responses

Status Description Body
204 The user is no longer on the team.
400 The user is not on this team. Error
401 The token is missing, expired, revoked or of the wrong kind. Error
403 The token is valid but not allowed to do this. Error
404 No team with this id exists in this organization, or no user with this id belongs to it. Error
500 A fault on our side. Error

Example

curl -X DELETE "https://api.spicelabs.io/api/v1/org/<orgId>/team/<teamId>/user/<userId>" \
  -H "Authorization: Bearer $SPICE_API_TOKEN"

List a user's teams

GET /api/v1/org/{orgId}/user/{userId}/team

Credentials: API token or dashboard sign-in.

The teams in this organization that a user is on, in the same shape as the team list. Requires org:manage_teams.

Parameters

Name In Type Description
orgId required path string (uuid) The organization's id.
userId required path string (uuid)

Responses

Status Description Body
200 The user's teams in this organization. UserTeams
401 The token is missing, expired, revoked or of the wrong kind. Error
403 The token is valid but not allowed to do this. Error
404 No user with this id belongs to this organization. Error
500 A fault on our side. Error

Example

curl -X GET "https://api.spicelabs.io/api/v1/org/<orgId>/user/<userId>/team" \
  -H "Authorization: Bearer $SPICE_API_TOKEN"