Sub-workspaces
One sub-workspace per customer of your app, by your own id — create it, copy your decisions into it, run them with Dcision-Workspace, limit and watch its usage.
A sub-workspace holds one customer's decisions. You address it by your id for the customer (external_id, e.g. your workspace or account id), so you never store Dcision ids.
Create one
POST /v1/workspaces creates the sub-workspace for an external_id, or updates it when it already exists — call it every time a customer turns the feature on.
curl https://api.dcision.io/v1/workspaces \
-H "Authorization: Bearer $DCISION_API_KEY" -H "Content-Type: application/json" \
-d '{
"external_id": "acme",
"name": "Acme Inc",
"seed": { "decisions": ["lead-qualification"], "deploy": true }
}'seed copies the deployed version of your own decisions into the new sub-workspace, with the same slugs — so each customer starts from your working decision and can then change it. It runs only when the sub-workspace is created; the response lists what was copied and what was skipped.
Run a customer's decision
Send your API key with the header Dcision-Workspace: ext:<external_id> (or the sub-workspace's id):
curl https://api.dcision.io/v1/decisions/lead-qualification \
-H "Authorization: Bearer $DCISION_API_KEY" \
-H "Dcision-Workspace: ext:acme" \
-H "Content-Type: application/json" \
-d '{ "state": { "message": "Can you send pricing for 500 seats?" } }'The same header works on GET /v1/decisions, GET /v1/me, GET /v1/executions and the MCP server. A sub-workspace that isn't yours answers 404 WORKSPACE_NOT_FOUND. The SDKs take it as an option:
const acme = dcision.withWorkspace("ext:acme");
await acme.decide("lead-qualification", { message: "Pricing?" });Idempotency is per sub-workspace: the same Idempotency-Key sent for two customers is a conflict (409), never another customer's stored answer.
Billing and limits
- Every billable run of a sub-workspace counts in your workspace's usage, plan and wallet; rate limits are your workspace's too.
- Per-customer limits (from Settings → Partner, or
limitson the sub-workspace):max_decisions(402 PLAN_LIMIT_REACHEDwithscope: "workspace") andmonthly_decisionsper billing cycle (402 QUOTA_EXCEEDEDwithscope: "workspace"). GET /v1/mewith the header addsworkspace_usage— the customer's runs in the cycle and their limit.- Sub-workspaces run on your engine settings and engine keys. Their LLM and JSON destinations use your LLM keys only if you allow it; workspace secrets are never shared.
Delete
DELETE /v1/workspaces/ext:acme removes the sub-workspace with all its decisions and executions. The usage already billed stays in your workspace.
Partners
Offer Dcision inside your own app — one sub-workspace per customer, an embeddable editor for your end users and usage billed to your workspace.
Embed the editor
Let your customers create, edit, test and deploy their decisions inside your app — embed sessions from your backend, the @dcision/embed script, permissions and events.