Create Credential
Store a new secret for an organisation.
The organisation is resolved - and its membership checked - before
anything is written: credential_provider.create commits, so a
rejection discovered afterwards would strand a row holding live secret
material that nothing ever collects.
Accepts the secret in the engine's own payload shape or as a credential
form document, converted here through the same read_document every
other credential write path uses. A document says more than its secret:
its header names where the secret is sent and, for a keyvault credential,
its secret_auth_type names the method the upstream sees, so reading the
payload alone would make one document mean different things depending on
which surface received it.
A document this API cannot read - one naming a method outside AuthType, one disagreeing with the request's own auth_type, one yielding no secret material - is a 400. Letting any of them through leaves either an unhandled exception carrying the decrypted document in its frame locals, or a stored credential no materializer can read.
Authorization
OAuth2AuthorizationCodeBearer In: header
Query Parameters
trueRequest Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
A new secret, given either as an engine payload or as a form document.
payload is already in the shape the engine's materializers read.
document is the shape a credential form submits - camelCase keys plus
a type discriminator - and is converted here, by the same conversion
every other credential write path uses. Offering only payload would
leave that conversion to be reimplemented by each client, and a client
whose copy drifts stores a blob no materializer can read: the engine then
answers "no credential" and the resource silently disappears from a
resolved bundle rather than failing at the write.
Exactly one of the two is required. Accepting both would leave the question of which wins to be answered differently on every surface.
Response Body
application/json
application/json
curl -X POST "https://example.com/v1/credentials" \ -H "Content-Type: application/json" \ -d '{ "auth_type": "api_key" }'{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b", "creator_id": "9cceffdd-8381-4074-8256-eafae24ebee6", "auth_type": "api_key", "source": "inline", "label": "string", "vendor": "string", "oauth_email": "string", "oauth_expires_at": "2019-08-24T14:15:22Z", "config_json": "string", "is_provisional": false, "created_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z", "usage_count": 0}{ "detail": [ { "loc": [ "string" ], "msg": "string", "type": "string" } ]}