Complete a project claim
Completes a claim by attaching the project to the signed-in developer's personal team.
A claim attaches a project to a team,
so that the team's members administer it. The claim page in the browser
calls this operation after the developer signs in, with the session cookie.
The challenge_id from the claim URL that createProjectClaim (POST /projects/{project_id}/claim/init) returns is the
request's single-use, browser-safe authorization.
Claims are first-claim-wins and spend the challenge. If a team already
claimed the project, the request answers 409. If the challenge lapsed
(410 with proj.claim_expired), call createProjectClaim again for a fresh one.
sessionCookie__Host-zitadel_session<token>The session cookie issued at session creation or superseding handoff exchange.
A browser holds it as __Host-zitadel_session, with Secure. Over plain
http to a loopback host (localhost, 127.0.0.1, ::1) the server sets it
as zitadel_session instead, without Secure or the prefix, so that Safari
keeps it, and accepts that name there too; __Host-zitadel_session takes
precedence. A program sends __Host-zitadel_session over any transport.
A missing or invalid cookie yields 401 with code auth.unauthorized and the message
Missing or invalid session token.
Cross-site request forgery (CSRF) protection: a state-changing request that
this cookie authenticates must come from the same origin. A cross-site
browser request is refused with 403 and code auth.csrf_invalid. Every
such request must also send the session's token from GET /sessions/me/csrf
in the X-Zitadel-CSRF header, or it answers the same 403. The only
exceptions are the POST …/query reads and POST /invitations/lookup,
which need no token. Safe methods (GET) are not checked. A request a
project secret authenticates is not affected.
project_id*stringThe project ID: the id that createProject (POST /projects) returns, which zitadel setup
also prints as project_id.
^[a-zA-Z0-9_-]+$application/json- body
The request to complete a project claim.
challenge_id*challenge-idThe unique identifier of this challenge, an opaque string with a ch_ prefix.
^ch_[a-zA-Z0-9_-]+$The claimed project and its owning team.
application/json- response
The result of a completed project claim.
project_id*project-id^[a-zA-Z0-9_-]+$team_id*team-id^[a-zA-Z0-9_-]+$claimed_at*stringThe time when the project was claimed.
date-timeimport { configureZitadel, getApi } from "@zitadel/api/config";import { setApiCsrfToken } from "@zitadel/api/runtime/auth";// In the browser, through the SDK proxy: the session cookie authenticates the call.const client = getApi(configureZitadel({ projectId: "proj_01KWH1P4MYS7F0N9WD3P2E4YM5" }));// A write the session cookie authenticates carries the session's CSRF token.setApiCsrfToken((await client.getMySessionCsrfToken()).csrf_token);const projectClaim = await client.completeProjectClaim( "proj_01KWH1P4MYS7F0N9WD3P2E4YM5", { challenge_id: "string" },);{ "project_id": "string", "team_id": "string", "claimed_at": "2019-08-24T14:15:22Z"}Was this helpful?