# List Products

Returns a list of all products.

### Endpoint

* Method: `GET`
* Path: `/api/v4/products`
* Description: Returns a list of all products.

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

### Examples

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

```bash
curl --location --request GET '/api/v4/products' \
--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/products',
  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/products", 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/products"

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/products")

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

### Example responses

<details>

<summary>200 — Successful response (example)</summary>

```json
[
    {
        "created_at": "2023-07-15T10:23:15.000Z",
        "updated_at": "2024-05-20T10:19:32.000Z",
        "id": 1689416595016925,
        "product_name": "abc",
        "short_code": "def",
        "active": true,
        "valid_duration": "",
        "trial_days": 307,
        "max_activations": 1,
        "hardware_id_required": false,
        "is_upgrade": false,
        "company_id": 276,
        "allow_trial": true,
        "enable_maintenance_period": false,
        "floating_users": 0,
        "is_floating": false,
        "is_node_locked": true,
        "is_user_locked": false,
        "maintenance_duration": "",
        "subscription_duration": "",
        "default_license_type": "perpetual",
        "max_consumptions": 1,
        "authorization_method": "license-key",
        "prevent_vm": false,
        "allow_overages": false,
        "consumption_period": null,
        "max_overages": 0,
        "reset_consumption": false,
        "is_archived": false,
        "is_floating_cloud": false,
        "floating_timeout": 120,
        "is_bundle": false,
        "metadata": {
            "a": 1
        },
        "features": [
            {
                "id": 535,
                "code": "b",
                "feature_type": "consumption",
                "max_consumption": 1,
                "metadata": {
                    "a": "b",
                    "k": "m"
                }
            },
            {
                "id": 609,
                "code": "x",
                "feature_type": "consumption",
                "max_consumption": 1,
                "metadata": {}
            }
        ]
    }
]
```

</details>

<details>

<summary>404 — Error examples</summary>

```json
{
  "unknown_product": "Provided product code x was not found.",
  "missing_headers": "must have required property 'authorization'",
  "missing_parameters": "missing parameters"
}
```

</details>

### Schema

### Response Body

<details>

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

```typescript
type ListProductsResponseBody = ({
  active: boolean,
  allow_overages: boolean,
  allow_trial: boolean,
  authorization_method: 'license-key' | 'user',
  company_id: number,
  consumption_period: null,
  default_license_type: 'perpetual' | 'time-limited' | 'consumption' | 'subscription',
  enable_maintenance_period: boolean,
  floating_timeout: number,
  floating_users: number,
  hardware_id_required: boolean,
  id: number,
  is_archived: boolean,
  is_bundle: boolean,
  is_floating_cloud: boolean,
  is_floating: boolean,
  is_node_locked: boolean,
  is_upgrade: boolean,
  is_user_locked: boolean,
  maintenance_duration: string | null, // Length of time expressed in days, months or years, e.g. 5d, 2m, 3y
  max_activations: number,
  max_consumptions: number,
  max_overages: number,
  prevent_vm: boolean,
  product_name: string,
  reset_consumption: boolean,
  short_code: string,
  subscription_duration: string | null, // Length of time expressed in days, months or years, e.g. 5d, 2m, 3y
  trial_days: 0,
  valid_duration: string | null, // Date string in full ISO 8601 format, e.g. "2024-09-27T23:30:48.016Z"
  created_at: string,
  updated_at: string,
  metadata: JSON,
  features: [
    {
      id: number,
      code: string,
      feature_type: 'activation' | 'consumption',
      max_consumption: number,
      metadata: JSON
    }
  ]
})[];
```

</details>

### Errors

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

<details>

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

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

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


---

# 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/products/list-products.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.
