Publish the caller's own vault directory key (human or agent principal)
Self-only, custody-eligible principals only (human | agent; a ci caller is refused NOT_A_RECIPIENT_PRINCIPAL): publishes the caller's own X25519 public key + ek_ fingerprint to the org-scoped encryption-key directory (vault-human-envelopes, widened by vault-agent-envelopes). The private key never reaches the gateway. custody_scheme: keystore_v1 is the CLI keystore's own key (no wrappers — the keystore file is the custody): the row is created PENDING and the response carries activation (an ECDH possession challenge) — answer it on POST /agent/v1/whoami/encryption-key/activate; a pending key is a recipient nowhere. Republishing the principal's CURRENT key is an idempotent 200 (deduplicated: true). A DIFFERENT key is refused 409 KEY_ROTATION_REQUIRED — rotation is never automatic (a stolen wallet key must not replace a member's decryption identity); remedies: restore the keystore backup, have an org owner revoke the stale key (DELETE /orgs/v1/:org_id/members/:principal_id/encryption-key), or — only for a principal that is the sole custody-eligible member of every org it belongs to — republish with replace_current: true (otherwise 403 KEY_ROTATION_NOT_SELF_AUTHORIZABLE). Credential-gated: SIWX or a control-plane session only — a grant key bearer, CI session, service key, or admin key never reaches this route. The SDK runs this automatically on the first vault operation of a keystore with no published key (run402 repos …, git clone/push); there is no enrollment verb.
Request
- Base URL: https://api.run402.com
- URL: https://api.run402.com/agent/v1/whoami/encryption-key
- Auth: one of:
- API key in header SIGN-IN-WITH-X
- HTTP bearer
Headers
SIWX auth header — base64-encoded JSON payload containing a signed CAIP-122 (EIP-4361) message. See https://docs.x402.org/extensions/sign-in-with-x.
Request body
Response
Key published — state: pending for keystore_v1 (answer activation on /activate) or when wrappers were supplied (activate the first wrapper); active for a legacy direct-PRF publish. A 200 with deduplicated: true means the submitted key already IS the principal's current key (no write).
Changes
No recorded changes to this operation across all 1 revision of this API.