C# SDK

The Solcast NuGet package wraps this REST API with typed clients for live, forecast, historic, TMY, aggregations, and PV power site management. Supported endpoint pages include a C# SDK tab with ready-to-use examples (20 endpoints).

Install

Add the package to your project with dotnet add package Solcast.

Authentication

You need a Solcast API key. Register at the Solcast Toolkit. The recommended approach is to set the SOLCAST_API_KEY environment variable — the SDK reads it automatically. See also Authentication.

Working with responses

SDK methods return a response object. Use RawResponse for the raw response body (JSON or CSV depending on the format parameter). Typed response data is available on the response object when applicable.

Unmetered locations

When testing or evaluating the API, use coordinates from unmetered locations via UnmeteredLocations.Locations so requests do not count against your plan quota. You still need a valid API key.

Additional resources

Full package documentation, including examples and API reference, is published separately at the C# SDK docs.

Clients

Instantiate a client from Solcast.Clients and call the method that matches the REST endpoint you need. Parameter names mirror the API query parameters documented on each endpoint page.

Solcast.Clients.LiveClient

Near real-time estimated actuals for the past 7 days. Data is derived from satellite imagery (clouds and irradiance over non-polar continental areas) and numerical weather models.

MethodSummaryAPI reference
GetLiveRadiationAndWeatherLive irradiance and weather estimated actuals.
GetLiveRooftopPvPowerLive rooftop PV power estimated actuals.
GetLiveAdvancedPvPowerLive advanced PV power estimated actuals for a registered site.

Solcast.Clients.ForecastClient

Irradiance, weather, and power forecasts from the present time up to 14 days ahead. Combines satellite nowcasting (roughly four hours ahead) with numerical weather model data for longer horizons.

MethodSummaryAPI reference
GetForecastRadiationAndWeatherForecast irradiance and weather.
GetForecastRooftopPvPowerForecast rooftop PV power output.
GetForecastAdvancedPvPowerForecast advanced PV power for a registered site.

Solcast.Clients.HistoricClient

Historical irradiance, weather, and power data from 2007 to 7 days ago. Use start with duration or start with end to define the time window.

MethodSummaryAPI reference
GetHistoricRadiationAndWeatherHistoric irradiance and weather.
GetHistoricRooftopPvPowerHistoric rooftop PV power.
GetHistoricAdvancedPvPowerHistoric advanced PV power for a registered site.

Solcast.Clients.TmyClient

Typical Meteorological Year (TMY) data — a one-year collation selected so that annual averages are consistent with long-term climatology for the requested location.

MethodSummaryAPI reference
GetTmyRadiationAndWeatherTMY irradiance and weather.
GetTmyRooftopPvPowerTMY rooftop PV power.
GetTmyAdvancedPvPowerTMY advanced PV power for a registered site.

Solcast.Clients.AggregationClient

Grid aggregation live and forecast PV power output for configured collection and aggregation identifiers.

MethodSummaryAPI reference
GetLiveAggregationsLive grid aggregation data.
GetForecastAggregationsForecast grid aggregation data.

Solcast.Clients.PvPowerSiteClient

Create, read, update, and delete advanced PV power site resources. Site metadata is used by advanced PV power methods across live, forecast, and historic modules.

MethodSummaryAPI reference
GetPvPowerSitesList available PV power sites.
GetPvPowerSiteGet an existing site by resource ID.
PostPvPowerSiteCreate a new advanced PV power site.
PatchPvPowerSitePartially update a site.
PutPvPowerSiteReplace a site definition.
DeletePvPowerSiteDelete a site.

Endpoints not covered by the SDK — including soiling, geographic, wind power, site measurements, manage schedules, and historic forecast — are available via the REST API only. Use the cURL or C# request examples on those endpoint pages.

Examples

Install, authenticate, and call the API

Install
dotnet add package Solcast
API key
// Recommended: set SOLCAST_API_KEY in your environment
export SOLCAST_API_KEY="your-api-key"
Live radiation & weather
using Solcast.Clients;

var liveClient = new LiveClient();
var response = await liveClient.GetLiveRadiationAndWeather(
    latitude: -33.856784,
    longitude: 151.215297,
    outputParameters: ["air_temp", "ghi"],
);

Console.WriteLine(response.RawResponse);
Response helpers
Console.WriteLine(response.RawResponse);

// Or access typed response data when available
// var data = response.Data;
Unmetered location
using Solcast.Clients;

var location = UnmeteredLocations.Locations["Sydney Opera House"];

var forecastClient = new ForecastClient();
var response = await forecastClient.GetForecastRooftopPvPower(
    latitude: location.Latitude,
    longitude: location.Longitude,
    outputParameters: ["pv_power_rooftop"],
    period: "PT5M",
    capacity: 5.0f,
    tilt: 22.0f,
    format: "csv",
);

Console.WriteLine(response.RawResponse);
LiveClient
using Solcast.Clients;

var liveClient = new LiveClient();
var response = await liveClient.GetLiveRadiationAndWeather(
    latitude: -33.856784,
    longitude: 151.215297,
    outputParameters: ["dni", "ghi"],
);

Console.WriteLine(response.RawResponse);
ForecastClient
using Solcast.Clients;

var forecastClient = new ForecastClient();
var response = await forecastClient.GetForecastRadiationAndWeather(
    latitude: -33.856784,
    longitude: 151.215297,
    outputParameters: ["air_temp"],
);

Console.WriteLine(response.RawResponse);
HistoricClient
using Solcast.Clients;

var historicClient = new HistoricClient();
var response = await historicClient.GetHistoricRadiationAndWeather(
    start: "2024-06-01T06:00",
    latitude: -33.856784,
    longitude: 151.215297,
    duration: "P1D",
);

Console.WriteLine(response.RawResponse);
TmyClient
using Solcast.Clients;

var tmyClient = new TmyClient();
var response = await tmyClient.GetTmyRooftopPvPower(
    latitude: -33.856784,
    longitude: 151.215297,
    capacity: 5.0f,
);

Console.WriteLine(response.RawResponse);
AggregationClient
using Solcast.Clients;

var aggregationClient = new AggregationClient();
var response = await aggregationClient.GetForecastAggregations(
    outputParameters: ["percentage", "pv_estimate"],
    collectionId: "aust_state_total",
    aggregationId: "vic",
);

Console.WriteLine(response.RawResponse);
PvPowerSiteClient
using Solcast.Clients;

var pvPowerSiteClient = new PvPowerSiteClient();
var response = await pvPowerSiteClient.GetPvPowerSite(
    resourceId: "ba75-e17a-7374-95ed",
);

Console.WriteLine(response.RawResponse);