C# SDK

Install and start using the C# SDK.

Intro

The Decionis APIs SDK provides access to the Decionis APIs REST APIs.

Decionis evaluates captured execution intent against versioned policies before the caller performs the action. SDKs delegate policy judgment to this service and locally enforce the signed decision. New SDK API keys can be associated with an industry so Decionis provisions a starter encoded policy binding server-side; applications do not receive or implement policy logic., Ask a user's Shield for authority before an application or AI agent spends money.

Applications MUST request authorization before executing the consequential action. ALLOW authorizes only the exact request evaluated. ASK means hold until approval is complete. BLOCK means do not execute. A transport or API error is never permission.

Sandbox responses are simulations labelled sandbox_fixture and cannot move money.

Installation

Add the SDK as a project reference into your solution:

Terminal
dotnet add reference <path-to-sdk>/src/DecionisApIs/DecionisApIs.csproj

The project takes its build settings from the files around it, so reference it in place.

Quick Start

Dependency Injection

Register the client with IServiceCollection and resolve it from the container. The HttpClient is managed by IHttpClientFactory. Configure the client's behavior through DecionisApIsClientOptions.

C#
services.AddDecionisApIsClient(options =>
{
    options.ApiKeyAuth = "YOUR_BEARER_TOKEN";
    options.OperatorEntraAuth = "YOUR_BEARER_TOKEN";
    options.AccountSessionCookie = "YOUR_API_KEY";
    options.HostedGatewayTcpRouteCredential = "YOUR_BEARER_TOKEN";
    options.HostedGatewayTcpBrokerAuth = "YOUR_BEARER_TOKEN";
    options.HostedGatewayWorkerAuth = "YOUR_BEARER_TOKEN";
    options.ProtocolServiceAuth = "YOUR_BEARER_TOKEN";
    options.CommerceAccountsOAuth = "YOUR_BEARER_TOKEN";
    options.CommerceConnectedTransport = "YOUR_BEARER_TOKEN";
    options.AccountsWorkspaceCredentialService = "YOUR_BEARER_TOKEN";
    options.AccountsNativeEnrollmentService = "YOUR_BEARER_TOKEN";
    options.DrupalSiteKey = "YOUR_BEARER_TOKEN";
    options.Environment = ServerEnvironment.Production;
    // TODO: configure more client options here
});

Direct Instantiation

Create the client by passing an HttpClient you manage yourself. Configure the client's behavior through DecionisApIsClientOptions.

C#
var httpClient = new HttpClient();
// TODO: configure more client options here
var options = new DecionisApIsClientOptions
{
    ApiKeyAuth = "YOUR_BEARER_TOKEN",
    OperatorEntraAuth = "YOUR_BEARER_TOKEN",
    AccountSessionCookie = "YOUR_API_KEY",
    HostedGatewayTcpRouteCredential = "YOUR_BEARER_TOKEN",
    HostedGatewayTcpBrokerAuth = "YOUR_BEARER_TOKEN",
    HostedGatewayWorkerAuth = "YOUR_BEARER_TOKEN",
    ProtocolServiceAuth = "YOUR_BEARER_TOKEN",
    CommerceAccountsOAuth = "YOUR_BEARER_TOKEN",
    CommerceConnectedTransport = "YOUR_BEARER_TOKEN",
    AccountsWorkspaceCredentialService = "YOUR_BEARER_TOKEN",
    AccountsNativeEnrollmentService = "YOUR_BEARER_TOKEN",
    DrupalSiteKey = "YOUR_BEARER_TOKEN",
    Environment = ServerEnvironment.Production,
};
var client = new DecionisApIsClient(httpClient, options);

On this page