Create Credential
Create a credential. A generated secret is returned once, in this response only.
A project credential lives in its project's workspace; one without a project lives in the caller's own workspace.
HTTPBearerAuthorizationBearer <token>Bearer credential. API keys look like sqk_<geo>_<key_id>_<secret>: treat them as opaque and never put one in a browser. Older keys without the geo part stay valid until rotated. Find a geo's endpoints through GET /.well-known/sparq-discovery before sending a key.
Sparq-Workspace?stringFor a person signed in to a console with several workspaces: the workspace this call is for, one of their memberships (listMyMemberships). Without it such a person gets workspace_required (400); a workspace they are not a member of is forbidden. It never grants anything, and other callers' credentials ignore it.
uuidIdempotency-Key?stringMakes a retry safe: the same key, route and body within 24 hours returns the stored response and the same result id. The same key with a different body or route is idempotency_conflict; while the first request runs, idempotency_in_progress.
8 <= length <= 128application/json- body
Create a credential. Sparq generates the secret; callers never choose one.
type*CredentialType"project_api_key""oauth_client""service_identity""user_token_issuer""provider_key""tool_credential"owner*project_id?|nullenvironment?|nullenvironment_id?|ADR-0011: the one environment this credential may act in.
purpose*PurposeWhat the credential is for; used to detect misuse.
1 <= length <= 500expires_at?|nullsecret_ref?|For provider keys and tool credentials: a Key Vault reference, never the secret.
Successful Response
application/json- response
Returned once, when Sparq creates or rotates a secret. The secret is not stored readable.
credential*secret*|The new secret, shown once and never again. Empty for credentials that hold no Sparq-generated secret. Clients must not log it.
curl -X POST 'http://dev-sparq.centralindia.cloudapp.azure.com:8000/v1/admin/credentials' \ -H 'Content-Type: application/json' \ -d '{ "type": "project_api_key", "owner": { "kind": "person", "name": "string" }, "purpose": "string"}'{ "credential": { "credential_id": "13c40afa-2996-4a0c-b2e9-68fba9462242", "type": "project_api_key", "status": "active", "owner": { "kind": "person", "name": "string", "contact": "string" }, "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9", "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9", "environment": "string", "environment_id": "40ef0e48-a11f-4963-a229-e396c9f7e7c4", "purpose": "string", "fingerprint": "string", "predecessor_id": "c8bad2a2-4d3d-486b-89ca-11a0c911eff9", "created_at": "2019-08-24T14:15:22Z", "rotated_at": "2019-08-24T14:15:22Z", "expires_at": "2019-08-24T14:15:22Z", "revoked_at": "2019-08-24T14:15:22Z" }, "secret": "string"}