Create the organization of a Microsoft platform purchase (internal producers)
Internal; default off (503 platform_workspaces_disabled until DECIONIS_PLATFORM_WORKSPACES_ENABLED is 1). Only a producer whose token (DECIONIS_DELIVERY_PRODUCERS_JSON) carries platforms: ["microsoft"] may call it: no token or an unknown one is 401 producer_required, any other producer 403 platform_not_allowed, and an organization key is never accepted. Commerce passes the workspace mapping Accounts signed for a decionis-platform purchase, with its evidence, verbatim. Core checks the version, platform, product and environment (400 otherwise); that the Accounts organization and workspace ids derive from source_org_id, that issued_at is within the last 10 minutes, and the Ed25519 signature over the canonical (sorted-key) mapping against the current Accounts JWKS (422 accounts_evidence_invalid with reason ids, stale or signature; 503 accounts_evidence_unavailable while the JWKS is unreachable). In one transaction it creates the organization with id = source_org_id, no Core owner, source product decionis and the production environment, its default entitlement, and the synchronized Accounts workspace reference, so the buyer's later Decionis sign-in to that workspace lands in this organization. The same reference again is 200 replayed; an existing organization with any other reference, a workspace already bound elsewhere, or an organization created for another subscription is 409 organization_conflict. No person, session or key is created. The optional subscription is the subscription's current state from Commerce's lifecycle, outside the signature: its paid plan becomes the organization's entitlement in the same transaction (422 plan_unknown for a plan code Core does not sell, before any write), and the answer reports what it did as subscription. Without it the organization gets the default entitlement.
Authorization
ApiKeyAuth An organization API key. Its scopes decide what it may call;
decision:shadow is the narrowest: SHADOW evaluations through
POST /v1/authority/grants or its alias
POST /v1/authority/enforce-and-bind only (DECISION_SHADOW_MODE_DENIED
in any other mode; DECISION_SHADOW_FIELD_DENIED for a body carrying
context.decionis_policy, evidence or escalation), with no
integration dispatch. A key whose only scope is decision:shadow
(an AgentSafe hosted gateway's) reaches exactly those two,
POST /v1/auth/credential-context, POST /v1/hosted-gateway/keys/confirm
and POST /v1/hosted-gateway/keys/revoke-self; every other route
answers 403 HOSTED_GATEWAY_KEY_PATH_DENIED.
decision:enforce is an enforced hosted gateway's key: evaluations
in SHADOW or ENFORCEMENT through POST /v1/authority/grants or its
alias (400 DECISION_ENFORCE_FIELD_DENIED for a body carrying
context.decionis_policy; it never holds policy:write), and the
grants and managed escalations they bind. A key whose scopes are
decision:enforce (with or without decision:shadow) reaches exactly
POST /v1/authority/enforce-and-bind, POST /v1/authority/grants,
GET /v1/authority/grants/{grant_id},
POST /v1/authority/grants/{grant_id}/claims,
POST /v1/authority/grants/{grant_id}/receipts,
POST /v1/authority/grants/{grant_id}/reconciliations,
POST /v1/execution/verify-token, POST /v1/execution/claim-token,
POST /v1/execution/consume-token, POST /v1/execution/finalize-token,
GET /v1/authority/escalations/{escalation_id},
DELETE /v1/authority/escalations/{escalation_id},
POST /v1/auth/credential-context, POST /v1/hosted-gateway/keys/confirm
and POST /v1/hosted-gateway/keys/revoke-self, each id a UUID; every
other route answers 403 HOSTED_GATEWAY_KEY_PATH_DENIED.
In: header
Request Body
application/json
core-microsoft-subscription-v1: one numbered state of a decionis-platform subscription. Commerce maps the Microsoft plan to plan_code by exact plan id in its registry; revision grows with every change it records for the subscription.
accounts-microsoft-workspace-v1, exactly as Accounts signed it; account_org_id and account_workspace_id are ExternalAccountIds.organization/workspace("decionis", source_org_id).
Ed25519 signature (base64url) over the canonical mapping, with its SHA-256, verifiable at the Accounts /.well-known/account-jwks.json.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/internal/platforms/microsoft/organizations" \ -H "Content-Type: application/json" \ -d '{ "mapping": { "version": "accounts-microsoft-workspace-v1", "platform": "microsoft", "source_org_id": "string", "subscription_id": "string", "account_org_id": "string", "account_workspace_id": "string", "account_user_id": "string", "account_membership_id": "string", "account_entitlement_id": "string", "product": "decionis", "environment": "production", "display_name": "string", "issued_at": "2019-08-24T14:15:22Z" }, "evidence": { "algorithm": "Ed25519", "key_id": "string", "payload_sha256": "string", "signature": "stringstringstringstringstringstringstri" } }'{ "status": "provisioned", "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b", "account_org_id": "string", "account_workspace_id": "string", "subscription": { "outcome": "applied", "reason": "subscription", "revision": 1, "projected": true, "entitlement": { "plan_code": "string", "decision_limit_monthly": 0, "api_access": true, "source": "string" } }}Record the marketplace receipt for a charge (internal producers) POST
Internal. After billing the charge's outcome dimension on Microsoft or AWS Marketplace, the producer records the one receipt (decionis.outcomes.receipt/1). The identical receipt again answers 200; any other receipt for the same charge is 409 charge_already_billed, so a charge is never billed twice.
Apply a Microsoft platform subscription's state to its organization (internal producers) PUT
Internal; default off, with the same flag and producer capability as provisionMicrosoftPlatformOrganization. Commerce sends each state its Microsoft lifecycle records for the subscription (plan change, Suspend, Reinstate, Unsubscribe), numbered by `revision`. Only the subscription the organization was created for is accepted. A higher revision applies: SUBSCRIBED grants the plan; SUSPENDED and UNSUBSCRIBED keep the plan with API access off, so decisions answer 402 until Reinstate. The same revision with the same state is `replayed`, an older one `stale`; neither changes anything. The organization's entitlement moves only while it is the default or this source's own (`marketplace:microsoft:platform`); otherwise the state is recorded and `projected` is false. 404 subscription_not_found when Core created no organization for this subscription; 409 subscription_conflict with reason subscription (another subscription), revision (the same revision with another state) or ended (a change after UNSUBSCRIBED); 422 plan_unknown for a plan code Core does not sell.

