Tearleads

PUT/principals/{principalType}/{principalId}/policy

Update a principal policy

Operation principals.policy.update

Description

Commits the organization's next signed principal policy and its member envelopes atomically; group policies change through the group policy commit route instead. It requires organization administrator authority, and a stale head returns 409. A 202 asks for the identical request to be retried after preparation, and only a 503 with committed: false and code principal_history_preparation_unavailable proves nothing was written.

Authentication

Requires a signed-in session: the client sends its session token as a bearer token in the Authorization header.

Parameters

NameInTypeDetails
principalTypepathstringrequired
  • one of group, organization
principalIdpathstringrequired
  • lowercase UUID v4

Request body

application/jsonOrganizationPrincipalPolicyRequest

The organization's next signed principal policy state, including its signed directory of group heads.

6 fields
  • containerMutationslist of ContainerMutationRequestoptional
    • at most 0 items

    Container mutations committed atomically with the state.

  • encryptedPayloadobjectrequired
    3 fields
    • cipherSuitestringrequired
      • always aes-256-gcm
    • ciphertextstringrequired
    • ciphertextHashstringrequired

    Other fields are allowed.

  • grantslist of PrincipalContainerGrantRequestrequired
  • memberEnvelopeslist of objectrequired

    The new key epoch's key, encapsulated to each member.

    4 fields
    • kemCipherTextstringrequired
    • memberKeyFingerprintstringrequired
    • userIdstringrequired
      • lowercase UUID v4
    • wrappedKeystringrequired

    Other fields are allowed.

  • projectionlist of objectrequired

    The complete membership with roles after this state.

    2 fields
    • rolestringrequired
      • one of member, admin
    • userIdstringrequired
      • lowercase UUID v4

    Other fields are allowed.

  • stateobjectrequired
    20 fields
    • encapsulationPublicKeystringrequired
    • externalAuthorityobjectrequirednullable
      6 fields
      • keyEpochintegerrequired
        • at least 1
      • keyFingerprintstringrequired
      • principalIdstringrequired
        • lowercase UUID v4
      • principalTypestringrequired
        • always group
      • stateHashstringrequired
      • versionintegerrequired
        • at least 1

      Other fields are allowed.

    • grantCountintegerrequired
      • at least 0
    • grantRootstringrequired
    • keyEpochintegerrequired
      • at least 1
    • keyFingerprintstringrequired
    • memberCountintegerrequired
      • at least 0
    • memberEnvelopesRootstringrequired
    • membershipModestringrequired
      • always projection
    • membershipRootstringrequired
    • payloadCiphertextHashstringrequired
    • prevStateHashstringrequirednullable
    • principalIdstringrequired
      • lowercase UUID v4
    • principalTypestringrequired
      • one of group, organization
    • projectionRootstringrequired
    • signaturestringrequired
    • signedAtstringrequired
      • pattern ^(?:19[7-9]\d|[2-9]\d{3})-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$
    • signerUserIdstringrequired
      • lowercase UUID v4
    • signerUserKeyFingerprintstringrequired
    • versionintegerrequired
      • at least 1

    Other fields are allowed.

Other fields are allowed.

Responses

200 OK

application/jsonPrincipalPolicyMutationResponse

A principal's current policy after a write, with acknowledgements of the container mutations committed with it.

6 fields

Other fields are allowed.

202 The attempted operation rolled back. Retry the identical request to continue verification preparation.

application/jsonPrincipalHistoryPreparationResponse

A 202: the operation rolled back while the server prepares principal history. Retry the identical request.

3 fields
  • codestringrequired
    • always principal_history_preparation_pending
  • committedbooleanrequired
    • always false
  • progressTokenstringrequired
    • exactly 64 characters
    • lowercase hexadecimal

    Changes when preparation advances; clients stop after three identical tokens in a row.

Other responses

StatusMeaningBody
400Bad Request

application/jsonBillingErrorResponse

401Unauthorized

application/jsonSessionFailureResponse

402Payment Required

application/jsonPaymentRequiredErrorResponse

403Forbidden

application/jsonBillingErrorResponse

404Not Found

application/jsonBillingErrorResponse

409Conflict

application/jsonBillingErrorResponse

500Internal Server Error

application/jsonErrorResponse

503Service Unavailable

application/jsonPrincipalHistoryPreparationFailureResponse

Additional rules

The server also enforces these rules, which the schema above cannot express.

  • A container response keyring is null exactly for container key epoch 1.

  • A 503 with code principal_history_preparation_unavailable requires committed:false; other 503 responses do not guarantee rollback.