x_auth_upsert_principal_credentials
Store or rotate OAuth2 or OAuth1 access credentials for a tenant user or account, enabling API operations that require principal-scoped tokens.
Instructions
Store or rotate tenant/user or tenant/account X user credentials. Use when: an operation needs an OAuth2 user token or OAuth1 access token pair under a multi-tenant principal scope. Do not use when: you only need tenant-wide bearer or OAuth1 consumer credentials; use x_auth_upsert_app_credentials. Risk: mutating, high-risk. Required permissions and prerequisites: tenantId plus exactly one of userId or accountId; supply OAuth2 access token and optional refresh token, and/or OAuth1 access token + secret. Environment-selection behavior: writes secrets to Vault at the selected principal path and stores redacted metadata in the matching Postgres scope. Expected response shape: { ok, status, data: { tenantId, principalType, principalId, profileKey, authTypesAvailable, secretPath, updatedAt } } Common failure conditions: missing principal scope, invalid expiresAt value, Vault write failures, or Postgres write failures. Safety warnings: replacing a default principal profile changes which user/account identity every generated endpoint tool will use for that scope. Example: {"tenantId":"acme","userId":"ops-bot","oauth2AccessToken":"...","oauth2Scopes":["tweet.read","users.read"],"makeDefault":true,"authorizationKey":""}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| label | No | ||
| notes | No | ||
| userId | No | ||
| xUserId | No | ||
| tenantId | Yes | ||
| username | No | ||
| accountId | No | ||
| expiresAt | No | ||
| profileKey | No | ||
| makeDefault | No | ||
| oauth2Scopes | No | ||
| authorizationKey | No | ||
| oauth1AccessToken | No | ||
| oauth2AccessToken | No | ||
| oauth1AccessSecret | No | ||
| oauth2RefreshToken | No |