# License Feature Check

Use this endpoint to check a license device against a license feature. Once checked, the device will be connected to the feature. If the feature is floating, the device will also take one floating slot if available.

### Endpoint

* Method: `GET`
* Path: `/api/v4/check_license_feature`
* Description: Checks a license device against a license feature.

### Authentication

See [License API Authorization](/license-api/license-api-authorization.md).

#### Required headers

* `Date` (string) — RFC7231 GMT date string
* `Authorization` (string)

#### Recommended headers

* `Accept: application/json`

### Request

### Query parameters (TypeScript)

```typescript
type LicenseFeatureCheckRequestParams = ({

  // for key-based licenses:
  license_key: string

} | {

  // for user-based licenses:
  username: string

}) & {

  // required properties:
  hardware_id: string
  product: string
  feature: string

  // optional properties:
  license_id?: number | undefined
}
```

JSON Schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "allOf": [
    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "license_key": { "type": "string" }
          },
          "required": ["license_key"],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "username": { "type": "string" }
          },
          "required": ["username"],
          "additionalProperties": false
        }
      ]
    },
    {
      "type": "object",
      "properties": {
        "hardware_id": { "type": "string" },
        "product": { "type": "string" },
        "feature": { "type": "string" },
        "license_id": { "type": ["number", "null"] }
      },
      "required": ["hardware_id", "product", "feature"],
      "additionalProperties": false
    }
  ]
}
```

#### Query parameters summary

Required:

* `hardware_id` (string) — Unique hardware ID generated for the client device
* `product` (string) — Product short code
* `feature` (string) — Feature code

One of:

* `license_key` (string) — Required if product is key-based
* `username` (string) — Required if product is user-based

Optional:

* `license_id` (number) — Targets a specific license ID

### Examples

{% tabs %}
{% tab title="curl" %}

```bash
curl --location --request GET '/api/v4/check_license_feature?hardware_id=string&product=string&feature=string&license_key=string' \
--header 'Accept: application/json' \
--header 'Date: string' \
--header 'Authorization: string'
```

{% endtab %}

{% tab title="nodejs" %}

```javascript
var request = require('request');
var options = {
  method: 'GET',
  url: '/api/v4/check_license_feature?hardware_id=string&product=string&feature=string&license_key=string',
  headers: {
    'Accept': 'application/json',
    'Date': 'string',
    'Authorization': 'string'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
```

{% endtab %}

{% tab title="javascript (fetch)" %}

```javascript
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Date", "string");
myHeaders.append("Authorization", "string");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/api/v4/check_license_feature?hardware_id=string&product=string&feature=string&license_key=string", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="python" %}

```python
import requests

url = "/api/v4/check_license_feature?hardware_id=string&product=string&feature=string&license_key=string"

headers = {
  "Accept": "application/json",
  "Date": "string",
  "Authorization": "string"
}

response = requests.get(url, headers=headers)
print(response.text)
```

{% endtab %}

{% tab title="ruby" %}

```ruby
require "uri"
require "net/http"

url = URI("/api/v4/check_license_feature?hardware_id=string&product=string&feature=string&license_key=string")

http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Accept"] = "application/json"
request["Date"] = "string"
request["Authorization"] = "string"

response = http.request(request)
puts response.read_body
```

{% endtab %}
{% endtabs %}

### Response

### Response body (TypeScript)

```typescript
type LicenseFeatureCheckResponseBody = {
    allow_negative_consumptions: boolean,
    allow_overages: boolean,
    allow_unlimited_consumptions: boolean,
    code: string,
    consumption_period: string,
    expiry_date: null | string,
    feature_type: string,
    id: number,
    is_floating_cloud: boolean,
    is_floating: boolean,
    license_id: number,
    max_consumption: number,
    max_overages: number,
    metadata: JSON,
    name: string,
    reset_consumption: boolean,
    total_consumptions: number,
    
    // the following property is only present on floating and floating cloud features:
    floating_in_use_devices?: number,
}
```

JSON Schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "allow_negative_consumptions": { "type": "boolean" },
    "allow_overages": { "type": "boolean" },
    "allow_unlimited_consumptions": { "type": "boolean" },
    "code": { "type": "string" },
    "consumption_period": { "type": "string" },
    "expiry_date": { "type": ["string", "null"] },
    "feature_type": { "type": "string" },
    "id": { "type": "number" },
    "is_floating_cloud": { "type": "boolean" },
    "is_floating": { "type": "boolean" },
    "license_id": { "type": "number" },
    "max_consumption": { "type": "number" },
    "max_overages": { "type": "number" },
    "metadata": { "type": "object" },
    "name": { "type": "string" },
    "reset_consumption": { "type": "boolean" },
    "total_consumptions": { "type": "number" },
    "floating_in_use_devices": { "type": "number" }
  },
  "required": [
    "allow_negative_consumptions",
    "allow_overages",
    "allow_unlimited_consumptions",
    "code",
    "consumption_period",
    "expiry_date",
    "feature_type",
    "id",
    "is_floating_cloud",
    "is_floating",
    "license_id",
    "max_consumption",
    "max_overages",
    "metadata",
    "name",
    "reset_consumption",
    "total_consumptions"
  ],
  "additionalProperties": false
}
```

Notes:

* floating\_in\_use\_devices — number of devices currently in use on this license feature (present only on floating and floating cloud features)
* license\_id — id of the license

### Errors

If an error occurs, the response will have an HTTP status code of 400 or higher. The response body will contain an error description in the following format:

```typescript
{
  status: number,
  code: string,
  message: string
}
```

JSON Schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "status": { "type": "number" },
    "code": { "type": "string" },
    "message": { "type": "string" }
  },
  "required": [
    "status",
    "code",
    "message"
  ],
  "additionalProperties": false
}
```

### List of exceptions

* missing\_headers (400): Some headers are missing
* unknown\_product (400): Provided product was not found
* license\_not\_found (400): License with the provided license user not found
* license\_not\_enabled (400): The license is not enabled
* license\_not\_active (400): The license is not active
* device\_not\_found (400): An active device matching the hardware\_id not found
* blacklisted (400): This device is blacklisted
* invalid\_license\_feature\_code (400): License feature code: ' + param + ' is invalid or not assigned to the license.
* floating\_not\_available (400): No available slots for floating license.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.licensespring.com/license-api/license-feature-check.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
