> For the complete documentation index, see [llms.txt](https://docs.licensespring.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.licensespring.com/license-api/license-check/check-license.md).

# Check License

### Endpoint

* Method: `GET`
* Path: `/api/v4/check_license`
* Description: Checks the status and validity of a license.

### Authentication

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

#### Required headers

* `Date` (string) — RFC7231 GMT date string
* `Authorization` (string) — signature or bearer token

#### Recommended headers

* `Accept: application/json`

### Request

#### Query parameters

Required:

* `hardware_id` (string) — Unique hardware ID generated for the client device
* `product` (string) — Product short 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
* `include_expired_features` (boolean)
* `env` (string)
* `os_ver` (string)
* `hostname` (string)
* `os_hostname` (string)
* `ip` (string)
* `ip_local` (string)
* `app_ver` (string)
* `sdk_ver` (string)
* `mac_address` (string)

### Examples

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

```bash
curl --location --request GET '/api/v4/check_license?hardware_id=string&product=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?hardware_id=string&product=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?hardware_id=string&product=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?hardware_id=string&product=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?hardware_id=string&product=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 %}

### Schema

<details>

<summary><strong>Request schema (TypeScript + JSON Schema)</strong></summary>

**TypeScript**

```typescript
type LicenseCheckQueryParameters = ({

  // for key-based licenses:
  license_key: string

} | {

  // for user-based licenses:
  username: string

}) & {

  // required properties:
  hardware_id: string
  product: string

  // optional properties:
  license_id?: number | undefined
  is_vm?: boolean | undefined
  vm_info?: string | undefined
  os_ver?: string | undefined
  hostname?: string | undefined
  os_hostname?: string | undefined
  ip?: string | undefined
  ip_local?: string | undefined
  app_ver?: string | undefined
  sdk_ver?: string | undefined
  mac_address?: string | undefined
  include_expired_features?: boolean | 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" },
        "license_id": { "type": "number" },
        "is_vm": { "type": "boolean" },
        "vm_info": { "type": "string" },
        "os_ver": { "type": "string" },
        "hostname": { "type": "string" },
        "os_hostname": { "type": "string" },
        "ip": { "type": "string" },
        "ip_local": { "type": "string" },
        "app_ver": { "type": "string" },
        "sdk_ver": { "type": "string" },
        "mac_address": { "type": "string" },
        "include_expired_features": { "type": "boolean" }
      },
      "required": ["hardware_id", "product"],
      "additionalProperties": false
    }
  ]
}
```

</details>

<details>

<summary><strong>Response schema (TypeScript)</strong></summary>

**TypeScript**

```typescript
type LicenseCheckResponseBody = {
  id: number,
  allow_grace_period: boolean,
  allow_overages: boolean,
  allow_unlimited_activations: boolean,
  borrowed_until: string | null,
  can_borrow: boolean,
  channel: string,
  device_id: number,
  enable_maintenance_period: boolean
  environment: string,
  eula_link: string,
  floating_timeout: number,
  grace_period: number,
  hash_md5: string,
  installation_file: string,
  is_air_gapped: boolean,
  is_borrowed: boolean,
  is_expired: boolean,
  is_floating_cloud: boolean,
  is_floating: boolean,
  is_hardware_key_auth: boolean,
  license_active: boolean,
  license_enabled: boolean,
  license_signature: string,
  license_signature_v2: string,
  offline_signature: string,
  license_type: string,
  maintenance_period: string | null,
  max_activations: number,
  max_borrow_time: number,
  max_license_users: number,
  max_overages: number,
  max_transfers: number,
  order_store_id: string,
  prevent_vm: boolean,
  release_date: string,
  release_notes_link: string,
  requires_version: string,
  size: string,
  start_date: string | null,
  times_activated: number,
  transfer_count: number,
  validity_period: string | null,
  version: string,
  company: { id: number },
  
  product_features: ({
    id: number,
    code: string,
    name: string,
    expiry_date: string,
    metadata: JSON,
    feature_type: 'activation' | 'consumption',
    is_floating: boolean,
    is_floating_cloud: boolean,

    floating_users: number,
    floating_timeout: number,

    max_consumption: number,
    allow_unlimited_consumptions: boolean,
    total_consumptions: number,
    allow_overages: number,
    max_overages: number,
    reset_consumption: boolean,
    consumption_period: 'daily' | 'weekly' | 'monthly' | 'annualy' | null
  })[],
  
  custom_fields: ({
    name: string,
    data_type: 'numer' | 'text' | 'date/time',
    value: string,
  })[],
  
  customer: {
    email: string,
    company_name: string,
    reference: string,
    phone: string,
    first_name: string,
    last_name: string,
    city: string,
    postcode: string,
    state: string,
    country: string,
    address: string,
    customer_account: string | null,
    metadata: JSON,
  },
  
  product_details: {
    product_id: number,
    product_name: string,
    short_code: string,
    authorization_method: 'license-key' | 'user',
    metadata: JSON,
  },
  
  metadata: JSON,
  
  trial_days?: number,
  floating_in_use_devices?: number,
  floating_users?: number,
  max_consumptions?: number,
  total_consumptions?: number,
  allow_unlimited_consumptions?: boolean,
  reset_consumption?: boolean,
  consumption_period?: string | null

} & ({

  // for key-based licenses:
  license_key: string,

} | {

  // for user-based licenses:
  user: {
    id: number,
    email: string,
    first_name: string,
    last_name: string,
    phone_number: string,
    is_initial_password: boolean,
    max_activations: number,
    allow_unlimited_activations: boolean,
    total_activations: number
  }
});
```

</details>

### Response Signatures

The response object contains the following digital signatures:

* license\_signature: see the [Response Signature](/license-api/license-api-authorization/response-signature.md) article
* license\_signature\_v2: see the [Response Signature v2](/license-api/license-api-authorization/response-signature-v2.md) article
* offline\_signature: can be used for activating/deactivating using the offline method, see [Deactivate License (Offline Method)](/license-api/license-activation-and-deactivation/deactivate-license-offline-method.md)

### License Authorization Method

There are two authorization methods for products:

### Key-based product licenses

* Client provides license\_key in requests for key-based products.
* Response includes license\_key and product\_details.authorization\_method = "license\_key".

### User-based product licenses

* Client provides username in requests for user-based products.
* Response includes product\_details.authorization\_method = "user" and a user object with license user details.

### License Types

The license\_type property defines one of these types:

* perpetual
* time-limited
* subscription
* consumption

For more information see: [License Types](/license-entitlements/license-types.md)

### Errors

If an error occurs, HTTP status will be 400 or higher and the body will use this format:

<details>

<summary><strong>Error schema (TypeScript + JSON Schema)</strong></summary>

```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
}
```

</details>

#### 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
* license\_not\_enough\_consumptions (400): Not enough consumptions left
* floating\_not\_available (400): No available slots for floating license
* product\_version\_not\_supported (400): License product version does not support the app\_ver sent in the request


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
