Python Examples
Runnable Python examples for the KiloCenter gRPC API — install grpcio, generate stubs, and call uplink methods.
This page provides runnable Python examples for the KiloCenter gRPC API. For the full API reference, see API Reference.
For general Python gRPC documentation, see grpc.io/docs/languages/python.
Prerequisites
All commands in this guide assume your working directory is
kilocenter-modules/.
Install the gRPC Python packages:
pip install grpcio grpcio-toolsGenerate Python stubs from the proto definitions:
python -m grpc_tools.protoc \
-I KC-Core/api/proto \
--python_out=./gen \
--grpc_python_out=./gen \
KC-Core/api/proto/kilocenter.proto \
KC-Core/api/proto/core.proto \
KC-Core/api/proto/identity.protoThis produces kilocenter_pb2.py, core_pb2.py, identity_pb2.py, and their _grpc counterparts in the gen/ directory.
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