C# Examples
Runnable C# examples for the KiloCenter gRPC API — create console project, add Grpc.Net.Client, call methods.
This page provides runnable C# examples for the KiloCenter gRPC API. For the full API reference, see API Reference.
For general C# gRPC documentation, see grpc.io/docs/languages/csharp.
Prerequisites
All commands in this guide assume your working directory is
kilocenter-modules/.
Create a new console project and add the required NuGet packages:
dotnet new console -n KiloCenterClient
cd KiloCenterClient
dotnet add package Grpc.Net.Client
dotnet add package Google.Protobuf
dotnet add package Grpc.ToolsAdd the proto files to your .csproj for code generation:
<ItemGroup>
<Protobuf Include="path/to/KC-Core/api/proto/kilocenter.proto"
GrpcServices="Client"
AdditionalImportDirs="path/to/KC-Core/api/proto" />
<Protobuf Include="path/to/KC-Core/api/proto/core.proto"
GrpcServices="None"
AdditionalImportDirs="path/to/KC-Core/api/proto" />
<Protobuf Include="path/to/KC-Core/api/proto/identity.proto"
GrpcServices="None"
AdditionalImportDirs="path/to/KC-Core/api/proto" />
</ItemGroup>Replace path/to/ with the actual path to the KiloCenter repository. Building the project auto-generates C# stubs.
Get System Status
Retrieves the current system status including version, uptime, and service health.
List Endpoints
Lists registered endpoints with pagination support. High-volume profile: default page size 100, max 1000.
Authentication
Community Edition
Community Edition runs in single-tenant mode with authentication and organization enforcement disabled (auth.enabled: false, org_enforcement_enabled: false). The examples above work without any headers.
Enterprise: JWT User Principal
Requires three headers: authorization, x-organization-id, and x-user-id. The x-user-id value must match the authenticated user in the JWT. Missing x-user-id returns ErrTokenUserIDHeaderRequired; a mismatch returns ErrTokenIdentityMismatch.
Enterprise: Service-Account API Key
Requires two headers: authorization and x-organization-id. Do not send x-user-id — including it returns ErrTokenIdentityMismatch to prevent user injection.
Last updated