License Setup

License Setup

The Eriksson Beam API requires a valid API license key for all operations. This guide covers how to obtain, configure, and manage your API license key.

Understanding Licensing

Eriksson Beam has two separate licenses:

LicensePurposeHow to Obtain
Desktop LicenseRun the Eriksson Beam applicationIncluded with purchase/subscription
API License KeyUse the automation APIContact support@erikssonsoftware.com

This guide covers the API License Key configuration. Your desktop license is handled separately during software installation and activation.

Note: The API license key is sometimes referred to as "Eriksson license key" in code (e.g., the ERIKSSON_LICENSE_KEY environment variable). These refer to the same thing - your API access credential.

Obtaining an API License Key

Contact Eriksson Software to obtain an API license key:

Your license key will be provided as a string that looks similar to:

XXXX-XXXX-XXXX-XXXX-XXXX

Configuring Your API License Key

Store your API license key in an environment variable for security:

Windows (Command Prompt):

setx ERIKSSON_LICENSE_KEY "YOUR-LICENSE-KEY-HERE"

Windows (PowerShell):

[Environment]::SetEnvironmentVariable("ERIKSSON_LICENSE_KEY", "YOUR-LICENSE-KEY-HERE", "User")

In your code:

var licenseKey = Environment.GetEnvironmentVariable("ERIKSSON_LICENSE_KEY");

var launcherArgs = new ErikssonBeamLauncherArgs
{
    LicenseKey = licenseKey,
    // ...
};

Alternative: Configuration File

For applications with configuration files, use appsettings.json:

{
  "ErikssonBeam": {
    "LicenseKey": "YOUR-LICENSE-KEY-HERE"
  }
}

Load in code:

var configuration = new ConfigurationBuilder()
    .AddJsonFile("appsettings.json")
    .Build();

var licenseKey = configuration["ErikssonBeam:LicenseKey"];

Security Warning: Never commit license keys to source control. Add appsettings.json to your .gitignore and use appsettings.Development.json for local development.

Avoid hardcoding license keys in source code:

// DON'T do this - key will be in source control and compiled binary
var launcherArgs = new ErikssonBeamLauncherArgs
{
    LicenseKey = "XXXX-XXXX-XXXX-XXXX-XXXX",  // Bad practice!
    // ...
};

How License Validation Works

Understanding the validation process helps with troubleshooting:

  1. First Request: When you make your first API request, the license key is validated against Eriksson Software’s license server.
  2. Caching: Valid keys are cached for 7 days. During this period, no network calls are made to revalidate.
  3. Offline Use: After initial validation, the API works offline for up to 7 days.
  4. Cache Expiration: After 7 days, the next API request will revalidate online.

License Errors

Common Error Codes

ErrorMeaningResolution
LicenseErrorInvalid or expired license keyVerify key is correct; contact support
UnauthorizedKey not authorized for this operationCheck license tier/permissions

Handling License Errors

try
{
    var design = await client.PullBeamDesignerAsync();
}
catch (ServerErrorException ex) when (ex.Response.ResponseCode == ResponseCode.LicenseError)
{
    Console.WriteLine("License validation failed. Please check your license key.");
    Console.WriteLine($"Details: {ex.Response.ErrorMessage}");
}

Testing Your Setup

Verify your license is working with this test program:

using System;
using System.Threading.Tasks;
using ErikssonBeam.API.BeamClient;

class LicenseTest
{
    static async Task Main()
    {
        var licenseKey = Environment.GetEnvironmentVariable("ERIKSSON_LICENSE_KEY");

        if (string.IsNullOrEmpty(licenseKey))
        {
            Console.WriteLine("ERROR: ERIKSSON_LICENSE_KEY environment variable not set");
            return;
        }

        Console.WriteLine("License key found. Attempting connection...");

        var args = new ErikssonBeamConnectionAttemptArgs
        {
            LicenseKey = licenseKey,
            MaxAttempts = 3,
            WaitTimeBetweenAttemptsMs = 1000
        };

        try
        {
            // This requires Eriksson Beam to be running
            var client = await ErikssonBeamFinder.GetFirstSupportedBeamClient(args);
            Console.WriteLine("SUCCESS: Connected to Eriksson Beam!");
            Console.WriteLine("License key is valid.");
            client.Dispose();
        }
        catch (ErikssonBeamNotRunningException)
        {
            Console.WriteLine("Eriksson Beam is not running.");
            Console.WriteLine("Start Eriksson Beam and try again to verify your license.");
        }
        catch (ServerErrorException ex)
        {
            Console.WriteLine($"License error: {ex.Response.ErrorMessage}");
        }
    }
}

Multiple Environments

For different environments (development, staging, production), use separate environment variables or configuration files:

#if DEBUG
    var licenseKey = Environment.GetEnvironmentVariable("ERIKSSON_LICENSE_KEY_DEV");
#else
    var licenseKey = Environment.GetEnvironmentVariable("ERIKSSON_LICENSE_KEY_PROD");
#endif

API License Key Security Checklist

  • ☐ Store API license key in environment variable or secure configuration
  • ☐ Never commit API license keys to source control
  • ☐ Add configuration files with keys to .gitignore
  • ☐ Use different keys for development and production if available
  • ☐ Rotate keys if they may have been exposed

Next Steps

With your license configured, proceed to First Connection to start using the API.