Create a team
Creates a team in the project, with a name no other team in the project has.
A team groups users inside a project and can represent a customer. A taken
name is refused with 409 team.already_exists: choose another name. The
new team has no members yet.
AuthorizationBearer <token>Scope: team.write
project_id*stringThe project ID: the id that createProject (POST /projects) returns. zitadel setup prints
it as "Project id" in its summary and as project_id with --json, and
writes it to .env.local as ZITADEL_PROJECT_ID.
^[a-zA-Z0-9_-]+$application/json- body
name*stringThe name of the team. Must be unique within the project, ignoring case.
1 <= length <= 200The created team.
application/json- response
Details of a team.
id*stringThe unique identifier of the team.
name*stringThe name of the team.
status*team-statusThe lifecycle state of a team.
active: the team is available for use.deactivated: the team is no longer active but is retained for historical and audit purposes.
"active""deactivated"created_at*stringThe time when the team was created.
date-timeupdated_at*stringThe time when the team was last updated.
date-timeimport { createZitadelApi } from "@zitadel/api/client";import { configureZitadel, getApi } from "@zitadel/api/config";// In the browser, through the SDK proxy: the session cookie authenticates the call.const session = getApi(configureZitadel({ projectId: "proj_01KWH1P4MYS7F0N9WD3P2E4YM5" }));// A write the session cookie authenticates carries the session's CSRF token.const { csrf_token } = await session.getMySessionCsrfToken();const api = createZitadelApi( session.client.with({ fetch: (input, init) => { const headers = new Headers(init?.headers); headers.set("X-Zitadel-CSRF", csrf_token); return fetch(input, { ...init, headers }); }, }),);const team = await api.createTeam({ name: "string" }, { project_id: "proj_01KWH1P4MYS7F0N9WD3P2E4YM5" });{ "id": "string", "name": "string", "status": "active", "created_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z"}Was this helpful?