API

Administration

Workspaces, API keys, upstream credentials, CLI pairing, and the identity webhook — the endpoints a platform calls on its customers' behalf.

Everything on this page is doable from the dashboard. The endpoints exist for the case where a dashboard is the wrong shape — a platform provisioning a workspace per signup, a CI job minting a key, an install script pairing a CLI.

These endpoints take an admin session token from Sentisec sign-in, not a workspace API key. Sending a workspace key here returns 401.

Workspaces

GET/v1/workspaces
List the workspaces you can see
POST/v1/workspaces
Create a workspace — admin only
GET/v1/workspaces/{workspace_id}
Fetch one workspace
DELETE/v1/workspaces/{workspace_id}
Soft-delete a workspace — admin only, idempotent 204

On these two lookup routes, a workspace id belonging to another organisation returns 404 rather than 403 — the API will not confirm that a foreign id is real. Deletion is a soft delete: the workspace stops accepting traffic and its keys stop working, but its recorded history survives for audit.

API keys

GET/ws/{workspace_id}/api-keys
List keys — includes revoked with ?include_revoked=true
POST/ws/{workspace_id}/api-keys
Mint a key — admin only, returns the plaintext once
GET/ws/{workspace_id}/api-keys/{key_id}
Fetch one key's metadata
DELETE/ws/{workspace_id}/api-keys/{key_id}
Revoke a key — admin only

The plaintext key is returned exactly once, in the 201 from the create call. Sentisec stores a hash plus the last four characters, so a refetch returns metadata only — name, creation time, last-used time, last four, revocation time. If the plaintext is lost, mint a new key and revoke the old one.

Revocation takes effect on the next request; there is no propagation delay to wait out.

Upstream credentials

Your provider keys live per workspace, encrypted at rest. The dashboard encrypts them in your browser before they are sent, so the plaintext never traverses the network.

POST/v1/workspaces/{workspace_id}/rotate-secrets
Store or rotate a provider credential — admin only
POST/v1/workspaces/{workspace_id}/connection-test
Probe a stored credential against its provider
GET/v1/workspaces/{workspace_id}/credentials/health
Per-provider credential status
DELETE/v1/workspaces/{workspace_id}/credentials/{provider}
Remove a stored credential

Rotation takes an already-encrypted credential; a body that sends a plaintext field is rejected with 422. If you are automating this outside the dashboard, the encryption material is part of your install configuration — talk to us for the setup.

POST /v1/workspaces/{workspace_id}/rotate-secrets
Content-Type: application/json

{
  "provider": "openai",
  "encrypted_credential": "<ciphertext>"
}

The new credential is live on the next request. In-flight streams finish on the credential they started with.

Connection testing takes provider_id, not provider — a body that sends {"provider": "openai"} is rejected with 422.

POST /v1/workspaces/{workspace_id}/connection-test
Content-Type: application/json

{ "provider_id": "openai" }

The health endpoint reports one of four statuses per provider. They separate "your key is missing" from "that upstream is not available here", which is the same distinction the 401 / 503 split makes at request time:

statusMeaningWhat to do
activeThe upstream is available and your credential resolves.Nothing — this is the working state.
missing_keyThe upstream is available; this workspace has no credential for it.Add the credential.
configuredYour credential is stored, but that upstream is not available here.Requests to it return 503 provider_unavailable. Get in touch about the provider you need.
not_configuredNeither.Nothing is set up for this provider.

Pairing a CLI

The pair flow swaps a short, human-typeable code for a workspace key, so a terminal never has to paste one. It is what the dashboard's "pair a CLI" button and the SDK's login command drive.

POST/v1/sdk/pair/start
Mint a single-use pair code — admin only
POST/v1/sdk/pair/completePublic
Redeem a pair code for a key — no credential needed
POST/v1/sdk/pair
Mint a key directly, skipping the interactive code — admin only

Redemption is anonymous by design: the code is the proof, it is single-use, and it expires quickly. Minting is rate-limited per user and address, so a burst of start calls returns 429 with Retry-After.

Identity webhook

POST/webhooks/clerkPublic
Signed identity events — provisions a workspace on first signup

One signed endpoint receives identity events and provisions a workspace and its first API key when a user or an organisation is created. It is what makes signup-to-first-call work without an operator in the loop.

Delivery is idempotent: a replayed event returns {"status":"duplicate"} and does not mint a second key. An unsigned request is rejected with 400.

// new user — first mint, the key is returned exactly once
{ "status": "ok", "workspace_id": "<uuid>", "api_key": "sk_sentisec_…" }

// new organisation — workspace only
{ "status": "ok", "workspace_id": "<uuid>" }

// replay of an event already processed
{ "status": "duplicate" }

Events other than user and organisation creation, and user deletion, are acknowledged and ignored. See SCIM provisioning for what that means for identity-provider-driven lifecycle.

Protected docs