Skip to content
Oclavex is in private preview, open to existing MonetizeIt users. New users who would like to evaluate Oclavex before the public launch can request access at info@revenusion.com.

API quickstart

For developers who want the whole loop in code: from an empty account to a live license and a metered usage event, using only the REST API. Prefer clicking through the UI first? See the Admin path.

  • An API client with the right scopes (see Authentication & scopes). Every plan includes at least one (what each plan includes).
  • Your API base URL.
  • An Evaluation, Professional or Enterprise plan for steps 4, 11 and 12. Basic doesn’t include usage metering, so step 4 answers 403 there. On Basic, skip those three steps to run the rest of the loop.

Two different bearers appear below. Steps 1–10 carry the API token from step 1. Steps 11 and 12 are the licensed application talking about its own license, and carry the license token from step 10 instead — an API token is refused there.

  1. Get a token — POST /auth/connect/token (client-credentials grant). Ask for the scopes the later calls need: a token carries only the scopes the request asks for, capped to those registered on the credential.
  2. Create a product — POST /api/v1/provision/admin/products. It starts in Draft; when it’s ready for customers, publish it — PUT /api/v1/provision/admin/products/{productId}/status with the body { "status": "Published" }.
  3. Add a feature — POST /api/v1/provision/admin/products/{productId}/features with a feature code (by convention dotted).
  4. Meter it — POST /api/v1/provision/admin/products/{productId}/monitored-assets. A feature says what the license grants; a monitored asset is what usage counts against. Its metricName is the {metric} steps 11 and 12 address, so without one there is nothing for them to report to.
  5. Create an entitlement — POST /api/v1/provision/admin/entitlements.
  6. Decide who may activate it — POST /api/v1/provision/admin/entitlements/{entitlementId}/policies/activation. A new entitlement expects whoever activates to sign in with an identity provider, and an application holding only its own API credential cannot. Send { "requiredAuthenticationLevel": "Anonymous" } to make the activation code itself the credential — which is what an unattended install needs, and worth choosing deliberately, because it is the answer to “who may redeem this code”.
  7. Attach the product — POST /api/v1/provision/admin/entitlements/{entitlementId}/products/{productId}. An entitlement carries no product of its own, so this is the step that decides what the license grants. To sell a whole suite instead, attach that — POST /api/v1/provision/admin/entitlements/{entitlementId}/suites/{suiteId}.
  8. Publish the entitlement — POST /api/v1/provision/admin/entitlements/{entitlementId}/publish.
  9. Issue an activation code — POST /api/v1/provision/operational/entitlements/{entitlementId}/activation-codes.
  10. Activate a license — POST /api/v1/provision/activations/license with the code and a device fingerprint. On an Evaluation account the license carries the claim evaluation and lasts seven days, renewed on every activation or refresh; see Evaluation licenses. Keep the returned licenseToken: it is the bearer for the two calls below and names the session they act on. Its jti claim is that session’s id.
  11. Report usage — POST /api/v1/provision/usage/metrics/{metric}/consume with the body { "amount": 1 }. The response is the decision and the metric’s state after it.
  12. Read it back — GET /api/v1/provision/usage/sessions/{sessionId}/metrics/{metric}/usage, where {sessionId} is the token’s jti.

Example: the token, the activation policy and the bearer swap

Section titled “Example: the token, the activation policy and the bearer swap”

api.example.com stands in for your tenant endpoint — replace it with your own host.

Terminal window
# 1. Get a token. Without `scope` the token carries none, and step 2 is refused with 403.
curl -X POST https://api.example.com/auth/connect/token \
-d grant_type=client_credentials \
-d client_id=$ID -d client_secret=$SECRET \
-d scope="provision.product.* provision.entitlement.* provision.activation.*"
# 6. Let the activation code be the credential. Skip this and step 10 answers 401,
# asking whoever is activating to sign in first.
curl -X POST https://api.example.com/api/v1/provision/admin/entitlements/$ENTITLEMENT_ID/policies/activation \
-H "authorization: Bearer $TOKEN" \
-H "content-type: application/json" \
-d '{ "requiredAuthenticationLevel": "Anonymous" }'
# 10. Activate a license — still the API token.
curl -X POST https://api.example.com/api/v1/provision/activations/license \
-H "authorization: Bearer $TOKEN" \
-H "content-type: application/json" \
-d '{ "activationCode": "…", "fingerprint": "…" }'
# 11. Report usage — the license token from step 10, not the API token.
# It names the session; the path names only the metric.
curl -X POST "https://api.example.com/api/v1/provision/usage/metrics/$METRIC/consume" \
-H "authorization: Bearer $LICENSE_TOKEN" \
-H "content-type: application/json" \
-H "idempotency-key: $(uuidgen)" \
-d '{"amount":1}'

Full request and response schemas are in the REST API reference.