SDK Overview
The EnergyCAP SDKs are auto-generated client libraries that wrap the REST API, giving you typed methods, request/response models, and built-in serialization in your language of choice. Use an SDK to skip the boilerplate of raw HTTP calls and work directly with EnergyCAP objects.
Available SDKs
| Language | Package | Install | Status |
|---|---|---|---|
| C# | EnergyCap.Sdk | dotnet add package EnergyCap.Sdk |
Stable |
| Python | EnergyCapSdk | pip install EnergyCapSdk |
Beta |
| Angular/TypeScript | @energycap/energycap-sdk-angular | npm install @energycap/energycap-sdk-angular |
Beta |
| PowerShell | Uses C# SDK or direct REST | Invoke-RestMethod |
Guide |
SDK vs. Direct API Calls
| SDK | Direct HTTP | |
|---|---|---|
| Setup | Install a package, create a client | Build your own HTTP client and headers |
| Type safety | Typed request/response models | Parse raw JSON |
| Serialization | Handled automatically | Manual JSON serialization/deserialization |
| Pagination | Use WithHttpMessagesAsync (C#) to access headers |
Read response headers directly |
| Flexibility | Limited to what the SDK exposes | Full control over requests |
Use an SDK when you want to move fast and your language is supported. Use direct HTTP calls when you need fine-grained control or are working in a language without an SDK.
Authentication
All SDKs support API key authentication, which is the recommended method. Pass your API key when creating the client:
// C#
var settings = new EnergyCapClientSettingsApiKeyAuth
{
ApiKey = "your_api_key"
};
var client = await EnergyCapApiClientFactory.CreateClientAsync(settings);
# Python — API key auth via header
api = EnergyCapApi(base_url="https://app.energycap.com")
api.config.headers["ECI-ApiKey"] = "your_api_key"
The C# SDK also supports credential-based authentication, but this method is deprecated and will be removed in a future release. Migrate to API key authentication.
See Authentication for how to create and manage API keys.
Base URL
Set the base URL to match your organization’s environment:
| Environment | Base URL |
|---|---|
| US East (Production) | https://app.energycap.com |
| US West | https://wce.energycap.com |
| EU | https://app-eu.energycap.com |
| FedRAMP | https://app.fed-energycap.com |
| Implementation | https://implement.energycap.com |
The C# SDK provides these as constants in EnergyCap.Sdk.Extensions.EnergyCapEnvironments:
var settings = new EnergyCapClientSettingsApiKeyAuth
{
ApiKey = "your_api_key",
EnvironmentUrl = EnergyCapEnvironments.Implementation
};
SDK Versioning
SDK version numbers follow the format major.YYMM.build:
| Segment | Meaning | Example |
|---|---|---|
major |
Major SDK version — breaking changes increment this | 8 |
YYMM |
Year/month of the latest API version included | 2101 = January 2021 |
build |
Build number | 3196 |
For example, 8.2101.3196 is major version 8, includes APIs up through v202101, build 3196.
Pagination
List endpoints return paginated results. In the C# SDK, you must use the WithHttpMessagesAsync method variants to access pagination headers:
var response = await client.GetMetersWithHttpMessagesAsync(
filter: "", pageSize: 500, pageNumber: 1);
var meters = response.Body;
int totalPages = response.Headers.TotalPages.Value;
The standard methods (e.g. GetMetersAsync) return only the response body with no access to pagination metadata. See Pagination for the full iteration pattern.
Quick Start
- Install the SDK for your language (see install commands above)
- Get an API key from your EnergyCAP administrator — see Authentication
- Identify your environment — see Environments
- Create a client and make your first call:
// C# — Get the first page of meters
var settings = new EnergyCapClientSettingsApiKeyAuth { ApiKey = "your_api_key" };
var client = await EnergyCapApiClientFactory.CreateClientAsync(settings);
var response = await client.GetMetersWithHttpMessagesAsync(pageSize: 10, pageNumber: 1);
foreach (var meter in response.Body)
{
Console.WriteLine($"{meter.MeterId}: {meter.MeterCode}");
}
For language-specific setup, examples, and configuration options, see the individual SDK pages: