# ClearLicense Method

## Overloads

| [ClearLicense(LicenseType, Guid)](https://help.qlik.com/en-US/qlikview-developer/September2026/Subsystems/QMSAPIref/Content/PIX.Services.V12.Api8.IQMS8.ClearLicense.htm#PIX_Services_V12_Api8_IQMS8_ClearLicense_PIX_QMSAPI_DataObjects_Enums_LicenseType_System_Guid_) |  | Clears the license for a service. After this method has been called, the service will be unlicensed and might not be available until a new license has been applied.<br>Only the QlikViewServer-license type is currently supported. |
| --- | --- | --- |

[](https://help.qlik.com/en-US/qlikview-developer/Subsystems/QMSAPIref/Content/PIX.Services.V12.Api8.IQMS8.ClearLicense.htm) [](https://help.qlik.com/en-US/qlikview-developer/Subsystems/QMSAPIref/Content/PIX.Services.V12.Api8.IQMS8.ClearLicense.htm)

## ClearLicense(LicenseType, Guid)

Clears the license for a service. After this method has been called, the service will be unlicensed and might not be available until a new license has been applied. Only the QlikViewServer-license type is currently supported.

### Declaration

```

          void ClearLicense(LicenseType licenseType, Guid serviceID)
    
  
```

### Parameters

| Type | Name | Description |
| --- | --- | --- |
| [LicenseType](https://help.qlik.com/en-US/qlikview-developer/September2026/Subsystems/QMSAPIref/Content/PIX.QMSAPI.DataObjects.Enums.LicenseType.htm) | licenseType | The type of license to return. |
| System.Guid | serviceID | The ID if the service. |

### Remarks

##### security

Requires membership of local groups *QlikView Management API* and *QlikView Administrator*.

### Examples

The following example clears the license for the first QVS found.

The service key injection is assumed to be handled behind the scenes. For an example of how to inject the service key, see Samples.

```
using System;
using System.Collections.Generic;
using System.Linq;
using QMSAPI;

class Program
{
    static void Main(string[] args)
    {
        try
        {
            // create a QMS API client
            IQMS apiClient = new QMSClient();

            //retrieve a time limited service key
            ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey();

            //Find a QlikView Server service.
            ServiceInfo qlikViewServiceInfo = apiClient.GetServices(ServiceTypes.QlikViewServer).FirstOrDefault();
            if( qlikViewServiceInfo != null) {
                apiClient.ClearLicense(LicenseType.QlikViewServer, qlikViewServiceInfo.ID);
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine("An exception occurred: " + ex.Message);
        }
        // wait for user to press any key
        Console.ReadLine();
    }
}
```

### Exceptions

| Type | Condition |
| --- | --- |
| System.ArgumentException | Thrown if the provided licenseType parameter is unsupported. |

### See Also

[LicenseType](https://help.qlik.com/en-US/qlikview-developer/September2026/Subsystems/QMSAPIref/Content/PIX.QMSAPI.DataObjects.Enums.LicenseType.htm)

[SaveLicense(License, Guid)](https://help.qlik.com/en-US/qlikview-developer/September2026/Subsystems/QMSAPIref/Content/PIX.Services.V12.Api8.IQMS8.SaveLicense.htm#PIX_Services_V12_Api8_IQMS8_SaveLicense_PIX_QMSAPI_DataObjects_License_System_Guid_)