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 single-tenant with organization enforcement off, so the examples above need only the authorization header: sign in with Login and send Bearer <access_token>. Each call also needs a role: GetSystemStatus is open to every role, ListEndPoints to Endpoint Managers and administrators. See User Roles and Permissions.
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.
A service-account key acts as a Base Station Manager and Endpoint Manager in the organization it was created for, so the call below succeeds for that organization. Calls that need the Admin or Tenant Manager role, and any call for another organization, return PERMISSION_DENIED.
Last updated