The Runly API Client allows you to easily use the Runly API to manage your organization, queue jobs, report run status, and more from your .NET applications. You can reference the Runly.Client package to use the Runly API:

dotnet add package Runly.Client

Service Registration

You can register the Runly API services using .NET Core’s built-in DI:


The only required parameter is the API key you will use to connect to the API. This registers a few key services that you can now use in your application:

IRunClientHttpRunClientEnqueue jobs and search/get run status
IInfrastructureClientHttpInfrastructureClientManage environments and nodes in your organization
IPackageClientHttpPackageClientUpload and manage packages
IAccountClientHttpAccountClientManage your API keys and account settings
IOrgClientHttpOrgClientChange organization and billing settings

Register from Configuration

If you store your API key in an appsettings.json file, you can make use of the options pattern to register the API services:

// given an IConfiguration cfg

This will bind the values in appsettings.json with a RunlyOptions class we can create:

public class RunlyOptions
	public string ApiKey { get; set; }

We can then make use of an overload of AddRunlyApi to register the API services using our options class:

services.AddRunlyApi(s =>
	var opts = s.GetRequiredService<IOptions<RunlyOptions>>().Value;
	return opts.ApiKey;

Use without DI

If you’d rather not use dependency injection, you can create the services manually as well:

var client = new HttpClient
	BaseAddress = new Uri("")

var auth = new ApiKeyProvider("myapikey");

var orgs = new HttpOrgClient(client, auth);
var account = new HttpAccountClient(client, auth);
var inf = new HttpInfrastructureClient(client, auth);
var runs = new HttpRunClient(client, auth);

Next Steps