Skip to content

Claim project authority for a deployment

A project credential (scpj_…) is bound to exactly one project and to the deployment that issued it. Every request with such a credential is checked against one persisted row, the deployment claim: its deployment id, environment and issuer must equal the server’s own runtime identity, and its gate project_authority_enabled must be on. Nothing creates that row automatically. Until an operator claims the deployment, minting a project credential is refused with project_deployment_claim_missing, and an existing one resolves to nothing.

The claim is deliberately separate from a release: a fleet with an old server that does not know the project contract must not mint or accept project credentials. Claim and enable only after every server node runs a release that speaks it.

  • An instance-admin session or the deployment operator token (Authorization: Bearer …, resolved from your secret store at use time, never pasted into a shell history).
  • All server nodes run a release with the project-authority contract (migrations 698–704 applied).
  • SUPACLOUD_DEPLOYMENT_ID, SUPACLOUD_DEPLOYMENT_ENVIRONMENT and PUBLIC_URL set on every node, identical across the fleet.
  1. Read the current state.

    Terminal window
    curl -sS -H "Authorization: Bearer $OPERATOR_TOKEN" \
    "$SC_BASE/api/operator/v1/project-authority"

    The answer names the runtime identity of the node that answered (runtime), the persisted claim (claim, null before the first claim), whether they match (claim_matches_runtime) and the gate (project_authority_enabled). A runtime_refusal such as project_deployment_claim_missing means the node’s configuration lacks the deployment id.

  2. Claim the deployment with the gate closed. Every claim carries a reason; it is written to the audit log (project_authority.deployment_claim).

    Terminal window
    curl -sS -X PUT -H "Authorization: Bearer $OPERATOR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"enabled": false, "reason": "claim stage for project credentials"}' \
    "$SC_BASE/api/operator/v1/project-authority"

    Repeat step 1 against more than one node: every node must report claim_matches_runtime: true.

  3. Open the gate.

    Terminal window
    curl -sS -X PUT -H "Authorization: Bearer $OPERATOR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"enabled": true, "reason": "every node runs the project contract"}' \
    "$SC_BASE/api/operator/v1/project-authority"

    Workspace owners and admins can now mint project credentials under Settings → Credentials → API tokens, and the Management API can mint them with POST /api/management/v1/workspaces/{slug}/projects/{project_id}/api-tokens.

The claim gates narrowed credentials only. Everything workspace roles already authorize keeps working before any claim:

  • First-party launches work without a claim. A task started from the web, chat, a schedule, a workflow, backlog dispatch or an agent’s own subtask launches locally or on a runner, because its authority is the launching member’s workspace role, which is checked again at launch.
  • Project credentials and the tasks they create need the claim. Minting or using an scpj_ credential is refused with project_deployment_claim_missing, and so is the launch of a task that a management or project token created.
  • A claim that exists must match the runtime. Once a claim row is present, every project-bound launch, first-party ones included, compares it with this node’s runtime identity and is refused with project_audience_mismatch when they differ. A database copied from another environment therefore fails closed instead of running work under the other environment’s claim.

Send the same PUT with "enabled": false. From the next request on, every project credential is refused with project_authority_disabled and no new one can be minted. The credentials themselves stay stored; opening the gate again makes the unexpired, unrevoked ones usable again.

  • It never repoints. A claim that names another deployment, environment or issuer is refused with 409. Issued credentials reference the claimed (deployment_id, issuer) pair, so a database copied from Stage into Production keeps its Stage claim and every Stage credential stays unusable on Production.
  • It never takes an identity from the request. The body carries only enabled and reason; any other field is refused.
  • It is not a deploy step. Claiming or opening the gate is an operator decision for one environment; a green pipeline or a merged change does not do it.