Store a new upstream credential
const url = 'https://example.com/v1/credentials';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","auth_type":"bearer","source":"managed","plaintext":"example","vault_ref":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/credentials \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "auth_type": "bearer", "source": "managed", "plaintext": "example", "vault_ref": "example" }'plaintext (source=managed) is envelope-encrypted before any persistence and never appears in any response (invariant #4).
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Required when source=managed. Envelope-encrypted before persistence; never returned.
Required when source=vault. Opaque path in the external secrets store.
Responses
Section titled “Responses”Credential created.
object
The cred_<uuidv7> resource ID.
Present only for source=managed — a redacted hint of the secret, never the secret itself.
Present only for source=vault.
Incremented on each rotation.
Example
{ "auth_type": "bearer", "source": "managed"}Invalid body, missing name/auth_type, or a source/plaintext/vault_ref mismatch.
The uniform error body for all 4xx responses that carry one.
object
A coarse, caller-safe message. Never contains internal state (invariant
Examplegenerated
{ "error": "example"}Missing or invalid bearer token, or the token’s tenant/user claims are absent. No body.
A credential with this name already exists in the tenant.
The uniform error body for all 4xx responses that carry one.
object
A coarse, caller-safe message. Never contains internal state (invariant
Examplegenerated
{ "error": "example"}An unexpected server-side error. No body (internal detail is never returned to callers, invariant