Licensing API Reference
Do you have a specific scenario you need to support or other questions?
Reach out to us through the support channel, or at developers@moonbase.sh.
Authentication
The licensing endpoints documented below are made to be called from the apps you create, with the customer initiating any actions.
Therefore, most of the endpoints are publicly available, only some requiring authentication in the form of JWT tokens.
These JWT tokens can be obtained by authenticating the user through /api/customer/identity/sign-in, and the tokens refreshed by handing them in through /api/customer/identity/refresh.
Rate limits
Licensing API requests are rate limited per IP address, with limits sized for one customer using your app. Since your apps call these endpoints from each customer's own device, this is rarely a concern. When a limit is exceeded, the API responds with 429: Too Many Requests and a Retry-After header telling you how many seconds to wait.
Calling from your own server
If your server calls these endpoints on behalf of your customers, for example to validate their license tokens, they all reach Moonbase from your server's IP address and share the limits of one customer.
To avoid this, include one of your API keys in an Api-Key header. Requests with a valid API key are not limited by IP address, and have these limits instead:
| Endpoints | Limit |
|---|---|
| All endpoints | 500 requests per minute |
| Sign up | 300 requests per 5 minutes |
| Sign in and other identity endpoints | 1,000 requests per 5 minutes |
Password reset requests are limited further.
- The API key does not sign anyone in. Endpoints that need a signed-in customer still need their access token.
- An invalid or deleted API key is rejected with
401: Unauthorizedon every endpoint, even those that need no key. - Never include an API key in an app you distribute. Anyone can extract it and use it with the Core API. Any valid key works here, including a restricted one, so your server can use a key with no more access than it needs.
Server-side request
POST https://demo.moonbase.sh/api/client/licenses/demo-app/validate
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: text/plain
eyJhbGciOiJSUzI1NiIsInR5c...
429 response
HTTP/1.1 429 Too Many Requests
Retry-After: 60
Sign in a customer
This endpoint allows you to sign in a customer given a combination of email address and password. The JWT returned contains an access token with a default lifetime of 15 minutes. Refresh tokens can be used to get new access tokens.
Required query parameters
- Name
email- Type
- string
- Description
The email of the customer.
Required body content
The password of the customer.
Request
POST https://demo.moonbase.sh/api/customer/identity/sign-in?email=test@example.com
Content-Type: text/plain
Password1234!
Response
{
"id": "e891f4b0-6d73-48ed-8fc1-c6b166c5379a",
"name": "Example User",
"email": "user@example.com",
"tenantId": "demo",
"userType": "Customer",
"accessToken": "eyJhbGciOiJIUzUxMiIsInR5c...",
"refreshToken": "MDAxNDhiZGUtMzY1Yi00MTYx..."
}
Refresh a token
This endpoint allows you to exchange a refresh token + access token for a new pair of tokens.
Required query parameters
- Name
token- Type
- string
- Description
The refresh token you got during the last refresh or sign-in if first time refreshing.
Required body content
The access token belonging to the refresh token.
Request
POST https://demo.moonbase.sh/api/customer/identity/refresh?token=MDAxNDhiZGUtMzY1Yi00MTYx...
Content-Type: text/plain
eyJhbGciOiJIUzUxMiIsInR5c...
Response
{
"id": "e891f4b0-6d73-48ed-8fc1-c6b166c5379a",
"name": "Example User",
"email": "user@example.com",
"tenantId": "demo",
"userType": "Customer",
"accessToken": "eyJhbGciOiJIUzUxMiIsInR5c...",
"refreshToken": "MDAxNDhiZGUtMzY1Yi00MTYx..."
}
Sign up
This endpoint allows you to sign up a new customer on your account. Useful if you require accounts to start trials.
If you turn on Captcha under Account settings > Storefront > Features, a sign-up from an app is refused with 400: Bad Request and an errorType of CaptchaRequired, since the app can't show one. Send customers to your store's sign-up page instead, or see Sign up in the Storefront API to draw the captcha yourself.
Required body properties
- Name
name- Type
- string
- Description
Full name of the user.
- Name
email- Type
- string
- Description
Email address of the user. Will be used as username. Can be changed by the user.
- Name
password- Type
- string
- Description
The initial password for the user. Must contain lower case characters, uppercase characters, numbers and a symbol.
Optional body properties
- Name
address- Type
- object
- Description
A billing address for the user. Will be used when purchasing new products.
Contains the following properties:- Name
countryCode- Type
- string
- Description
ISO 3166-1 alpha-2 two-letter country code.
- Name
streetAddress1- Type
- string
- Description
First line of the regular street address.
- Name
streetAddress2- Type
- string
- Optionality
- optional
- Description
Second line of the regular street address.
- Name
postCode- Type
- string
- Description
Postal code of the address.
- Name
locality- Type
- string
- Description
Locality of the address, only required if no region is given.
Also known asCity.
- Name
region- Type
- string
- Description
Region of the address, only required if no locality is given.
Also known asState.
Request
POST https://demo.moonbase.sh/api/customer/identity/sign-up
Content-Type: application/json
{
"name": "Example User",
"email": "user@example.com",
"password": "Password1234!",
"address": {
"countryCode": "NO",
"streetAddress1": "Slottsplassen 1",
"streetAddress2": null,
"postCode": "0010",
"region": "Oslo",
"locality": null
}
}
Response
{
"id": "e891f4b0-6d73-48ed-8fc1-c6b166c5379a",
"name": "Example User",
"email": "user@example.com",
"tenantId": "demo",
"userType": "Customer",
"accessToken": "eyJhbGciOiJIUzUxMiIsInR5c...",
"refreshToken": "MDAxNDhiZGUtMzY1Yi00MTYx..."
}
Licensing
License tokens generated by Moonbase are generated as JWT tokens. These tokens are signed with your account's private key, while you ship the public key with your apps. Part of the metadata in these tokens allow you to verify that the token is for the device it's being activated on. If you are using frameworks or languages that don't have easy ways to deserialize and validate JWTs, reach out to us through support to investigate alternatives.
License token claims
- Name
id- Type
- string
- Description
Identifier of this unique license activation.
- Name
exp- Type
- number
- Optionality
- optional
- Description
Expiration date and time for this license token. You should have a check that this time is still in the future when validating the license. Only present on licenses and trials that expire, which includes any license attached to a subscription or sold to expire after a period. Perpetual licenses carry none, and neither do endless trials (trials of a product whose trials never expire). This is following the JWT standard and is defined in seconds since epoch.
- Name
iat- Type
- number
- Description
Date and time at which this license or trial was created. This is following the JWT standard and is defined in seconds since epoch.
- Name
nbf- Type
- number
- Description
Date and time at which this token becomes valid. Will always be the same as the
iatclaim. This is following the JWT standard and is defined in seconds since epoch.
- Name
iss- Type
- string
- Description
Issuer of the license, will be the ID of your Moonbase account, for example
acme-co.
- Name
aud- Type
- string
- Description
Audience of the license, will be the ID of the product the license is issued for, same as the
p:idclaim.
- Name
u:id- Type
- string
- Description
Identifier of the user that owns this license. If the user is anonymous, this ID will be an empty GUID (
00000000-0000-0000-0000-000000000000).
- Name
u:name- Type
- string
- Description
The name of the user that owns this license. If the user is anonymous, this will say
anonymous.
- Name
u:email- Type
- string
- Description
The email of the user that owns this license. If the user is anonymous, this will say
anonymous.
- Name
l:id- Type
- string
- Description
The ID of the license that activated this license token. One license may have multiple tokens active depending on seat configuration of the product.
- Name
l:variation- Type
- string
- Optionality
- optional
- Description
The ID of the pricing variation the license was issued for, so your app can tell editions apart. Omitted on trials and on licenses without a recorded variation, such as older ones.
@moonbase.sh/licensingreads it aslicense.variationId, and the .NET SDK asLicense.VariationId.
- Name
p:id- Type
- string
- Description
The ID of the product this license is for, same as the
audclaim. You should have a check that this is the same as the current product the user is activating.
- Name
p:name- Type
- string
- Description
The name of the product this license is for.
- Name
p:rel- Type
- string
- Optionality
- optional
- Description
The current release version of the product. If there is no current release for the product, this claim will not be included. Offline tokens never include it.
- Name
p:seats:total- Type
- number
- Optionality
- optional
- Description
The number of seats across all of the customer's licenses for this product. Along with
p:seats:usedandp:seats:remaining, which count the seats taken and still free. Only online license tokens include these claims, not trials or offline tokens.
- Name
sp:owned- Type
- string
- Optionality
- optional
- Description
In case the user of this license owns any sub-products (add-ons) of this product, this claim will have a comma-separated list of their IDs, without the main product's part. It lists every add-on the customer owns, whether or not it is included in this license, and says nothing about whether it may be used on this device. If there are no sub-products owned, this claim will not be included.
- Name
sp- Type
- array
- Optionality
- optional
- Description
The add-ons included in this product's license that the customer owns or trials, one object each. Only present when there is at least one, and never on trial tokens.
- Name
id- Type
- string
- Description
The add-on's own part of its product ID:
preset-packfordemo-app.preset-pack.
- Name
active- Type
- boolean
- Description
Whether the add-on may be unlocked on this device: the device holds a seat of it, or its trial hasn't ended. An add-on the customer owns, but with every seat taken on other devices, is listed with
false.
- Name
trial- Type
- boolean
- Description
Whether a trial backs the add-on, rather than a license the customer owns.
- Name
revoked- Type
- boolean
- Optionality
- optional
- Description
Present as
truewhen the add-on's seat on this device was revoked, by the customer or by you. Validating doesn't take the seat back: your app has to activate the add-on again.
- Name
exp- Type
- number
- Optionality
- optional
- Description
When the add-on's license or trial ends, in seconds since epoch. Check that it's still in the future before unlocking the add-on, especially on offline tokens.
- Name
seats- Type
- object
- Optionality
- optional
- Description
The add-on's seats across the customer's licenses for it, as
total,usedandremaining. Not on trials or offline tokens.
- Name
s:id- Type
- string
- Optionality
- optional
- Description
The ID of the subscription this license belongs to, if any. If this is a perpetual license, this claim will not be included.
- Name
l:rel:until- Type
- number
- Optionality
- optional
- Description
For a license that covers only some releases: releases published until this time are covered, and every version while it hasn't passed. Defined in seconds since epoch. Unlike
exp, the license keeps working after it for the versions it covers.
- Name
l:rel:major- Type
- number
- Optionality
- optional
- Description
For a license that covers only some releases: every version whose major version is at most this is covered.
- Name
l:rel:upto- Type
- string
- Optionality
- optional
- Description
For a license whose updates have ended, the last version published before
l:rel:until(MAJOR.MINOR.PATCH), which is covered along with every older version. Only in tokens issued afterl:rel:untilhas passed.
- Name
method- Type
- enum(Online|Offline)
- Description
The activation method used for activating this license token. Based on this you can determine if re-validations of the license should take place.
- Name
revocable- Type
- boolean
- Optionality
- optional
- Description
Whether the customer may revoke this device's activation, from your app or their account. Offer a Deactivate action only when it is
true. It isfalsefor trials, offline activations, and every activation of a product where you turned on Prevent customers from revoking activations in its licensing settings. Tokens issued before Moonbase added the claim don't have it: treat those as revocable unless they are trials or offline.
- Name
sig- Type
- string
- Description
The signature of the device being activated, that was passed in when requesting the license token initially. You should have a check that this signature is the same as the device the user is activating.
- Name
validated- Type
- number
- Description
Date and time of the last time this license token was validated online. You should have a check that this date is not too old for your given re-validation frequency. Similarly to
expandiat, this claim is also defined in seconds since epoch.
- Name
trial- Type
- boolean
- Description
Flag for if this license token represents a trial, or a owned license. For compatability reasons, this value may be presented as a string and not a strict boolean value. Your parsing should handle both.
- Name
vendor- Type
- string
- Description
The name of your Moonbase merchant account.
- Name
p:properties- Type
- object
- Optionality
- optional
- Description
Custom properties from the product, where
includeInTokenis set totrue. Values are flattened to key-value pairs without the type wrapper.
- Name
u:properties- Type
- object
- Optionality
- optional
- Description
Custom properties from the customer (user), where
includeInTokenis set totrue. Values are flattened to key-value pairs without the type wrapper.
- Name
l:properties- Type
- object
- Optionality
- optional
- Description
Custom properties from the license, where
includeInTokenis set totrue. Values are flattened to key-value pairs without the type wrapper.
- Name
t:properties- Type
- object
- Optionality
- optional
- Description
Custom properties from the trial, where
includeInTokenis set totrue. Only present on trial tokens. Values are flattened to key-value pairs without the type wrapper.
License token
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjdhMzg4ZjZiZGE1MTY0NjFmYzcwMzQ2ZDM2ZThlMTI3IiwidmVuZG9yIjoiRGVtbyBDby4iLCJ1OmlkIjoiMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwIiwidTpuYW1lIjoiYW5vbnltb3VzIiwidTplbWFpbCI6ImFub255bW91cyIsImw6aWQiOiI3YTM4OGY2YmRhNTE2NDYxZmM3MDM0NmQzNmU4ZTEyNyIsInA6aWQiOiJkZW1vLWFwcCIsInA6bmFtZSI6IkRlbW8gQXBwIiwicDpyZWwiOiIxLjAuMCIsIm1ldGhvZCI6Ik9ubGluZSIsInNpZyI6InhMVEkzVkRFeU9qZGRkRTJPakE1TGpZMU5UVXlOVE5hSWl3aWRISnBZV3dpT2lKMGNuVmxJaXdpWVhWa0kiLCJ2ZXIiOiIyMDI1LTAxLTA4VDEyOjE1OjI3Ljg0OTYyNDJaIiwidmFsaWRhdGVkIjoxNzM2MzM4NTI3LCJ0cmlhbCI6InRydWUiLCJhdWQiOiJkZW1vLWFwcCIsImlzcyI6ImRlbW8iLCJleHAiOjE3Mzc1NDgxMjcsImlhdCI6MTczNjMzODUyNywibmJmIjoxNzM2MzM4NTI3fQ.UgQwC4KNhPofTvqwn0LkUhtYlk0PnYUBHFm_-cgLH8BuTj0gcVAJFuAWnjTP4pCtXTBN1l_a6zXePoHzZdNFN7DOkBmd5VbiFdLpNJUTrnRT-2Vzn6EC5wrrJxAKtBZb22uOarL2TZCvInDGdTqiQVjIwhFMK9em8PBOuGQ_U3-mfGWnp8dzo02rcDqxTtOTWTu8tPXt9GOYjqmr7myWH0bIdfswCd35VEeLS2n6FRBBOeUZY-DZHCL0feJvOouXXux2BVBZM8AjAPGqfnMi6UyNCI3vrTZgJ21N0kKJKx01NteC5y3qARXpNQ8_rGm5VzmZ3NoRq792_pazLytZIQ
Deserialized token
{
"id": "cef3e37be338acabd5da04105099025c",
"vendor": "Demo Co.",
"u:id": "00000000-0000-0000-0000-000000000000",
"u:name": "anonymous",
"u:email": "anonymous",
"l:id": "cef3e37be338acabd5da04105099025c",
"p:id": "demo-app",
"p:name": "Demo App",
"p:rel": "1.0.0",
"p:properties": {
"category": "Audio Tools"
},
"l:properties": {
"seat_name": "Studio A"
},
"method": "Online",
"revocable": false,
"sig": "xLTI3VDEyOjE2OjA5LjY1NTUyNTNaIiwidHJpYWwiOiJ0cnVlIiwiYXVkI",
"trial": "true",
"aud": "demo-app",
"iss": "demo",
"validated": 1736338527,
"exp": 1737548127,
"iat": 1736338527,
"nbf": 1736338527
}
Add-on and release access claims
{
...
"trial": "false",
"l:rel:until": 1767225600,
"sp:owned": "preset-pack,brass",
"sp": [
{
"id": "preset-pack",
"active": true,
"trial": false,
"seats": { "total": 2, "used": 1, "remaining": 1 }
},
{
"id": "drums",
"active": true,
"trial": true,
"exp": 1737548127
}
],
...
}
Licenses that cover some versions
Licenses that cover only some releases are in beta, and are switched on account by account. Reach out to support if you'd like to sell them.
A perpetual license can cover only some versions of your app, such as 12 months of updates or every version up to 2.x, as described in core concepts.
The license itself doesn't expire because of it: it keeps working for the versions it covers.
Its token says what it covers with the l:rel:until, l:rel:major and l:rel:upto claims, and a version is covered when any of these holds:
- The token has neither
l:rel:untilnorl:rel:major, so it covers every version. - The version's major is at most
l:rel:major. l:rel:untilhasn't passed yet.l:rel:untilhas passed, and the version is at mostl:rel:upto. Withoutl:rel:upto, every version is covered.
Versions are read leniently: a leading v, a fourth number and any -beta or +build suffix are ignored, so v3.0.0-beta.2 counts as 3.0.0.
A version that can't be read isn't checked.
Send your app's version as the appVersion query parameter, and Moonbase checks it when the app requests or validates a license.
For a version the license doesn't cover, it responds with 400: Bad Request and an errorType of ReleaseNotCovered, along with what the license covers and an upgradeUrl where the customer can buy the upgrade, when you sell one.
Validating also sends the license along as a fresh license token: keep it, since it still covers the versions it did.
When another of the customer's licenses covers the version, validating moves the device to that license instead, and responds with its token as usual.
With browser activation, the customer is offered the upgrade in the browser instead.
An offline license is checked only on the device, so your app has to check its version against these claims itself. The Node.js and .NET SDKs do this for you, online and offline.
ReleaseNotCovered response
{
"title": "Version not covered",
"status": 400,
"detail": "The license doesn't cover version 3.0.0",
"errorType": "ReleaseNotCovered",
"appVersion": "3.0.0",
"releaseAccess": {
"updatesUntil": "2026-03-12T00:00:00Z",
"upToVersion": "2.4.1"
},
"upgradeUrl": "https://demo.moonbase.sh/buy/demo-app?variation=v802c5&license=f3da2c9a-d7a0-4aa9-a4b5-00786ae5fc98",
"license": "eyJhbGciOiJSUzI1NiIsInR5c..."
}
Request a trial license token
This endpoint allows you to request a trial license token for the current device.
If you have an authenticated customer, you may attach the access token in the Authorization header to authenticate the call.
Will return a HTTP 401: Unauthorized if the product requires account to activate trial and you do not have an authenticated customer.
A trial you restart in Moonbase starts over the next time its device requests a trial or validates its token, even if it had ended. The response is the same trial, with a whole trial period from that day.
Optional query parameters
Send utm_source, utm_medium, utm_campaign, utm_term, utm_content, utm_referrer, utm_id and supported ad click IDs when the app knows the marketing the trial came from, for example from the link used to download its installer. Send only tracking your integration has kept under the visitor's choice. Without these tags, trial attribution falls back to how its customer first arrived. The Core trial model exposes the recorded attribution.
Required body properties
- Name
deviceName- Type
- string
- Description
The name of the device being activated. Will be shown in the customer portal in case the customer wants to revoke this license activation.
- Name
deviceSignature- Type
- string
- Description
A fingerprint of the current device that will not change. Should be used when validating future license tokens, that they have indeed been issued for the current device.
Request
POST https://demo.moonbase.sh/api/client/trials/demo-app/request
Content-Type: application/json
{
"deviceName": "Example Device Name",
"deviceSignature": "xLTI3VDEyOjE2OjA5LjY1NTUyNTNaIiwidHJpYWwiOiJ0cnVlIiwiYXVkI"
}
Response
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNlZjNlMzdiZTMzOGFjYWJkNWRhMDQxMDUwOTkwMjVjIiwidmVuZG9yIjoiRGVtbyBDby4iLCJ1OmlkIjoiMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwIiwidTpuYW1lIjoiYW5vbnltb3VzIiwidTplbWFpbCI6ImFub255bW91cyIsImw6aWQiOiJjZWYzZTM3YmUzMzhhY2FiZDVkYTA0MTA1MDk5MDI1YyIsInA6aWQiOiJkZW1vLWFwcCIsInA6bmFtZSI6IkRlbW8gQXBwIiwibWV0aG9kIjoiT25saW5lIiwic2lnIjoieExUSTNWREV5T2pFMk9qQTVMalkxTlRVeU5UTmFJaXdpZEhKcFlXd2lPaUowY25WbElpd2lZWFZrSSIsInZlciI6IjIwMjQtMDEtMjdUMTI6MjU6NTcuNTc4MDkwNloiLCJ0cmlhbCI6InRydWUiLCJhdWQiOiJkZW1vLWFwcCIsImV4cCI6MTcwNzU2Nzk1NywiaXNzIjoiZGVtbyIsImlhdCI6MTcwNjM1ODM1NywibmJmIjoxNzA2MzU4MzU3fQ.cze2gijLNTi9IxcgqpKUMk8Eq90dlG0UOvXVlfAwdeDJ-VCLlK3GIHg23t5BzsQjGBJM0GU6mFV-IXrdIdu8ibFdiEpCIqDS880EoEZfRLyKjzOI2n8heBPNWsdLxGz9z40RxGNOp_jNNf_iSfuOFGf_1evLN1o1BPw5iVlXJzk7TMO0D1kF50sCgF1TagtB_hQoK-ilAu-PWm7i_6CXjj3f9msggNBUcbehlF7nd0GWvM6jm0Aq5qc8iYeENLM8696g2xeKP1cj4WdmLirmOg-EZ-b8uw_VoJr0Nupdcg6qCcTzM5ytyPYWAiIDOhLdBfED5BhBeNWcp8kNFUGXYw
Request a license token
This endpoint allows you to request a license token for the current device.
Requires an authenticated customer, and that the customers has free license activations on their account to activate the product.
If none of the customer's licenses covers the app's version, it responds with a ReleaseNotCovered error.
Required headers
- Name
Authorization- Type
- string
- Description
Access token for the authenticated customer in your app, in the form of a JWT bearer token.
Required body properties
- Name
deviceName- Type
- string
- Description
The name of the device being activated. Will be shown in the customer portal in case the customer wants to revoke this license activation.
- Name
deviceSignature- Type
- string
- Description
A fingerprint of the current device that will not change. Should be used when validating future license tokens, that they have indeed been issued for the current device.
Optional query parameters
- Name
autoActivateSubProducts- Type
- boolean
- Optionality
- optional
- Description
Set to
falseto stop the device from taking seats of add-ons included in the license, so your app can activate them when the customer asks. Defaults totrue.
Request
POST https://demo.moonbase.sh/api/client/licenses/demo-app/request
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiJiY...
{
"deviceName": "Example Device Name",
"deviceSignature": "xLTI3VDEyOjE2OjA5LjY1NTUyNTNaIiwidHJpYWwiOiJ0cnVlIiwiYXVkI"
}
Response
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImM2Mjg0YTkwZDQ3ZGY4MTQ1MzBjMDE1ZjBjY2ZkZGZhIiwidmVuZG9yIjoiRGVtbyBDby4iLCJ1OmlkIjoiYmJkNjNhNmYtMmE0MS00MzJkLTg0YjUtNmRjYmFjMGJmZDIwIiwidTpuYW1lIjoiRXhhbXBsZSBVc2VyIiwidTplbWFpbCI6ImV4YW1wbGVAbW9vbndhdGVyLm5vIiwibDppZCI6ImYzZGEyYzlhLWQ3YTAtNGFhOS1hNGI1LTAwNzg2YWU1ZmM5OCIsInA6aWQiOiJkZW1vLWFwcCIsInA6bmFtZSI6IkRlbW8gQXBwIiwibWV0aG9kIjoiT25saW5lIiwic2lnIjoieExUSTNWREV5T2pFMk9qQTVMalkxTlRVeU5UTmFJaXdpZEhKcFlXd2lPaUowY25WbElpd2lZWFZrSSIsInZlciI6IjIwMjQtMDEtMjdUMTI6NDI6NTguODM0MTUzN1oiLCJ0cmlhbCI6ImZhbHNlIiwiYXVkIjoiZGVtby1hcHAiLCJpc3MiOiJkZW1vIiwiaWF0IjoxNzA2MzU5MzA5LCJuYmYiOjE3MDYzNTkzMDl9.jwmAyg2e22mF3Ds4bLMcyrr6e_lO-lpmwhDQz2X9psrwPBlsf3Od8vGGiVlfXZGJJWsTwZBVGTPHx2NpqtexGaytMXlS23rSc0My-nQXsShao-9hyF4nOPHZWVEvUbZkMzk4hbO4AiYlyw2KKyvYGMWA0jITSJKgs-M4YcUl2wQHm5FeXRZyGbc5CzWV7lq74qMqM_EkYZ2nvq6AXEAJ6c9TsP2AEH2zBhi79EbZwE9HWWGEu55pZi8-GBZdeZ1tZfkKz19rOBnWFP8BvKrkCuJDPR7JdRywsYEsRzqI59QANl5zoRAnP9zOn-_b1QQZnZMPOdohn1WVszbDq43bTw
Validate a license token
This endpoint allows you to send a license token you have to have it validated.
For all Online activated tokens, this should be done regularly to be able to deactivate revoked devices fast.
You will receive an updated token in return, with new valid validation timestamps if the license is still active.
If the license doesn't cover the app's version, it responds with a ReleaseNotCovered error.
Required body content
The license token you wish to validate.
Optional query parameters
- Name
autoActivateSubProducts- Type
- boolean
- Optionality
- optional
- Description
Set to
falseto stop the device from taking seats of add-ons included in the license, so your app can activate them when the customer asks. Defaults totrue.
Request
POST https://demo.moonbase.sh/api/client/licenses/demo-app/validate
Content-Type: text/plain
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImM2Mjg0YTkwZDQ3ZGY4MTQ1MzBjMDE1Z...
Response
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImM2Mjg0YTkwZDQ3ZGY4MTQ1MzBjMDE1ZjBjY2ZkZGZhIiwidmVuZG9yIjoiRGVtbyBDby4iLCJ1OmlkIjoiYmJkNjNhNmYtMmE0MS00MzJkLTg0YjUtNmRjYmFjMGJmZDIwIiwidTpuYW1lIjoiRXhhbXBsZSBVc2VyIiwidTplbWFpbCI6ImV4YW1wbGVAbW9vbndhdGVyLm5vIiwibDppZCI6ImYzZGEyYzlhLWQ3YTAtNGFhOS1hNGI1LTAwNzg2YWU1ZmM5OCIsInA6aWQiOiJkZW1vLWFwcCIsInA6bmFtZSI6IkRlbW8gQXBwIiwibWV0aG9kIjoiT25saW5lIiwic2lnIjoieExUSTNWREV5T2pFMk9qQTVMalkxTlRVeU5UTmFJaXdpZEhKcFlXd2lPaUowY25WbElpd2lZWFZrSSIsInZlciI6IjIwMjQtMDEtMjdUMTI6NDI6NTguODM0MTUzN1oiLCJ0cmlhbCI6ImZhbHNlIiwiYXVkIjoiZGVtby1hcHAiLCJpc3MiOiJkZW1vIiwiaWF0IjoxNzA2MzU5MzA5LCJuYmYiOjE3MDYzNTkzMDl9.jwmAyg2e22mF3Ds4bLMcyrr6e_lO-lpmwhDQz2X9psrwPBlsf3Od8vGGiVlfXZGJJWsTwZBVGTPHx2NpqtexGaytMXlS23rSc0My-nQXsShao-9hyF4nOPHZWVEvUbZkMzk4hbO4AiYlyw2KKyvYGMWA0jITSJKgs-M4YcUl2wQHm5FeXRZyGbc5CzWV7lq74qMqM_EkYZ2nvq6AXEAJ6c9TsP2AEH2zBhi79EbZwE9HWWGEu55pZi8-GBZdeZ1tZfkKz19rOBnWFP8BvKrkCuJDPR7JdRywsYEsRzqI59QANl5zoRAnP9zOn-_b1QQZnZMPOdohn1WVszbDq43bTw
Revoke a license token
This endpoint allows you to send a license token you have to have it revoked. By doing this, you will effectively free up a seat for the customer, so that they can activate other devices. It also frees the device's seats of any add-ons included in the license. Offline activated license tokens will not be accepted by this endpoint as they are not intended to be floating licenses.
When customers can't revoke the product's activations, it responds with 403: Forbidden and an errorType of LicenseNotRevocable.
The device stays activated, so keep the license.
The token's revocable claim says this in advance.
Required body content
The license token you wish to revoke.
Request
POST https://demo.moonbase.sh/api/client/licenses/demo-app/revoke
Content-Type: text/plain
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImM2Mjg0YTkwZDQ3ZGY4MTQ1MzBjMDE1Z...
LicenseNotRevocable response
{
"title": "Not allowed",
"status": 403,
"detail": "Activations of this product can only be revoked by the seller",
"errorType": "LicenseNotRevocable"
}
Migrate a license
This endpoint swaps a license from the licensing system you used before Moonbase for a Moonbase license token, so customers who already unlocked your app don't have to activate it again. Turn it on in Moonbase under Account settings > Migration > License migration configuration, with the URL of an endpoint on your server that checks old licenses and an API key for Moonbase to send it.
Moonbase posts the body of this request to your endpoint as it is, with the same Content-Type and your API key in an api-key header, and your endpoint answers with what the license is.
For a trial, Moonbase starts a trial on the device.
Otherwise it activates the device on the customer's license of the product, so import your customers and their licenses first.
Responds with 400: Bad Request when your endpoint refuses the license (an errorType of LicenseInvalid), when the customer isn't in Moonbase, or when they have no license of the product with a free seat (NoEligibleLicense).
Required body content
The license from your old system, in any format your endpoint reads. Include the device's name and signature when the old license doesn't carry them, since your endpoint has to return them.
Optional query parameters
- Name
autoActivateSubProducts- Type
- boolean
- Optionality
- optional
- Description
Set to
falseto stop the device from taking seats of add-ons included in the license, so your app can activate them when the customer asks. Defaults totrue.
Your endpoint's answer
Answer with a 2xx status and a JSON body with these properties. Any other status refuses the license.
- Name
trial- Type
- boolean
- Description
trueto start a trial on the device rather than activate a license.
- Name
productId- Type
- string
- Description
ID of the Moonbase product the license unlocks.
- Name
customerId- Type
- string
- Optionality
- optional
- Description
The customer's Moonbase ID. A license needs this or
customerEmail.
- Name
customerEmail- Type
- string
- Optionality
- optional
- Description
The customer's email address in Moonbase.
- Name
activationMethod- Type
- enum(Online|Offline)
- Description
How the device is activated, which becomes the token's
methodclaim.
- Name
deviceName- Type
- string
- Description
The name of the device, shown in the customer portal.
- Name
deviceSignature- Type
- string
- Description
The device's fingerprint, as your app computes it for Moonbase. It becomes the token's
sigclaim, which your app checks against the device.
- Name
expiresAt- Type
- string
- Optionality
- optional
- Description
ISO-8601 timestamp for when a trial ends. Leave it out to follow the product's trial settings.
Request
POST https://demo.moonbase.sh/api/client/licenses/migrate
Content-Type: application/json
{
"licenseKey": "DEMO-4F2A-9C1B-77E3",
"deviceName": "Example Device Name",
"deviceSignature": "xLTI3VDEyOjE2OjA5LjY1NTUyNTNaIiwidHJpYWwiOiJ0cnVlIiwiYXVkI"
}
Your endpoint answers
{
"trial": false,
"productId": "demo-app",
"customerEmail": "customer@example.com",
"activationMethod": "Online",
"deviceName": "Example Device Name",
"deviceSignature": "xLTI3VDEyOjE2OjA5LjY1NTUyNTNaIiwidHJpYWwiOiJ0cnVlIiwiYXVkI"
}
Response
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImM2Mjg0YTkwZDQ3ZGY4MTQ1MzBjMDE1ZjBjY2ZkZGZhIiwidmVuZG9yIjoiRGVtbyBDby4iLCJ1OmlkIjoiYmJkNjNhNmYtMmE0MS00MzJkLTg0YjUtNmRjYmFjMGJmZDIwIiwidTpuYW1lIjoiRXhhbXBsZSBVc2VyIiwidTplbWFpbCI6ImV4YW1wbGVAbW9vbndhdGVyLm5vIiwibDppZCI6ImYzZGEyYzlhLWQ3YTAtNGFhOS1hNGI1LTAwNzg2YWU1ZmM5OCIsInA6aWQiOiJkZW1vLWFwcCIsInA6bmFtZSI6IkRlbW8gQXBwIiwibWV0aG9kIjoiT25saW5lIiwic2lnIjoieExUSTNWREV5T2pFMk9qQTVMalkxTlRVeU5UTmFJaXdpZEhKcFlXd2lPaUowY25WbElpd2lZWFZrSSIsInZlciI6IjIwMjQtMDEtMjdUMTI6NDI6NTguODM0MTUzN1oiLCJ0cmlhbCI6ImZhbHNlIiwiYXVkIjoiZGVtby1hcHAiLCJpc3MiOiJkZW1vIiwiaWF0IjoxNzA2MzU5MzA5LCJuYmYiOjE3MDYzNTkzMDl9.jwmAyg2e22mF3Ds4bLMcyrr6e_lO-lpmwhDQz2X9psrwPBlsf3Od8vGGiVlfXZGJJWsTwZBVGTPHx2NpqtexGaytMXlS23rSc0My-nQXsShao-9hyF4nOPHZWVEvUbZkMzk4hbO4AiYlyw2KKyvYGMWA0jITSJKgs-M4YcUl2wQHm5FeXRZyGbc5CzWV7lq74qMqM_EkYZ2nvq6AXEAJ6c9TsP2AEH2zBhi79EbZwE9HWWGEu55pZi8-GBZdeZ1tZfkKz19rOBnWFP8BvKrkCuJDPR7JdRywsYEsRzqI59QANl5zoRAnP9zOn-_b1QQZnZMPOdohn1WVszbDq43bTw
Add-ons
An add-on is a product under a main product, with an ID like demo-app.preset-pack.
When you turn on Include in the main product's license on the add-on, a device that activates or validates the main product also takes a seat of the add-on, if the customer owns it and a seat is free.
The main product's license token then lists the add-on in its sp claim, saying whether your app may unlock it on that device, so one token answers for both.
An add-on bought after the device activated shows up at the next validation.
The endpoints below let your app act on add-ons from the main product's license token.
Each takes the token as its body, and the add-on as {subProductId}, either its own part of the ID (preset-pack) or the whole ID (demo-app.preset-pack).
List add-ons
This endpoint lists the product's add-ons the customer can do something with, for an in-app store or upgrade screen: ones they own or subscribe to, ones for sale, and ones whose trial can be started or is running on this device. It works from a license or a trial token, and changes nothing.
- Name
currency- Type
- string
- Description
The currency to show prices in.
- Name
subProducts- Type
- array
- Description
The add-ons, each containing:
- Name
id- Type
- string
- Description
The add-on's own part of its product ID, as the
spclaim names it.
- Name
product- Type
- object
- Description
The add-on as a storefront product, with
ownedandsubscribedfor the customer, and its prices when it's for sale.
- Name
includedInLicense- Type
- boolean
- Description
Whether the add-on is included in the main product's license.
- Name
active- Type
- boolean
- Description
Whether to unlock the add-on on this device. For an included add-on, the same as
activein the token'sspclaim; for any other, whether the customer owns or subscribes to it.
- Name
revoked- Type
- boolean
- Description
Whether the add-on's seat on this device was revoked, so your app has to activate it again.
- Name
expiresAt- Type
- datetime
- Optionality
- optional
- Description
When the license or trial behind an included add-on ends.
- Name
seats- Type
- object
- Optionality
- optional
- Description
The add-on's seats across the customer's licenses for it, as
total,usedandremaining.
- Name
trial- Type
- object
- Optionality
- optional
- Description
The add-on's trial on this device, with a
statusofAvailablewhen one can be started now,ActiveorExpiredfor the trial the device had, andUnavailableotherwise. Also hasnumberOfDays,expiresAtfor a running trial, andrequiresNewsletterOptIn. Omitted when the add-on doesn't offer trials.
- Name
buyUrl- Type
- url
- Optionality
- optional
- Description
Where the customer can buy the add-on, when it's for sale. Add
?variation={id}for one of its variations.
Request
POST https://demo.moonbase.sh/api/client/licenses/demo-app/sub-products
Content-Type: text/plain
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImM2Mjg0YTkwZDQ3ZGY4MTQ1MzBjMDE1Z...
Response
{
"currency": "EUR",
"subProducts": [
{
"id": "preset-pack",
"product": {
"id": "demo-app.preset-pack",
"name": "Preset Pack",
"tagline": "Presets for every genre",
"owned": false,
"subscribed": false,
"defaultVariation": {
"id": "v1",
"name": "Preset Pack",
"originalPrice": { "EUR": 49 },
"price": { "EUR": 49 },
"hasDiscount": false,
"recurrence": { "type": "OneOff" }
},
...
},
"includedInLicense": true,
"active": false,
"revoked": false,
"trial": {
"status": "Available",
"numberOfDays": 7,
"requiresNewsletterOptIn": false
},
"buyUrl": "https://demo.moonbase.sh/buy/demo-app.preset-pack"
}
]
}
Activate an add-on
This endpoint takes a seat of an included add-on for the device, and returns the main product's license token with the add-on active in its sp claim.
Use it when the add-on's seat on this device was revoked, which validating doesn't undo, or when your app activates add-ons only when the customer asks for them, with autoActivateSubProducts=false.
Responds with 400: Bad Request and an errorType of NoEligibleLicense when the customer doesn't own the add-on or has no free seat of it, and with 400: Bad Request when the add-on isn't included in the main product's license or the token is a trial.
Required body content
The main product's license token.
Request
POST https://demo.moonbase.sh/api/client/licenses/demo-app/sub-products/preset-pack/activate
Content-Type: text/plain
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImM2Mjg0YTkwZDQ3ZGY4MTQ1MzBjMDE1Z...
Response
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImM2Mjg0YTkwZDQ3ZGY4MTQ1MzBjMDE1Z...
Start an add-on trial
This endpoint starts the trial of an included add-on on the device, following the add-on's own trial settings, and returns the main product's license token with the trial in its sp claim.
It needs an online license of the main product, not a trial or an offline license.
A customer who owns the add-on gets a seat of it instead, as when activating it, and once they buy it, the next validation replaces the trial with a seat.
Each device gets one trial of each add-on, so asking again returns the token with the trial it had, ended or not.
An add-on trial you restart in Moonbase starts over when you ask again, or at the main product's next validation.
Responds with 400: Bad Request when the add-on doesn't offer trials, and with 403: Forbidden when its trials require a newsletter opt-in the customer hasn't given.
Required body content
The main product's license token.
Request
POST https://demo.moonbase.sh/api/client/licenses/demo-app/sub-products/preset-pack/trial
Content-Type: text/plain
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImM2Mjg0YTkwZDQ3ZGY4MTQ1MzBjMDE1Z...
Response
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImM2Mjg0YTkwZDQ3ZGY4MTQ1MzBjMDE1Z...
Browser Activations
A good alternative to the above endpoints where you need to authenticate the customer in your apps is to request browser based activation instead. By requesting an activation, you can open a browser where the customer is in most cases already logged in, where they can choose what to fulfill the request with.
Request activation
This endpoint allows you to request a activation for the current device. The returned payload will have two URLs that are relevant:
- Name
request- Type
- uri
- Description
This URL can be polled to check for the current status of the request. See
GET /api/client/activations/{requestId}below.
- Name
browser- Type
- uri
- Description
This URL should be opened in the browser of the current device so the customer can complete the activation process.
Required body properties
- Name
deviceName- Type
- string
- Description
The name of the device being activated. Will be shown in the customer portal in case the customer wants to revoke this license activation.
- Name
deviceSignature- Type
- string
- Description
A fingerprint of the current device that will not change. Should be used when validating future license tokens, that they have indeed been issued for the current device.
Optional query parameters
- Name
autoActivateSubProducts- Type
- boolean
- Optionality
- optional
- Description
Set to
falseto stop the device from taking seats of add-ons included in the license, so your app can activate them when the customer asks. Defaults totrue.
Request
POST https://demo.moonbase.sh/api/client/activations/demo-app/request
Content-Type: application/json
{
"deviceName": "Example Device Name",
"deviceSignature": "xLTI3VDEyOjE2OjA5LjY1NTUyNTNaIiwidHJpYWwiOiJ0cnVlIiwiYXVkI"
}
Response
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"request": "https://demo.moonbase.sh/api/client/activations/3fa85f64-5717-4562-b3fc-2c963f66afa6",
"browser": "https://demo.moonbase.sh/activate/auto?token=3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
Get request status
This endpoint allows you to check the current status of a activation request.
By polling this regularly, you can activate the device as soon as the user fulfills the request in their browser.
Be careful not to poll too frequently, or you may be rate limited.
One request per 5 seconds is considered a safe frequency.
Until the customer has fulfilled the request, a HTTP 204: No content will be returned.
Once fulfilled, the response will contain a license token ready to be used.
A request that is cancelled, or not fulfilled within an hour, responds with 400: Bad Request. Stop polling, and start a new request if the customer still wants to activate.
Request
GET https://demo.moonbase.sh/api/client/activations/3fa85f64-5717-4562-b3fc-2c963f66afa6
Response
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNlZjNlMzdiZTMzOGFjYWJkNWRhMDQxMDUwOTkwMjVjIiwidmVuZG9yIjoiRGVtbyBDby4iLCJ1OmlkIjoiMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwIiwidTpuYW1lIjoiYW5vbnltb3VzIiwidTplbWFpbCI6ImFub255bW91cyIsImw6aWQiOiJjZWYzZTM3YmUzMzhhY2FiZDVkYTA0MTA1MDk5MDI1YyIsInA6aWQiOiJkZW1vLWFwcCIsInA6bmFtZSI6IkRlbW8gQXBwIiwibWV0aG9kIjoiT25saW5lIiwic2lnIjoieExUSTNWREV5T2pFMk9qQTVMalkxTlRVeU5UTmFJaXdpZEhKcFlXd2lPaUowY25WbElpd2lZWFZrSSIsInZlciI6IjIwMjQtMDEtMjdUMTI6MjU6NTcuNTc4MDkwNloiLCJ0cmlhbCI6InRydWUiLCJhdWQiOiJkZW1vLWFwcCIsImV4cCI6MTcwNzU2Nzk1NywiaXNzIjoiZGVtbyIsImlhdCI6MTcwNjM1ODM1NywibmJmIjoxNzA2MzU4MzU3fQ.cze2gijLNTi9IxcgqpKUMk8Eq90dlG0UOvXVlfAwdeDJ-VCLlK3GIHg23t5BzsQjGBJM0GU6mFV-IXrdIdu8ibFdiEpCIqDS880EoEZfRLyKjzOI2n8heBPNWsdLxGz9z40RxGNOp_jNNf_iSfuOFGf_1evLN1o1BPw5iVlXJzk7TMO0D1kF50sCgF1TagtB_hQoK-ilAu-PWm7i_6CXjj3f9msggNBUcbehlF7nd0GWvM6jm0Aq5qc8iYeENLM8696g2xeKP1cj4WdmLirmOg-EZ-b8uw_VoJr0Nupdcg6qCcTzM5ytyPYWAiIDOhLdBfED5BhBeNWcp8kNFUGXYw
Metadata for analytics
To be able to have insights into what version of your software is being used, what platforms it is installed on and any other dimensions that might be interesting to you, you may optionally include metadata in the requests for this API. This should be added to query parameters, and supports the following parameters:
- Name
appVersion- Type
- string
- Optionality
- optional
- Description
The semantic version of the application, for example
1.0.0. It is also the version checked against a license that covers only some versions.
- Name
platform- Type
- enum(Windows|Mac|Linux)
- Optionality
- optional
- Description
The platform that is being used, must match the enum exactly.
- Name
meta- Type
- object
- Optionality
- optional
- Description
Any additional dimensions you want to track can be added as a key/value pair to the
metaparameter.
Request URI
/api/client/activations/example-product/request
?appVersion=1.0.0
&platform=Windows
&meta[DAW]=Reaper
&meta[Format]=VST3
Some of our licensing SDKs may automatically add some relevant context for you based on the framework you are using, and also allow you to add more parameters on demand.