Licenses Examples

Note: The /licenses endpoint does not override standard license configuration.

The /licenses endpoint provides a way to configure your Kong Gateway without using environment variables or placing a plaintext file in your system directories. In a hybrid mode deployment, the Admin API /licenses endpoint also configures all data planes in the cluster, simplifying the configuration process.

Prerequisites

Remove all standard license configurations from traditional deployments, control planes, and data planes.

If you deploy a license using environmental variables or a plaintext file, this configuration takes precedence over the /licenses endpoint and does not communicate any changes to the Admin API. If you try to use the /licenses endpoint while having a license configured in some other way, the new license will not apply.

List all licenses

Submit the following request:

  1. http GET :8001/licenses

Response when license exists

Response if there is no license

  1. {
  2. "data": [
  3. {
  4. "payload": "{\"license\":{\"payload\":{\"admin_seats\":\"1\",\"customer\":\"Example Company, Inc\",\"dataplanes\":\"1\",\"license_creation_date\":\"2017-07-20\",\"license_expiration_date\":\"2017-07-20\",\"license_key\":\"00141000017ODj3AAG_a1V41000004wT0OEAU\",\"product_subscription\":\"Konnect Enterprise\",\"support_plan\":\"None\"},\"signature\":\"6985968131533a967fcc721244a979948b1066967f1e9cd65dbd8eeabe060fc32d894a2945f5e4a03c1cd2198c74e058ac63d28b045c2f1fcec95877bd790e1b\",\"version\":\"1\"}}",
  5. "created_at": 1500508800,
  6. "id": "30b4edb7-0847-4f65-af90-efbed8b0161f",
  7. "updated_at": 1500508800
  8. },
  9. ],
  10. "next": null,
  11. }
  1. {
  2. "data": [],
  3. "next": null
  4. }

List a license

Using the ID of the license, submit the following request:

  1. http GET :8001/licenses/30b4edb7-0847-4f65-af90-efbed8b0161f
  1. {
  2. "created_at": 1500508800,
  3. "id": "30b4edb7-0847-4f65-af90-efbed8b0161f",
  4. "payload": "{\"license\":{\"payload\":{\"admin_seats\":\"1\",\"customer\":\"Example Company, Inc\",\"dataplanes\":\"1\",\"license_creation_date\":\"2017-07-20\",\"license_expiration_date\":\"2017-07-20\",\"license_key\":\"00141000017ODj3AAG_a1V41000004wT0OEAU\",\"product_subscription\":\"Konnect Enterprise\",\"support_plan\":\"None\"},\"signature\":\"6985968131533a967fcc721244a979948b1066967f1e9cd65dbd8eeabe060fc32d894a2945f5e4a03c1cd2198c74e058ac63d28b045c2f1fcec95877bd790e1b\",\"version\":\"1\"}}",
  5. "updated_at": 1500508800
  6. }

Add a license

Auto-generated ID

To generate an ID automatically, submit a POST request directly to /licenses:

  1. http POST :8001/licenses \
  2. payload='{"license":{"payload":{"admin_seats":"1","customer":"Example Company, Inc","dataplanes":"1","license_creation_date":"2017-07-20","license_expiration_date":"2017-07-20","license_key":"00141000017ODj3AAG_a1V41000004wT0OEAU","product_subscription":"Konnect Enterprise","support_plan":"None"},"signature":"6985968131533a967fcc721244a979948b1066967f1e9cd65dbd8eeabe060fc32d894a2945f5e4a03c1cd2198c74e058ac63d28b045c2f1fcec95877bd790e1b","version":"1"}}'

Response:

  1. {
  2. "created_at": 1500508800,
  3. "id": "30b4edb7-0847-4f65-af90-efbed8b0161f",
  4. "payload": "{\"license\":{\"payload\":{\"admin_seats\":\"1\",\"customer\":\"Example Company, Inc\",\"dataplanes\":\"1\",\"license_creation_date\":\"2017-07-20\",\"license_expiration_date\":\"2017-07-20\",\"license_key\":\"00141000017ODj3AAG_a1V41000004wT0OEAU\",\"product_subscription\":\"Konnect Enterprise\",\"support_plan\":\"None\"},\"signature\":\"6985968131533a967fcc721244a979948b1066967f1e9cd65dbd8eeabe060fc32d894a2945f5e4a03c1cd2198c74e058ac63d28b045c2f1fcec95877bd790e1b\",\"version\":\"1\"}}",
  5. "updated_at": 1500508800
  6. }

Manually provided ID

