Docs

Complete a project claim

POST
/projects/{project_id}/claim/complete

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.

Authorization

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

Path Parameters

project_id*string

The project ID: the id that createProject (POST /projects) returns, which zitadel setup also prints as project_id.

Match^[a-zA-Z0-9_-]+$

Request Body

application/json
  1. body

The request to complete a project claim.

challenge_id*challenge-id

The unique identifier of this challenge, an opaque string with a ch_ prefix.

Match^ch_[a-zA-Z0-9_-]+$

Response Body

The claimed project and its owning team.

application/json
  1. response

The result of a completed project claim.

project_id*project-id
Match^[a-zA-Z0-9_-]+$
team_id*team-id
Match^[a-zA-Z0-9_-]+$
claimed_at*string

The time when the project was claimed.

Formatdate-time
Example Request
import { 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" },);
Example Response
{  "project_id": "string",  "team_id": "string",  "claimed_at": "2019-08-24T14:15:22Z"}

Was this helpful?