New·
Getting Started with Entitlement API in C#/.NET
A practical guide to integrating Autodesk’s Entitlement API into your AutoCAD plugin using C# and .NET.
Aa Ahmed2 min read
In this post, we’ll walk through the step‑by‑step process of integrating Autodesk’s Entitlement API into your AutoCAD plugin with C#/.NET. You’ll learn how to install the SDK, configure the client, and perform license validation at startup.

Prerequisites
- Visual Studio 2022 or later
- .NET Framework 4.8 (or .NET 6+ for .NET Core plugins)
- Valid
license.token
file (from your Autodesk account) - NuGet package:
Autodesk.EntitlementApi
1. Install the Entitlement API SDK
Install-Package Autodesk.EntitlementApi -Version 1.0.0
2. Configure the EntitlementApiClient
In your Plugin.cs
(or main entry class), initialize the client with your API base URL and credentials:
plugin.cs
using Autodesk.Entitlement;
public class Plugin : IExtensionApplication
{
private EntitlementApiClient _entitlementClient;
public void Initialize(IExtensionApplication app)
{
var baseUrl = "https://api.autodesk.com/entitlement/v1";
var apiKey = Environment.GetEnvironmentVariable("ENTITLEMENT_API_KEY");
_entitlementClient = new EntitlementApiClient(baseUrl, apiKey);
ValidateLicense();
}
public void Terminate() { /* cleanup */ }
private void ValidateLicense()
{
var token = File.ReadAllText("license.token");
var response = _entitlementClient.ValidateTokenAsync(token)
.GetAwaiter().GetResult();
if (!response.IsValid)
throw new UnauthorizedAccessException("License validation failed: " + response.Message);
}
}
3. Validate and Activate
After validating the token, you can optionally activate a floating seat:
Plugin.cs
// Activate a floating license for the current machine
var machineId = Environment.MachineName;
var activation = _entitlementClient.ActivateAsync(token, machineId)
.GetAwaiter().GetResult();
if (!activation.Success)
Debug.WriteLine("Activation warning: " + activation.Message);
4. Error Handling & Logging
Wrap your calls in try‑catch to handle network issues or API errors gracefully:
try
{
ValidateLicense();
}
catch (Exception ex)
{
Debug.WriteError($"Entitlement error: {ex.Message}");
// Optionally disable plugin features or prompt user
}
⚠️ Tip: Use
HttpClientFactory
and retry policies (e.g., Polly) to make your entitlement calls resilient to transient failures.Next Steps
In Post #3, we’ll explore how to craft professional‑level test data and automate license‑scenario testing in your CI pipeline.