To create a license with a custom ID, submit a PUT request to /licenses/<uuid>:

  1. http PUT :8001/licenses/e8201120-4ee3-43ca-9e92-3fed08b1a15d \
  2. payload='{"license":{"payload":{"admin_seats":"1","customer":"Example Company, Inc","dataplanes":"1","license_creation_date":"2017-07-20","license_expiration_date":"2017-07-20","license_key":"00141000017ODj3AAG_a1V41000004wT0OEAU","product_subscription":"Konnect Enterprise","support_plan":"None"},"signature":"6985968131533a967fcc721244a979948b1066967f1e9cd65dbd8eeabe060fc32d894a2945f5e4a03c1cd2198c74e058ac63d28b045c2f1fcec95877bd790e1b","version":"1"}}'

Response:

  1. {
  2. "created_at": 1500508800,
  3. "id": "e8201120-4ee3-43ca-9e92-3fed08b1a15d",
  4. "payload": "{\"license\":{\"payload\":{\"admin_seats\":\"1\",\"customer\":\"Example Company, Inc\",\"dataplanes\":\"1\",\"license_creation_date\":\"2017-07-20\",\"license_expiration_date\":\"2017-07-20\",\"license_key\":\"00141000017ODj3AAG_a1V41000004wT0OEAU\",\"product_subscription\":\"Konnect Enterprise\",\"support_plan\":\"None\"},\"signature\":\"6985968131533a967fcc721244a979948b1066967f1e9cd65dbd8eeabe060fc32d894a2945f5e4a03c1cd2198c74e058ac63d28b045c2f1fcec95877bd790e1b\",\"version\":\"1\"}}",
  5. "updated_at": 1500508800
  6. }

Note: If the provided ID exists, the request will perform an update to the license for the given ID instead of creating a new license entity.

Update a license

To update a license, submit a PATCH request to an existing license ID:

  1. http PATCH :8001/licenses/30b4edb7-0847-4f65-af90-efbed8b0161f \
  2. payload='{"license":{"payload":{"admin_seats":"1","customer":"Example Company, Inc","dataplanes":"1","license_creation_date":"2017-07-20","license_expiration_date":"2017-07-21","license_key":"00141000017ODj3AAG_a1V41000004wT0OEAU","product_subscription":"Konnect Enterprise","support_plan":"None"},"signature":"24cc21223633044c15c300be19cacc26ccc5aca0dd9a12df8a7324a1970fe304bc07b8dcd7fb08d7b92e04169313377ae3b550ead653b951bc44cd2eb59f6beb","version":"1"}}'

Response:

  1. {
  2. "created_at": 1500595200,
  3. "id": "30b4edb7-0847-4f65-af90-efbed8b0161f",
  4. "payload": "{\"license\":{\"payload\":{\"admin_seats\":\"1\",\"customer\":\"Example Company, Inc\",\"dataplanes\":\"1\",\"license_creation_date\":\"2017-07-20\",\"license_expiration_date\":\"2017-07-21\",\"license_key\":\"00141000017ODj3AAG_a1V41000004wT0OEAU\",\"product_subscription\":\"Konnect Enterprise\",\"support_plan\":\"None\"},\"signature\":\"24cc21223633044c15c300be19cacc26ccc5aca0dd9a12df8a7324a1970fe304bc07b8dcd7fb08d7b92e04169313377ae3b550ead653b951bc44cd2eb59f6beb\",\"version\":\"1\"}}",
  5. "updated_at": 1500595200
  6. }

Generate license report

To generate a report, submit a GET request directly to /license/report:

  1. http GET :8001/license/report

Response when license exists

Response if there is no license

  1. {
  2. "counters": [
  3. {
  4. "bucket": "2021-12",
  5. "request_count": 0
  6. }
  7. ],
  8. "db_version": "postgres 9.6.19",
  9. "kong_version": "2.7.0.0",
  10. "license_key": "ASDASDASDASDASDASDASDASDASD_ASDASDA",
  11. "rbac_users": 0,
  12. "services_count": 0,
  13. "system_info": {
  14. "cores": 4,
  15. "hostname": "13b867agsa008",
  16. "uname": "Linux x86_64"
  17. },
  18. "workspaces_count": 1
  19. }
  1. {
  2. "counters": [
  3. {
  4. "bucket": "2021-12",
  5. "request_count": 0
  6. }
  7. ],
  8. "db_version": "postgres 9.6.19",
  9. "kong_version": "2.7.0.0",
  10. "license_key": "UNLICENSED",
  11. "rbac_users": 0,
  12. "services_count": 0,
  13. "system_info": {
  14. "cores": 4,
  15. "hostname": "13b867agsa008",
  16. "uname": "Linux x86_64"
  17. },
  18. "workspaces_count": 1
  19. }