# How to programmatically get License Status

**URL:** <https://forum.cedalo.com/t/how-to-programmatically-get-license-status/672>\
**Category:** Mosquitto MQTT Broker\
**Created:** [December 2, 2022, 1:09am UTC](https://forum.cedalo.com/t/how-to-programmatically-get-license-status/672 "2022-12-02T01:09:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![trenna](https://avatars.discourse-cdn.com/v4/letter/t/c89c15/32.png) [@trenna](https://forum.cedalo.com/u/trenna)\
**Post date:** [December 2, 2022, 1:09am UTC](https://forum.cedalo.com/t/how-to-programmatically-get-license-status/672/1 "2022-12-02T01:09:52Z")

</div>

Hello,

Is there any way to get the License status programmatically?  
I would like to build an element manager that can display the license status / warn if the license is expired / nearing expiration.

I see the license status in the logs, but really don’t want to have to scrape the log.  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![roger.light](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@roger.light](https://forum.cedalo.com/u/roger.light)\
**Post date:** [December 2, 2022, 10:28am UTC](https://forum.cedalo.com/t/how-to-programmatically-get-license-status/672/2 "2022-12-02T10:28:26Z")

</div>

Mosquitto has an MQTT API which can do this. You publish a message to `$CONTROL/cedalo/license/v1`, having already subscribed to receive the reply on `$CONTROL/cedalo/license/v1/response`. The message should be:

```auto
{"commands":[{"command":"getLicenseInformation"}]}

```

You can do this with the `mosquitto_rr` command like this:

```auto
mosquitto_rr -p 8883 -h <host> -u <user> -P <password> -t '$CONTROL/cedalo/license/v1' -e '$CONTROL/cedalo/license/v1/response' -m '{"commands":[{"command":"getLicenseInformation"}]}'

```

This will give you a response like this:

```auto
{"responses":[{"command":"getLicenseInformation","data":"<license info>"}]}

```

There is also a REST API provided by the Management Center, one of my colleagues will provide the details on that. On our hosted instances the license is identical in both cases, so you can choose which option suits you best.

Regards,

Roger

---

<div class="post-metadata">

**Author:** ![sey](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@sey](https://forum.cedalo.com/u/sey)\
**Post date:** [December 2, 2022, 10:40am UTC](https://forum.cedalo.com/t/how-to-programmatically-get-license-status/672/3 "2022-12-02T10:40:11Z")

</div>

Hello,

As mentioned by Roger if you are using Mosquitto Management Center, you can send a GET HTTP request to `/api/license` endpoint and you will receive complete license information like this:

```auto
{
	"edition": "pro",
	"issuedBy": "Cedalo",
	"issuedTo": "someuser",
	"maxInstallations": -1,
	"maxBrokerConnections": 10,
	"validSince": 1660120329000,
	"validUntil": 1688169599000,
	"comment": "This is a test license",
	"features": [
		{
			"name": "inspect-clients",
			"version": "1.0",
			"validSince": 1660120329,
			"validUntil": 1688169599
		},
		{
			"name": "mosquitto-clients",
			"version": "2",
			"count": 10000000,
			"validSince": 1660120329,
			"validUntil": 1688169599
		},
		{
			"name": "tls",
			"version": "1.0",
			"validSince": 1660120329000,
			"validUntil": 1688169599000
		},
		{
			"name": "cluster-management",
			"version": "1.0",
			"validSince": 1660120329000,
			"validUntil": 1688169599000
		}
        ]
	"serial": "..."
}

```

Note that to file a request, you need to first be logged in into the MMC.  
Check the [official documentation](https://docs.cedalo.com/management-center/2.4/mc-restapi) and [OS github repo](https://github.com/cedalo/management-center)

Regards,  
Sergey
