Hosted gateway

Poll a hosted gateway sign-on for its workspace key (fleet operator)

POST
/v1/hosted-gateway/authorizations/token

The operator's poll, with the same Entra token as the start: a device code redeems only for the operator who started it. Until the customer decides, it answers authorization_pending (or slow_down, with a 5 s wider interval, when polled sooner than the interval allows). Once approved, the next poll first applies approval's workspace rules again (the approver ADMIN or above, a paid plan, an active entitlement); a workspace that no longer qualifies denies the authorization (access_denied with a reason), and Accounts being unreachable answers 503 temporarily_unavailable to retry, nothing minted. Otherwise it mints the key in the same transaction that consumes the authorization and makes it the tenant's current key (one per organization and tenant label), and returns it exactly once: a MEMBER key named agentsafe-hosted-<tenant_label> with scopes ["decision:shadow"], created by the approver. The key expires at confirm_by (10 minutes) unless the holder calls POST /v1/hosted-gateway/keys/confirm with it, so a key whose delivery was never confirmed does not stay active. The tenant's earlier keys (replaced_key_ids) stay live until that confirmation revokes them, except one that was itself never delivered, which is revoked now; a new key that is lost in transit never leaves the tenant without one. Later polls answer invalid_grant. Sixty polls per minute per operator.

Authorization

OperatorEntraAuth
AuthorizationBearer <token>

A fleet operator's Microsoft Entra v2 access token for the "Decionis Operator API" app registration (Application ID URI api://decionis-operator), as az account get-access-token --scope api://decionis-operator/Operator.Act returns it: issuer https://login.microsoftonline.com//v2.0, audience the app's client id, scp holding Operator.Act, roles holding HostedGateway.Operator (or DECIONIS_OPERATOR_ENTRA_ROLE), and azp Azure CLI (04b07795-8ddb-461a-bbee-02f9e1bf7b46) or a client DECIONIS_OPERATOR_ENTRA_CLIENT_APPS names (403 OPERATOR_CLIENT_NOT_ALLOWED otherwise), verified against the tenant's JWKS. The app registration should make Operator.Act admin-consent only and require assignment on its enterprise application.

In: header

Request Body

application/json

device_code*string
Lengthlength <= 200
grant_type?string

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/hosted-gateway/authorizations/token" \  -H "Content-Type: application/json" \  -d '{    "device_code": "string"  }'
{  "api_key": "string",  "key_id": "1e779c8a-6786-4c89-b7c3-a6666f5fd6b5",  "key_name": "agentsafe-hosted-acme",  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",  "org_name": "string",  "tenant_label": "string",  "tenant_host": "string",  "upstream_origin": "http://example.com",  "max_embedded_body_bytes": 0,  "approved_by_email": "user@example.com",  "approved_at": "2019-08-24T14:15:22Z",  "role": "MEMBER",  "scopes": [    "decision:shadow"  ],  "confirm_by": "2019-08-24T14:15:22Z",  "replaced_key_ids": [    "4d87defc-4bd5-4dfb-b230-0c944f337a58"  ]}

Start a hosted gateway sign-on for a paying tenant (fleet operator) POST

Device-authorization grant (RFC 8628 shaped) by which a paying tenant of the AgentSafe hosted gateway fleet receives its workspace key without anyone copying one. The fleet operator (Tenant.py) starts it with a Microsoft Entra access token for `api://decionis-operator/Operator.Act` whose `roles` holds the operator role; who asked (`oid`, sign-in name) is recorded from the verified token, never from the body, and a body naming a requester is refused. The customer then approves at `verification_uri_complete` while signed in to Decionis as `owner_email` by a sign-in that proved that address, ADMIN or above in a workspace on a paid plan with an active entitlement, and the operator polls the token endpoint. Codes live 30 minutes; poll every `interval` seconds. Twenty starts per hour per operator. Without Entra configuration (DECIONIS_OPERATOR_ENTRA_TENANT_ID, DECIONIS_OPERATOR_ENTRA_CLIENT_ID, and a well-formed DECIONIS_OPERATOR_ENTRA_CLIENT_APPS when set) every call answers 503 OPERATOR_AUTH_NOT_CONFIGURED.

Read a hosted gateway sign-on request by its user code (signed-in customer) POST

What the approval page shows: the tenant and its host, the upstream origin, the operator who asked, when it expires, exactly what the gateway records (`disclosure`), and the signed-in user's workspaces with whether each can take the key by the rules the database answers (ADMIN or above, a paid plan, API access); Accounts' entitlement is asked at approval. The owner email is shown in full only to that owner, and workspaces are listed only for them. Never returns the device code. A POST so the user code is never in a URL (and so never in a request log line), from the page itself: `Sec-Fetch-Site: same-origin` (or, without it, the web application's own `Origin`) and a JSON body, as approve requires.