For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.

Manage License Keys Through the API

Use the Ops Manager API to check the license key status of your Ops Manager installation and to install or release a license key. To learn how Ops Manager calculates license key status, see Ops Manager License Keys Overview. To manage license keys in the Ops Manager interface, see Manage License Keys in Ops Manager.

Before you begin, ensure that you have the following:

Use the following procedure to install a license key and confirm that Ops Manager applies it.

1

Send a GET request to the /admin/licenses endpoint:

curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --header "Accept: application/json" \ --include \ --request GET \ "https://<OpsManagerHost>:<Port>/api/public/v1.0/admin/licenses?pretty=true"

The response includes the enforcement.effectiveState field and the licenses array. For a description of each field, see Get the License Key Status of an Installation.

2

Send a PUT request to the /admin/licenses endpoint. Use the contents of your license key file as the request body:

curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --include \ --request PUT \ "https://<OpsManagerHost>:<Port>/api/public/v1.0/admin/licenses?pretty=true" \ --data @{LICENSE-KEY-FILE}

If Ops Manager accepts the license key, Ops Manager recalculates the status and returns it. If Ops Manager rejects the license key, the response contains an error. To resolve an error, see Troubleshoot Install Errors.

3

In the response from the previous step, check the following fields:

  • enforcement.effectiveState is LICENSED.

  • The new license key appears in the licenses array with a status of ACTIVE.

If the state is not what you expect, call the Recompute the License Key Status on Demand endpoint to recalculate the status, and then check the fields again.

Use the following procedure to release a license key from your Ops Manager installation.

Important

After you release a license key, you can't use it again. If you release the only usable license key, your installation has no coverage. The state changes to GRACE, and then to UNLICENSED after 90 days.

1

Send a GET request to the /admin/licenses endpoint. In the response, copy the artifactId value of the license key that you want to release.

2

Send a DELETE request to the /admin/licenses/{artifactId} endpoint. Replace {ARTIFACT-ID} with the artifactId value:

curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --header "Accept: application/json" \ --include \ --request DELETE \ "https://<OpsManagerHost>:<Port>/api/public/v1.0/admin/licenses/{ARTIFACT-ID}?pretty=true"

Ops Manager recalculates the status and returns it. To learn more, see Release a License Key from Ops Manager.

The Key Manager ID identifies your Ops Manager installation, including every instance in a high-availability setup. The API returns the Key Manager ID in the holderId field. To retrieve it, send a GET request to the /admin/artifacts/identity endpoint. To learn more, see Get the Key Manager ID of an Installation.

Your Ops Manager installation generates an identity key: a key pair that the installation uses to prove its identity when it connects to MongoDB. If you suspect that someone outside your organization obtained the private key, rotate the key to replace it with a new key pair. Your installation must be able to connect to MongoDB to rotate the key. To learn more, see Rotate the Identity Key of an Installation.

When Ops Manager rejects a license key, the response has an HTTP status of 400, 403, or 409 and a JSON body that describes the error. The following fields identify the error:

Field
Description

errorCode

Error code, such as ARTIFACT_OUTDATED.

detail

Message that describes the error and how to proceed.

For the list of error codes, HTTP statuses, and messages, see Troubleshoot Install Errors.

For more information about license keys, see the following pages: