Core API Reference
The Moonbase Core API has endpoints where you can manage your Moonbase account using API keys from other systems. It's the ideal set of endpoints to use when building custom integrations or migrating a lot of data to Moonbase.
When calling endpoints, be sure to use the full URL including your Moonbase account ID. Examples on this page assumes an account ID of demo, and so the base URL for all endpoints will be https://demo.moonbase.sh/api/.
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
All endpoints that are part of this Core API require an API key on requests. API keys can be created under Account settings > Developer in Moonbase, and should be included in a header called Api-Key. For example:
curl -X 'GET' https://demo.moonbase.sh/api/products \
-H 'Api-Key: mb_bbdac119b64649f6937e...'
A key has full access, or is restricted to the areas you choose, each with Read or Read & write access: products, customers, orders, subscriptions, licenses, activations, trials, coupons, vouchers, affiliates, campaigns and automations.
When a restricted key calls an endpoint outside its access, the API responds with 403: Forbidden, and missingScopes in the response body names the access it needs, such as customers:read or orders:write.
Rate limits
Core API requests are limited to 500 requests per minute.
If your server calls the Storefront API or Licensing API on behalf of your customers, include your API key on those requests too, so they are not limited by IP address.
When you exceed the limit, the API responds with 429: Too Many Requests and a Retry-After header telling you how many seconds to wait. Rather than hard-coding the limit into your client, honor Retry-After and back off until the window resets.
- Name
Retry-After- Type
- number
- Description
Present on
429responses. The number of seconds to wait before retrying.
Need a higher limit for a bulk migration or a high-traffic integration? Reach out at developers@moonbase.sh.
429 response
HTTP/1.1 429 Too Many Requests
Retry-After: 60
Pagination
For endpoints that query a list of resources, we have pagination in place to make sure you can iterate through large amounts of data easily. When you receive paginated responses, they always come wrapped in the same response wrapper:
- Name
items- Type
- array
- Description
This array contains objects with the resources requested.
- Name
hasMore- Type
- boolean
- Description
Flag to indicate whether there are more results to be retrieved.
- Name
next- Type
- string
- Nullability
- nullable
- Description
The path to call to get the next page of results.
- Name
pageSize- Type
- number
- Description
The actual page size applied to this response. Requested
pageSizevalues are clamped to a per-endpoint maximum (typically between 100 and 500) — read this field to confirm the effective limit rather than assuming the request value was honored.
Pagination example
{
"items": [
{
...
}
],
"hasMore": true,
"next": "/api/customers?paginationToken=...",
"pageSize": 100
}
Custom Properties
Custom properties allow you to attach arbitrary metadata to your core entities: customers, licenses, products, trials, product releases, vouchers, and coupons. Each property has a typed value and two visibility flags that control where the property appears.
Property structure
Each custom property is an object with the following fields:
- Name
type- Type
- enum(text|number|boolean|date|object)
- Description
The type of value this property holds.
- Name
value- Type
- string|number|boolean|datetime|object
- Description
The value of the property:
- text: A string value
- number: A decimal number value
- boolean: A true or false value
- date: An ISO-8601 date and time value
- object: A nested object containing more typed values
- Name
public- Type
- boolean
- Description
Controls if this property is visible in storefront and customer-facing endpoints. Properties with
publicset tofalsewill only be visible in the Core API.
- Name
includeInToken- Type
- boolean
- Description
Controls if this property is included in license tokens. See the licensing API documentation for details on how custom properties appear in tokens.
Validation rules
- Property names must start with a letter or underscore and contain only letters, digits, underscores, or hyphens.
- Nested objects support up to 5 levels of depth.
- Total custom properties size must not exceed 48 KB per entity.
- Object properties must contain at least one field.
Custom property examples
{
"company_size": {
"type": "number",
"value": 50,
"public": false,
"includeInToken": false
},
"category": {
"type": "text",
"value": "Audio Tools",
"public": true,
"includeInToken": false
},
"beta_access": {
"type": "boolean",
"value": true,
"public": true,
"includeInToken": true
},
"renewal_date": {
"type": "date",
"value": "2026-06-01T00:00:00Z",
"public": false,
"includeInToken": true
},
"metadata": {
"type": "object",
"value": {
"region": {
"type": "text",
"value": "eu-west"
},
"tier": {
"type": "number",
"value": 2
}
},
"public": false,
"includeInToken": false
}
}
Ad consent
Customers and orders may include adConsent, the advertising choice recorded from the storefront, so your own integrations can honor it too. It is omitted until a visit has reported or resolved a choice, and on older records without one. An order keeps the choice reported while that checkout was open; a customer's latest choice applies to later events such as renewals.
| Field | Meaning |
|---|---|
adUserData | Whether data such as the purchase and hashed email may be sent to measure ads. |
adPersonalization | Whether that data may be used for personalized ads or customer audiences. |
basis | Website, StoreSetting, GlobalPrivacyControl, Request or Deleted, identifying what decided it. |
decidedAt | ISO-8601 time of the choice, or when the store setting was evaluated. |
Use the Storefront API to report a website's choice and later withdrawals. To record a refusal you learned of yourself, such as a privacy request, use Refuse ad consent. These consent fields do not replace newsletter or product-update preferences.
Consent recorded from the website
{
"adConsent": {
"adUserData": true,
"adPersonalization": false,
"basis": "Website",
"decidedAt": "2026-11-13T12:00:00Z"
}
}
Customers
Use customer endpoints to manage your customer accounts and get insights into who are buying your products. Not every customer has an account: newsletter contacts, such as people who subscribed through a sign-up form or were imported from a mailing list, are customers too, and get an account once they sign up or buy with the same email address. The customer object will contain the following fields:
- Name
adConsent- Type
- object
- Optionality
- optional
- Description
The recorded advertising choice, when known.
- Name
id- Type
- string
- Description
The Moonbase ID of the customer.
- Name
name- Type
- string
- Nullability
- nullable
- Description
The full name of the customer. Can be
nullfor a newsletter contact imported without a name.
- Name
businessName- Type
- string
- Nullability
- nullable
- Description
If the customer is a business, this holds the business name.
- Name
taxId- Type
- string
- Nullability
- nullable
- Description
If the customer is a business, this holds the tax ID if given.
- Name
email- Type
- string
- Description
Current email address of the customer.
- Name
emailConfirmed- Type
- boolean
- Description
Flag for if the current email address has ever been confirmed.
- Name
hasPassword- Type
- boolean
- Description
Flag for if the customer has created a password yet.
- Name
hasAccount- Type
- boolean
- Description
Flag for if the customer has an account they can sign in with.
falsefor a newsletter contact, until they sign up or buy with the same email address.
- Name
isDeleted- Type
- boolean
- Description
Flag for if the this customer account has been deleted.
- Name
ownedProducts- Type
- array
- Description
List of product IDs that this customer owns.
- Name
subscribedProducts- Type
- array
- Description
List of product IDs that this customer is currently subscribed to.
- Name
address- Type
- object
- Nullability
- nullable
- Description
Billing address for the customer if stored. 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.
- Name
communicationPreferences- Type
- object
- Description
Contains specific communication opt-ins given by the customer:
- Name
newsletterOptIn- Type
- boolean
- Description
Flag for if the customer wants to receive newsletters.
- Name
logins- Type
- array
- Description
The Google, Apple, Facebook and Discord accounts the customer signs in with, in the order they were linked. Empty for a customer who only signs in with their email address. Each contains:
- Name
provider- Type
- enum(Google|Apple|Facebook|Discord)
- Description
The sign-in provider.
- Name
id- Type
- string
- Description
The provider's own ID for the account: the Discord user ID, Google's and Apple's
sub, or Facebook's app-scoped user ID. Find the customer by it with Get customer by sign-in account.
- Name
email- Type
- string
- Optionality
- optional
- Description
The email address the provider gave when the account was linked. It may have changed at the provider since.
- Name
linkedAt- Type
- datetime
- Description
When the account was linked to the customer.
- Name
properties- Type
- object
- Optionality
- optional
- Description
Custom properties attached to this customer. See custom properties for more details on the shape and types of custom properties.
Customer example
{
"id": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"name": "Tobias",
"businessName": null,
"taxId": null,
"email": "tobias@moonbase.sh",
"emailConfirmed": true,
"hasPassword": true,
"hasAccount": true,
"isDeleted": false,
"ownedProducts": [
"example-app"
],
"subscribedProducts": [],
"address": null,
"communicationPreferences": {
"newsletterOptIn": true
},
"logins": [
{
"provider": "Discord",
"id": "80351110224678912",
"email": "tobias@moonbase.sh",
"linkedAt": "2026-11-20T14:02:11Z"
}
],
"properties": {
"company_size": {
"type": "number",
"value": 50,
"public": false,
"includeInToken": false
}
}
}
Get customers
Use this endpoint to fetch all customers page by page. For more details on how pagination works, see pagination.
Optional query parameters
- Name
pageSize- Type
- number
- Optionality
- optional
- Description
Adjust the size of each page returned.
- Name
before- Type
- datetime
- Optionality
- optional
- Description
ISO-8601 timestamp; only return customers created before this point in time.
- Name
after- Type
- datetime
- Optionality
- optional
- Description
ISO-8601 timestamp; only return customers created after this point in time.
Request
GET https://demo.moonbase.sh/api/customers
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"items": [
{
"id": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"name": "Tobias",
...
}
],
"hasMore": false,
"next": null
}
Get customer by ID or email
Use this endpoint to look up a customer by their ID or email address.
Request
GET https://demo.moonbase.sh/api/customers/tobias@moonbase.sh
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"id": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"name": "Tobias",
...
}
Get customer by sign-in account
Use this endpoint to find the customer who signs in with an account at Google, Apple, Facebook or Discord, by the provider's own ID for it. A Discord bot can use it to tell which customer a member of your server is, for example, and give them a role for what they own.
provider is google, apple, facebook or discord, and id is the account's id in the customer's logins.
Apple and Facebook give each app its own ID for a person, so for those, the ID matches only what the app you set up for customer sign-in sees.
If no customer signs in with the account, the API responds with 404: Not Found.
Requires an API key that can read customers.
Request
GET https://demo.moonbase.sh/api/customers/logins/discord/80351110224678912
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"id": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"name": "Tobias",
...
"logins": [
{
"provider": "Discord",
"id": "80351110224678912",
"email": "tobias@moonbase.sh",
"linkedAt": "2026-11-20T14:02:11Z"
}
]
}
Import customer
Importing a customer creates them a user account. It will not send any emails to the customer, and they will be able to reset their password using the normal reset password flow on your website or the hosted customer portal. You can also supply their password if you already have it, or can generate a secure one.
To bring over a mailing list instead, set createAccount to false. That imports each address as a newsletter contact without an account, the same kind of customer a newsletter sign-up form creates. A contact needs no name, has no password, and gets an account once they sign up or buy with the same email address.
In case a customer with the given email already exists, you will receive a 409: Conflict response, where you can access the customer ID using the instance property of the error object.
Required body properties
- Name
name- Type
- string
- Description
Full name of the user. Optional when
createAccountisfalse.
- Name
email- Type
- string
- Description
Email address of the user. Will be used as username. Can be changed by the user.
Optional body properties
- Name
createAccount- Type
- boolean
- Optionality
- optional
- Description
Whether to import the customer with an account. Defaults to
true. Set it tofalseto import a newsletter contact without an account, and sendcommunicationPreferences.newsletterOptInastruealong with it, or the contact will not receive your newsletters.
- Name
password- Type
- string
- Optionality
- optional
- Description
The initial password for the user. Must contain lower case characters, uppercase characters, numbers and a symbol. Not allowed when
createAccountisfalse: the request is rejected with400: Bad Request, since a contact sets their password when they sign up.
- Name
externalId- Type
- string
- Optionality
- optional
- Description
ID of this customer in your existing system, useful for cross-referencing with other systems.
- Name
createdAt- Type
- datetime
- Optionality
- optional
- Description
ISO-8601 timestamp to backfill the customer's creation date when migrating from another system.
- Name
address- Type
- object
- Optionality
- optional
- 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.
- Name
businessName- Type
- string
- Optionality
- optional
- Description
Registered business name, for a customer buying on behalf of a company.
- Name
taxId- Type
- string
- Optionality
- optional
- Description
The customer's business tax ID, for example a VAT number. Requires
addressto be supplied with acountryCode: the issuing country decides how the ID is interpreted, and there is no existing customer to fall back on during an import, so ataxIdwithout one is rejected rather than dropped.
- Name
communicationPreferences- Type
- object
- Optionality
- optional
- Description
The existing communication preferences the customer has given, if any.
Leaving a value out records no decision for that channel rather than an opt-out.
Contains the following properties:- Name
newsletterOptIn- Type
- boolean
- Optionality
- optional
- Description
Customer has agreed to receive newsletters or other marketing emails.
- Name
productUpdatesOptIn- Type
- boolean
- Optionality
- optional
- Description
Customer has agreed to receive product updates and similar emails. Omit it and the newsletter decision covers this channel too, since systems you import from rarely separate the two.
Request
POST https://demo.moonbase.sh/api/customers/import
Api-Key: mb_bbdac119b64649f6937e...
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
},
"communicationPreferences": {
"newsletterOptIn": true
}
}
Response
{
"id": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"name": "Example User",
"hasAccount": true,
...
}
Request without an account
POST https://demo.moonbase.sh/api/customers/import
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"email": "subscriber@example.com",
"createAccount": false,
"communicationPreferences": {
"newsletterOptIn": true
}
}
Update customer
This endpoint can be used to partially update customer accounts, with every property being optional.
Optional body properties
- Name
name- Type
- string
- Optionality
- optional
- Description
Full name of the user.
- Name
email- Type
- string
- Optionality
- optional
- Description
Email address of the user. Will be used as username. Can be changed by the user. Changing this will not send an email to the customer, and they will immediately be able to log in using the new address.
- Name
phone- Type
- string
- Optionality
- optional
- Description
Phone number of the customer.
- Name
communicationPreferences- Type
- object
- Optionality
- optional
- Description
If you have collected updated communication opt-ins, you can update those using this object:
- Name
newsletterOptIn- Type
- boolean
- Description
Flag for if this customer has opted in to receive newsletters.
Request
PATCH https://demo.moonbase.sh/api/customers/49b8da10-2d72-4bdf-bf9c-47e56c184bfa
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"name": "Example User",
"communicationPreferences": {
"newsletterOptIn": true
}
}
Response
{
"id": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"name": "Example User",
...
}
Delete customer
Use this to delete customers from your Moonbase account. They will lose access to all products, and their user will be stripped of all personal information. Deleting customers will not affect historical sales, as we are required to store billing details for financial compliancy.
Request
DELETE https://demo.moonbase.sh/api/customers/49b8da10-2d72-4bdf-bf9c-47e56c184bfa
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"id": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"name": "Example User",
...
}
Set custom properties
Use this endpoint to set custom properties on a customer. This replaces all existing custom properties on the customer. See custom properties for more details on the shape and types of custom properties.
Request body
The body should be a JSON object where each key is the property name, and the value is a custom property object.
- Name
{key}- Type
- object
- Description
Each property must contain the following fields:
- Name
type- Type
- enum(text|number|boolean|date|object)
- Description
The type of value this property holds.
- Name
value- Type
- string|number|boolean|datetime|object
- Description
The value of the property, matching the declared type.
- Name
public- Type
- boolean
- Description
Flag for if this property should be visible in storefront and customer-facing endpoints.
- Name
includeInToken- Type
- boolean
- Description
Flag for if this property should be included in license tokens.
Request
PUT https://demo.moonbase.sh/api/customers/49b8da10-2d72-4bdf-bf9c-47e56c184bfa/custom-properties
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"company_size": {
"type": "number",
"value": 50,
"public": false,
"includeInToken": false
}
}
Response
{
"id": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"name": "Tobias",
...
}
Refuse ad consent
Use this endpoint to record that a customer refuses your ad platforms, for a refusal you learned of yourself, such as a privacy request or your own consent records. It does what "Stop sending" on the customer's page in Moonbase does: Moonbase stops sending their data to your ad platforms and takes them off your customer lists there.
The customer's adConsent becomes a refusal with the basis Request. Only the customer's own later yes at your website's cookie banner undoes it. There is no way to record consent through the API.
Requires an API key that can write customers. The response is the updated customer, or 404: Not Found for an unknown customer.
Request
POST https://demo.moonbase.sh/api/customers/49b8da10-2d72-4bdf-bf9c-47e56c184bfa/ad-consent/refuse
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"id": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"name": "Example User",
"adConsent": {
"adUserData": false,
"adPersonalization": false,
"basis": "Request",
"decidedAt": "2026-11-18T09:30:00Z"
},
...
}
Orders
An order represents a customer purchase in Moonbase. Every checkout, whether paid or free, creates an order that moves through a short lifecycle: it starts Open, becomes Paid once payment is captured, and then Completed once Moonbase has fulfilled it by issuing licenses and sending the receipt. Use these endpoints to read orders from other systems, for example to reconcile revenue or sync purchases into your own tooling, to prepare an order for a customer to pay for, to refund all or part of one, to record sales another store or reseller makes as they happen, or to import purchases made before you moved to Moonbase.
The order object contains the following:
- Name
adConsent- Type
- object
- Optionality
- optional
- Description
The recorded advertising choice, when known.
- Name
id- Type
- string
- Description
Unique identifier of the order.
- Name
number- Type
- number
- Optionality
- optional
- Description
The order number on the customer's receipt (the invoice number, when the receipt is an invoice), which is what a customer quotes when they contact you. Omitted until the order is paid, and on free orders and orders recorded or imported from elsewhere.
- Name
status- Type
- enum(Open|PaymentProcessing|Paid|Completed|Failed)
- Description
The current status of the order:
- Open: The order has been created but not yet paid.
- PaymentProcessing: Payment is being processed.
- Paid: Payment has been captured, fulfillment is pending.
- Completed: The order has been paid and fulfilled.
- Failed: The payment failed and the order was not completed.
- Name
currency- Type
- string
- Description
The currency used for this purchase.
- Name
channel- Type
- string
- Description
Where the sale was made:
moonbasefor your Moonbase checkout,importfor imported orders without a channel of their own, or the channel a sale was recorded or imported under, such asmy-shopify-store.
- Name
externalId- Type
- string
- Optionality
- optional
- Description
The order's reference in the store where it was made, for a recorded or imported order, stored trimmed and in lowercase. Omitted on orders from your Moonbase checkout.
- Name
completedAt- Type
- datetime
- Optionality
- optional
- Description
The timestamp for when the order was completed. Omitted while the order is not completed.
- Name
refundedAt- Type
- datetime
- Optionality
- optional
- Description
The timestamp for when the order was fully refunded. Omitted while the order is not fully refunded.
- Name
isFullyRefunded- Type
- boolean
- Description
Whether the entire order has been refunded. Remains
falsefor a partial refund, even thoughrefundHistorylists the refunded amounts.
- Name
isPartiallyRefunded- Type
- boolean
- Description
Whether the order has been partially but not fully refunded.
trueonce at least one refund has settled while the order still has unrefunded units.
- Name
totalRefundedAmount- Type
- object
- Optionality
- optional
- Description
The total amount refunded across all settled refunds, with
currencyandamountproperties. Omitted while nothing has been refunded.
- Name
refundHistory- Type
- array
- Optionality
- optional
- Description
The settled refunds applied to this order, present once at least one refund has settled. Each entry describes a single refund:
- Name
id- Type
- string
- Description
Unique identifier of the refund.
- Name
at- Type
- datetime
- Description
The timestamp for when this refund was made.
- Name
amount- Type
- object
- Description
The amount refunded to the customer in this refund, containing:
currency: The currency of the refunded amount.amount: The refunded amount.
- Name
lineItems- Type
- array
- Description
The order line items covered by this refund, each containing:
- Name
lineItemId- Type
- string
- Description
Identifier of the refunded order line item. Matches the
lineItemIdof an entry in the order'sitemsarray.
- Name
quantity- Type
- number
- Description
The number of units refunded for this line item in this refund.
- Name
amount- Type
- object
- Description
The amount refunded to the customer for this line item, with the same
currencyandamountproperties as above.
- Name
kind- Type
- enum(Sale|TaxAdjustment)
- Description
What the refund returned.
Salefor a refund of the purchase itself,TaxAdjustmentfor over-collected tax returned after business details were applied to a completed purchase. ATaxAdjustmentrefunds no units, so each of itslineItemscarries aquantityof0, and neitherisFullyRefundednorisPartiallyRefundedchanges.
- Name
reason- Type
- enum(Duplicate|PurchasedByMistake|ChangedMind|NotAsExpected|TechnicalIssues|Fraudulent|Other)
- Nullability
- nullable
- Description
Why the order was refunded.
nullwhen no reason was given, and on aTaxAdjustment.
- Name
comment- Type
- string
- Nullability
- nullable
- Description
Anything added about the refund when it was made.
- Name
isDisputed- Type
- boolean
- Description
Flag indicating if this purchase has been disputed.
- Name
dispute- Type
- object
- Optionality
- optional
- Description
The chargeback the buyer's bank opened on the order: when it was opened (
at), thereasongiven, the disputedamountin the buyer's currency, whether it isresolved(andresolvedAt), and whether youwonit. An array when the order has been disputed more than once. Omitted on orders that were never disputed.
- Name
total- Type
- object
- Description
Calculated total for all items part of the order. Each value is an object with
currencyandamountproperties:original: The original amount before discounts.discount: The total amount of discounts applied.subtotal: The total amount after discounts have been removed.taxes: Total taxes to pay, may be inclusive or exclusive of thesubtotaldepending on configuration, currency and region.due: How much is being paid in total by the customer.
- Name
payout- Type
- object
- Optionality
- optional
- Description
Payout details for this order, only present if an amount is to be paid out. Note that this may get updated as affiliate revenue splits are calculated later in the pipeline.
subtotal: The original amount paid by the customer.taxes: The total amount of taxes collected and remitted.platformFees: The total amount of fees going to Moonbase.due: How much is being paid out to you.
- Name
customer- Type
- object
- Optionality
- optional
- Description
Billing details about the customer who made the purchase:
- Name
name- Type
- string
- Description
Full name of the customer.
- Name
businessName- Type
- string
- Nullability
- nullable
- Description
In case the purchase was a business purchase, this field will have the name.
- Name
taxId- Type
- string
- Nullability
- nullable
- Description
In case the purchase was a business purchase, this field will have the tax id if given.
- Name
email- Type
- string
- Description
Email address of the customer.
- Name
phone- Type
- string
- Nullability
- nullable
- Description
Phone number of the customer. Note that collecting phone numbers is an optional feature in Moonbase and not activated by default.
- Name
address- Type
- object
- Nullability
- nullable
- Description
Billing address for the customer, not present if the purchase was a lead generator purchase. 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.
- Name
gift- Type
- object
- Optionality
- optional
- Description
Present when the buyer sent the order as a gift, on accounts with gift purchases turned on.
customerstays the buyer. The order's lines have nofulfillmentuntil the gift is claimed, and what they deliver then belongs to whoever claimed it.- Name
recipient- Type
- object
- Description
Who the buyer sent it to, with
nameandemail.
- Name
senderName- Type
- string
- Description
The buyer's name as the recipient sees it.
- Name
message- Type
- string
- Nullability
- nullable
- Description
The buyer's personal message.
- Name
delivery- Type
- object
- Description
When the recipient is emailed, discriminated by
type:Immediate, right after payment, orScheduled, with the buyer'sdate,time(HH:mm) andtimeZone, anddeliverAtin UTC.
- Name
status- Type
- enum(Pending|Scheduled|Sent|Claimed|Voided)
- Description
Where the gift stands: not paid for yet, paid with the email waiting for its date, emailed and not claimed, claimed, or refunded before anyone claimed it, so its code no longer works.
- Name
emailedAt- Type
- datetime
- Nullability
- nullable
- Description
When the gift email went out.
- Name
emailedTo- Type
- string
- Nullability
- nullable
- Description
The address that email went to.
- Name
claim- Type
- object
- Nullability
- nullable
- Description
Who claimed it and when (
at).customer, with theirid,nameandemail, is only included when you get the order by ID.failureReasonsays why delivering it failed, while it does: the recipient claiming again delivers what is missing.
- Name
voidedAt- Type
- datetime
- Nullability
- nullable
- Description
When a refund voided the gift.
- Name
couponsApplied- Type
- array
- Description
The coupons applied to this order, if any. Each entry contains:
- Name
id- Type
- string
- Description
Unique identifier of the coupon.
- Name
code- Type
- string
- Description
The coupon code that was redeemed.
- Name
name- Type
- string
- Description
Display name of the coupon.
- Name
description- Type
- string
- Description
Description of the coupon.
- Name
combinable- Type
- boolean
- Description
Whether this coupon can be combined with other discounts.
- Name
discount- Type
- object
- Description
The discount granted by the coupon, discriminated using the
typeproperty:PercentageOffDiscount: has apercentageproperty with a value between 0 and 1.FlatAmountOffDiscount: has atotalproperty mapping currency codes to amounts.
- Name
applicableProductVariations- Type
- object
- Description
Map of product IDs to the pricing variation IDs the coupon applies to. Empty when the coupon applies to the whole order.
- Name
applicableBundleVariations- Type
- object
- Description
Map of bundle IDs to the pricing variation IDs the coupon applies to. Empty when the coupon applies to the whole order.
- Name
items- Type
- array
- Description
Collection of items part of the order. Note that this can be either products or bundles, and they are discriminated using the
typeproperty. Some properties are specific to each type, others are shared:- Name
type- Type
- 'Product'
- Description
Item type discriminator.
- Name
productId- Type
- string
- Description
The unique ID of the product.
- Name
targetLicenseId- Type
- string
- Optionality
- optional
- Description
The customer's license this line upgrades or renews, for a license that covers only some releases.
Product line item
- Name
type- Type
- 'Bundle'
- Description
Item type discriminator.
- Name
bundleId- Type
- string
- Description
The unique ID of the bundle.
Bundle line item
- Name
lineItemId- Type
- string
- Description
Stable identifier of this order line item. Use it to correlate entries in
refundHistoryback to the line they refunded.
- Name
variationId- Type
- string
- Description
The ID of the selected pricing variation.
- Name
quantity- Type
- number
- Description
The quantity of this item.
- Name
price- Type
- object
- Description
The original per-unit price, as a map of currency codes to amounts.
- Name
total- Type
- object
- Description
The calculated total for this line item, with
original,discount,subtotalanddueamounts.When you need to know where the discount came from, the line total also splits it per source, each amount being what one unit of the line was discounted by:
productDiscountfor the discount on the product itself,offerDiscountfor an offer picked for this item,couponDiscountfor a redeemed code, andcartOfferDiscountfor this line's share of a cart offer applied to the order as a whole. All four are omitted on older orders that were priced before the split existed.
- Name
variation- Type
- object
- Optionality
- optional
- Description
Details about the selected pricing variation, including its
id,name,entitlement,recurrenceandprice.
- Name
fulfillment- Type
- object
- Optionality
- optional
- Description
Details about how the line item was fulfilled, discriminated using the
typeproperty. For aLicensefulfillment this includes the issuedlicenseIds, andextendedLicenseIdsfor the licenses an upgrade or renewal extended instead.
- Name
refundedAmount- Type
- object
- Optionality
- optional
- Description
The amount refunded for this line item so far, with
currencyandamountproperties. Omitted while nothing has been refunded for the line.
- Name
isLineFullyRefunded- Type
- boolean
- Description
Whether every unit of this line item has been refunded.
Shared
- Name
created- Type
- object
- Description
When the order was created, containing an
attimestamp.
- Name
lastUpdated- Type
- object
- Description
When the order was last updated, containing an
attimestamp.
- Name
withdrawalConsent- Type
- object
- Optionality
- optional
- Description
The consumer right of withdrawal on this order. EU and EEA consumers have to waive it at checkout before their purchase can be delivered. Omitted on orders the right does not cover, which is every order billed outside the EU and EEA and every business purchase.
- Name
required- Type
- boolean
- Description
Whether the buyer has to waive the right to check out.
- Name
statement- Type
- string
- Description
The wording the buyer agreed to, or is being asked to agree to.
- Name
grantedAt- Type
- datetime
- Optionality
- optional
- Description
When the buyer waived the right. Omitted until they do, so a required consent without
grantedAtis an order the buyer can still withdraw from.
- Name
receiptUrl- Type
- string
- Optionality
- optional
- Description
A link to the order's receipt as a PDF, for you to send to your customer, for example from your own emails or support replies. It opens without signing in and does not expire, so anyone holding it can read the receipt, including the buyer's name, address and tax ID. Send it to the buyer only, rather than logging it or putting it on a page others can see.
Present once the order is completed. Omitted on orders paid outside Moonbase, recorded or imported, since the customer has a receipt from whoever took their payment. Always use this field rather than building a receipt link from the order ID, which will not open.
Order example
{
"id": "dc0b53f9-4e43-4179-8554-00f2a8228a25",
"number": 184213,
"status": "Completed",
"currency": "EUR",
"channel": "moonbase",
"completedAt": "2024-11-11T11:11:11.0000000Z",
"isFullyRefunded": false,
"isPartiallyRefunded": false,
"isDisputed": false,
"total": {
"original": { "currency": "EUR", "amount": 10 },
"discount": { "currency": "EUR", "amount": 5 },
"subtotal": { "currency": "EUR", "amount": 5 },
"taxes": { "currency": "EUR", "amount": 0 },
"due": { "currency": "EUR", "amount": 5 }
},
"payout": {
"subtotal": { "currency": "EUR", "amount": 5 },
"taxes": { "currency": "EUR", "amount": 0 },
"platformFees": { "currency": "EUR", "amount": 0.5 },
"due": { "currency": "EUR", "amount": 4.5 }
},
"customer": {
"name": "Example User",
"businessName": null,
"taxId": null,
"email": "user@example.com",
"phone": null,
"address": {
"countryCode": "NO",
"streetAddress1": "Utsikten 6",
"streetAddress2": null,
"locality": "Skien",
"region": null,
"postCode": "3718"
}
},
"couponsApplied": [
{
"id": "43396b94-53b4-4901-8e9e-ab1d6ee7d3b5",
"code": "MY-UNIQUE-CODE",
"name": "Half off coupon",
"description": "Thanks for being our customer!",
"combinable": false,
"discount": {
"type": "PercentageOffDiscount",
"percentage": 0.5
},
"applicableProductVariations": {},
"applicableBundleVariations": {}
}
],
"items": [
{
"type": "Product",
"lineItemId": "7c1f0b2a-9d3e-4a5b-8c6d-0e1f2a3b4c5d",
"productId": "example-app",
"variationId": "v802c5",
"quantity": 1,
"price": {
"EUR": 10
},
"total": {
"original": { "currency": "EUR", "amount": 10 },
"discount": { "currency": "EUR", "amount": 5 },
"subtotal": { "currency": "EUR", "amount": 5 },
"due": { "currency": "EUR", "amount": 5 }
},
"variation": {
"id": "v802c5",
"name": "Default",
"entitlement": { "type": "PerpetualLicense" },
"recurrence": { "type": "OneOff" },
"price": { "EUR": 10 }
},
"fulfillment": {
"type": "License",
"licenseIds": [
"d564a47a-d7f3-48ea-8698-57ad7512b11d"
]
},
"isLineFullyRefunded": false
}
],
"created": { "at": "2024-11-11T11:11:10.0000000Z" },
"lastUpdated": { "at": "2024-11-11T11:11:11.0000000Z" },
"withdrawalConsent": {
"required": true,
"statement": "I want immediate access to my purchase, and I acknowledge that I thereby lose my 14-day right of withdrawal.",
"grantedAt": "2024-11-11T11:11:10.0000000Z"
},
"receiptUrl": "https://demo.moonbase.sh/api/customer/orders/dc0b53f9-4e43-4179-8554-00f2a8228a25/receipt?t=CfDJ8Nw3..."
}
Get orders
Use this endpoint to fetch all orders page by page, newest first. For more details on how pagination works, see pagination.
Optional query parameters
- Name
pageSize- Type
- number
- Optionality
- optional
- Description
Adjust the size of each page returned.
- Name
status- Type
- enum(Open|PaymentProcessing|Paid|Completed|Failed)
- Optionality
- optional
- Description
Only return orders with the given status.
- Name
before- Type
- datetime
- Optionality
- optional
- Description
ISO-8601 timestamp; only return orders created before this point in time.
- Name
after- Type
- datetime
- Optionality
- optional
- Description
ISO-8601 timestamp; only return orders created after this point in time.
Request
GET https://demo.moonbase.sh/api/orders
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"items": [
{
"id": "dc0b53f9-4e43-4179-8554-00f2a8228a25",
"status": "Completed",
"currency": "EUR",
...
}
],
"hasMore": false,
"next": null
}
Get order by ID
Use this endpoint to look up a single order by its ID. If no order exists with the given ID, the API responds with 404: Not Found.
This is also how you get a receipt link to send a customer who asks for their receipt: a completed order comes with its receiptUrl.
Request
GET https://demo.moonbase.sh/api/orders/dc0b53f9-4e43-4179-8554-00f2a8228a25
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"id": "dc0b53f9-4e43-4179-8554-00f2a8228a25",
"status": "Completed",
"currency": "EUR",
...
"receiptUrl": "https://demo.moonbase.sh/api/customer/orders/dc0b53f9-4e43-4179-8554-00f2a8228a25/receipt?t=CfDJ8Nw3..."
}
Get order by external ID
Use this endpoint to find an order you recorded or imported by its reference in the store where it was made, for example when that store tells you about a refund.
Letter case and surrounding whitespace are ignored. If no order has the reference, the API responds with 404: Not Found.
Required query parameters
- Name
externalId- Type
- string
- Description
The order's reference in the store where it was made.
Request
GET https://demo.moonbase.sh/api/orders/external?externalId=SHOP-1001
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"id": "2b9d5c1e-7f4a-5e3b-9c8d-1a2b3c4d5e6f",
"status": "Completed",
"currency": "EUR",
"channel": "my-shopify-store",
"externalId": "shop-1001",
...
}
Prepare order
Use this endpoint to put an order together on your own server and send the customer straight to checkout to pay for it, for example from your app, a sales tool or a support conversation.
Prices come from the products and bundles in your Moonbase account, unless you set an item's price yourself with variation.
A product or bundle that isn't purchasable can still be sold this way, while it stays off your storefront.
The response is the new order with a status of Open, along with three URLs to pay for it. Which one you use decides how checkout is presented:
- Name
checkoutUrl- Type
- string
- Description
URL to pay for the order, pointing at whichever checkout the storefront mode of your Moonbase account is configured for.
- Name
hostedCheckoutUrl- Type
- string
- Description
URL to pay for the order on the Moonbase hosted checkout, as a full-page navigation.
- Name
embeddedCheckoutUrl- Type
- string
- Description
URL to pay for the order in an iframe on a page of your own.
The checkout URLs are only returned here, not when you get the order later.
If the request names a customer that does not exist, or is otherwise invalid, the API responds with 400: Bad Request and a description of the problem.
Required body properties
- Name
currency- Type
- string
- Description
Three-letter code of the currency to price the order in, for example
USD. Checkout may still change it based on the customer's location and your account settings.
- Name
items- Type
- array
- Description
The products and bundles the customer is buying, each containing:
- Name
type- Type
- enum(Product|Bundle)
- Description
Whether this item is a product or a bundle.
- Name
productId- Type
- string
- Description
The ID of the product. Required when
typeisProduct.
- Name
bundleId- Type
- string
- Description
The ID of the bundle. Required when
typeisBundle.
- Name
variationId- Type
- string
- Optionality
- optional
- Description
The ID of the pricing variation to sell. Defaults to the default pricing variation of the product or bundle.
- Name
variation- Type
- object
- Optionality
- optional
- Description
A pricing variation of your own, to sell the item at a price your server sets rather than the catalog's. It takes the same shape as an order line's
variation:id,name,entitlement,recurrenceandprice. Like a product's prices,price(and any pricing tiers or renewal price) must include your account's default currency, which is converted into the buyer's currency where you leave theirs out. A variation without it, or without anentitlementorrecurrence, responds with400: Bad Request. The customer cannot change the items of an order you priced this way.
- Name
quantity- Type
- number
- Description
The number of units to sell.
- Name
targetLicenseId- Type
- string
- Optionality
- optional
- Description
For a product sold with licenses that cover only some releases, the customer's license this item upgrades or renews. Buying it extends that license instead of issuing a new one, and any upgrade discount on the product applies. The
quantitymust be 1, and each license can only be named once per order, so add one item per license. Without it, the purchase issues new licenses.
Optional body properties
- Name
customer- Type
- object
- Optionality
- optional
- Description
Billing details to prefill at checkout, with the same
name,businessName,taxId,email,phoneandaddressproperties as the order'scustomer.
- Name
customerId- Type
- string
- Optionality
- optional
- Description
The ID of an existing customer to attach the order to. The purchase goes to this customer's account whatever email address is entered at checkout. When you leave out
customer, the checkout is prefilled with this customer's details.
- Name
channel- Type
- string
- Optionality
- optional
- Description
Where the sale came from, for example
my-website. Letters, digits and dashes only, stored in lowercase. Sales analytics can filter on it and break revenue down by it. Defaults tomoonbase.
Optional query parameters
- Name
returnUrl- Type
- string
- Optionality
- optional
- Description
Where the customer should be sent after a successful purchase.
Request
POST https://demo.moonbase.sh/api/orders/prepare?returnUrl=https%3A%2F%2Fround-lake.dustinice.workers.dev%3A443%2Fhttps%2Fexample.com%2Fthanks
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"currency": "USD",
"items": [
{
"type": "Product",
"productId": "example-app",
"quantity": 1
}
],
"customer": {
"name": "Example User",
"email": "user@example.com"
}
}
Response
{
"id": "5d3a2c26-d09f-45b3-b018-3461c20efc23",
"status": "Open",
"currency": "USD",
...
"checkoutUrl": "https://demo.moonbase.sh/checkout/5d3a2c26-d09f-45b3-b018-3461c20efc23?return=https%3A%2F%2Fround-lake.dustinice.workers.dev%3A443%2Fhttps%2Fexample.com%2Fthanks",
"hostedCheckoutUrl": "https://demo.moonbase.sh/checkout/5d3a2c26-d09f-45b3-b018-3461c20efc23?return=https%3A%2F%2Fround-lake.dustinice.workers.dev%3A443%2Fhttps%2Fexample.com%2Fthanks",
"embeddedCheckoutUrl": "https://demo.moonbase.sh/embedded/checkout/5d3a2c26-d09f-45b3-b018-3461c20efc23?return=https%3A%2F%2Fround-lake.dustinice.workers.dev%3A443%2Fhttps%2Fexample.com%2Fthanks"
}
Refund order
Use this endpoint to refund an order paid through your Moonbase checkout, in full or in part.
The money goes back to the payment method the customer used, the refunded licenses are revoked, the customer gets a refund email, and the OrderRefunded webhook is sent.
Send no body, or leave out items, to refund everything not yet refunded.
The response is the order with the refund in its refundHistory.
If no order has the ID, the API responds with 404: Not Found, and one that is already fully refunded responds with 409: Conflict.
An order that is not completed yet, is disputed, or was completed more than 14 days ago responds with 400: Bad Request, as does a selection naming an unknown line or more units than it has left.
To refund an order you recorded or imported, record its refund instead.
Optional body properties
- Name
items- Type
- array
- Optionality
- optional
- Description
The lines and units to refund, for a partial refund. Each entry contains:
- Name
lineItemId- Type
- string
- Description
The
lineItemIdof the line on the order.
- Name
quantity- Type
- number
- Optionality
- optional
- Description
How many of the line's units to refund. Defaults to all that are left.
- Name
reason- Type
- enum(Duplicate|PurchasedByMistake|ChangedMind|NotAsExpected|TechnicalIssues|Fraudulent|Other)
- Optionality
- optional
- Description
Why the order is refunded.
- Name
comment- Type
- string
- Optionality
- optional
- Description
Anything to add about the refund, up to 1,000 characters.
Request
POST https://demo.moonbase.sh/api/orders/dc0b53f9-4e43-4179-8554-00f2a8228a25/refund
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"items": [
{
"lineItemId": "7c1f0b2a-9d3e-4a5b-8c6d-0e1f2a3b4c5d",
"quantity": 1
}
],
"reason": "PurchasedByMistake"
}
Response
{
"id": "dc0b53f9-4e43-4179-8554-00f2a8228a25",
"number": 184213,
"status": "Completed",
"currency": "EUR",
"isFullyRefunded": false,
"isPartiallyRefunded": true,
...
}
Record external order
Use this endpoint to record a sale another store or reseller has just made, so Moonbase delivers it the way it delivers a checkout. Moonbase issues the licenses, from Moonbase, the product's key pool or its license generator, or attaches the keys the store already gave the buyer. The completed order then reaches your webhooks, marketing integrations, customer groups and automations like any other sale.
The response is the order with a status of Paid. Delivery follows within moments: the OrderCompleted webhook tells you when, and the order then lists the licenses on each line.
An order that cannot be delivered, for example because the key pool ran out, is listed under Sales > Failed in Moonbase for you to retry.
Since the payment was taken elsewhere, the order is never part of your payouts, and Moonbase does not send the buyer a receipt or order confirmation.
Put the accountLink from the response in the receipt your store sends, so the buyer can find their purchase in your customer portal:
- Name
accountLink- Type
- object
- Optionality
- optional
- Description
The link the buyer creates their account or logs in with, the same one a Moonbase order confirmation would carry. Only returned by this endpoint, and omitted when your Moonbase account has no customer portal.
- Name
kind- Type
- enum(CreateAccount|LogIn)
- Description
CreateAccountfor a buyer without a password yet, who confirms their email address and chooses one.LogInfor a buyer who already has an account.
- Name
url- Type
- string
- Description
The link itself. A
CreateAccountlink lets whoever holds it set the account's password, so give it to the buyer only. It is valid for 30 days, and a buyer who follows an expired one is emailed a new one.
Sending the same sale again, with the same externalId, channel and buyer, responds with the order already recorded and a fresh accountLink instead of recording it twice, so a request that timed out is safe to retry.
The same externalId for another buyer or channel, or one you imported, responds with 409: Conflict.
Any other problem, such as an unknown product, responds with 400: Bad Request describing what is wrong, and nothing is recorded.
Required body properties
- Name
externalId- Type
- string
- Description
The order's reference in the store where it was made.
- Name
channel- Type
- string
- Description
Where the sale was made, for example
my-shopify-store. Letters, digits and dashes only, stored in lowercase. Sales analytics can filter on it and break revenue down by it. Cannot bemoonbaseorimport.
- Name
currency- Type
- string
- Description
Three-letter code of the currency the buyer paid in.
- Name
lines- Type
- array
- Description
The line items of the order, at least one. Amounts follow
taxModewhen supplied, otherwise the tax mode of your prices in that currency. With inclusive prices,unitPrice,discountandtotalinclude tax, andtaxesis the tax portion. With exclusive prices, taxes come on top. Each line contains:- Name
productId- Type
- string
- Optionality
- optional
- Description
The ID of the product sold on this line. Each line needs exactly one of
productIdandbundleId.
- Name
bundleId- Type
- string
- Optionality
- optional
- Description
The ID of the bundle sold on this line.
- Name
variationId- Type
- string
- Optionality
- optional
- Description
The ID of the pricing variation sold. Defaults to the current default pricing variation of the product or bundle. A recurring pricing variation is only accepted when the line carries the keys or licenses the buyer was given, since Moonbase cannot renew a subscription it does not bill.
- Name
quantity- Type
- number
- Optionality
- optional
- Description
The number of units sold. Defaults to
1.
- Name
unitPrice- Type
- number
- Optionality
- optional
- Description
The price of one unit before discounts. Defaults to
0.
- Name
discount- Type
- number
- Optionality
- optional
- Description
The discount on one unit. Defaults to
0.
- Name
taxes- Type
- number
- Optionality
- optional
- Description
The total tax on the whole line. Defaults to
0.
- Name
total- Type
- number
- Optionality
- optional
- Description
The total for the whole line, treating tax the same way as
unitPrice. Defaults tounitPriceminusdiscount, timesquantity. Supply it to keep the store's own rounding. It has to agree with the per-unit amounts to within a cent per unit.
- Name
received- Type
- number
- Optionality
- optional
- Description
What the store paid you for the whole line, after keeping its cut and excluding tax. Net revenue in your sales analytics then shows this instead of the buyer's price before tax. It never counts as a payout. Send it on every line of the order or on none, and no more than the buyer paid for the line before tax.
- Name
provisionLicenses- Type
- boolean
- Optionality
- optional
- Description
Deliver licenses for this line. Without
keyCodesorgeneratedLicenses, Moonbase issues them the way it does at checkout. Leave it out when the store delivered everything the buyer got.
- Name
keyCodes- Type
- array
- Optionality
- optional
- Description
The license keys the store gave the buyer, one per unit. Requires
provisionLicenses, and only works on product lines. Keys from the product's key pool in Moonbase are taken out of the pool, and a key the pool has already issued responds with409: Conflict.
- Name
generatedLicenses- Type
- array
- Optionality
- optional
- Description
For a product on a license generator other than iLok, the licenses the generator issued when the store called it, one per unit. Moonbase records them as the generator's own instead of calling it again. Requires
provisionLicenses, only works on product lines, and cannot be combined withkeyCodes.
- Name
licenseExpiresAt- Type
- datetime
- Optionality
- optional
- Description
When the licenses from this line expire, as an ISO-8601 date and time. Only accepted with
keyCodesorgeneratedLicenses, since a license Moonbase issues takes its terms from the pricing variation.
Customer properties
Every order needs a buyer. Provide either customerId or customer, not both.
With the customer portal enabled, customer.email identifies the customer, and customer.externalId is only kept on a customer created here. Without the portal, where several customers may share an email, customer.externalId also tells them apart, and a new customer is created when none has it. Customer external IDs sent by connected apps are ignored, because those IDs belong to the app's store. The order's own externalId still identifies the sale.
- Name
customerId- Type
- string
- Optionality
- optional
- Description
The ID of an existing customer who made the purchase.
- Name
customer- Type
- object
- Optionality
- optional
- Description
The buyer as the store knows them, matched to an existing customer as described above. They get an account when there is none, as a buyer at checkout does. The order keeps the details given here as its billing details, while an existing customer's profile is left as it is.
- Name
email- Type
- string
- Description
Email address of the buyer.
- Name
name- Type
- string
- Optionality
- optional
- Description
Full name of the buyer.
- Name
externalId- Type
- string
- Optionality
- optional
- Description
ID of this buyer in the store.
- Name
address- Type
- object
- Optionality
- optional
- Description
Billing address of the buyer, with the same properties as when importing a customer.
- Name
businessName- Type
- string
- Optionality
- optional
- Description
Registered business name, for a purchase made on behalf of a company.
- Name
taxId- Type
- string
- Optionality
- optional
- Description
The buyer's business tax ID, for example a VAT number. Only kept when
addresshas acountryCode.
- Name
phone- Type
- string
- Optionality
- optional
- Description
Phone number of the buyer.
Optional body properties
- Name
taxMode- Type
- enum(Inclusive|Exclusive)
- Optionality
- optional
- Description
Whether line
unitPrice,discountandtotalalready include tax (Inclusive) or have tax added (Exclusive). Defaults to the account's pricing mode for this currency under Account settings > Payments.
- Name
completedAt- Type
- datetime
- Optionality
- optional
- Description
When the purchase was made, as an ISO-8601 date and time. Defaults to now. Taken as UTC when it has no offset, and cannot be in the future.
- Name
marketingOptIn- Type
- boolean
- Optionality
- optional
- Description
Set to
trueonly when the buyer agreed, where they bought, to hear from you and not just from the store. They are then subscribed to your newsletter and product updates, as with the opt-in at checkout. Without it, Moonbase sends them no marketing emails.
- Name
utm- Type
- object
- Optionality
- optional
- Description
The UTM tags the buyer arrived at the store with:
source,medium,campaign,term,content, and thereferrer. Sales analytics break the sale down by them, and a sale tagged by one of your campaigns counts towards its results.
Request
POST https://demo.moonbase.sh/api/orders/external
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"externalId": "SHOP-1001",
"channel": "my-shopify-store",
"currency": "EUR",
"customer": {
"email": "user@example.com",
"name": "Example User"
},
"lines": [
{
"productId": "example-app",
"unitPrice": 40,
"taxes": 8,
"received": 22.40,
"provisionLicenses": true
}
]
}
Response
{
"id": "2b9d5c1e-7f4a-5e3b-9c8d-1a2b3c4d5e6f",
"status": "Paid",
"currency": "EUR",
"channel": "my-shopify-store",
"externalId": "shop-1001",
...
"accountLink": {
"kind": "CreateAccount",
"url": "https://demo.moonbase.sh/sign-up?email=user%40example.com&code=CfDJ8Nw3..."
}
}
Record external refund
Use this endpoint to record a refund or chargeback that the store which sold an order has made, on an order you recorded or imported.
No money moves, since the store already returned it. The refunded licenses are revoked, the refund no longer counts towards the customer's lifetime value, and the OrderRefunded webhook is sent, as for a refund made in Moonbase.
The response is the order with the refund in its refundHistory. Sending a refundId that is already recorded responds with the order as it stands, so a retry is safe.
If no order has the externalId, the API responds with 404: Not Found. An order that is not completed yet responds with 400: Bad Request, and one that is already fully refunded with 409: Conflict.
Required body properties
- Name
externalId- Type
- string
- Description
The order's reference in the store where it was made, as you recorded or imported it.
- Name
refundId- Type
- string
- Description
The refund's reference in the store.
Optional body properties
- Name
lines- Type
- array
- Optionality
- optional
- Description
The lines and units that were refunded. Leave it out to refund everything not yet refunded. Each entry contains:
- Name
lineItemId- Type
- string
- Description
The
lineItemIdof the refunded line on the order.
- Name
quantity- Type
- number
- Optionality
- optional
- Description
How many of the line's units were refunded. Defaults to all that are left.
- Name
refundedAt- Type
- datetime
- Optionality
- optional
- Description
When the store made the refund, as an ISO-8601 date and time. Defaults to now. Taken as UTC when it has no offset, and cannot be in the future or before the purchase.
- Name
reason- Type
- enum(Duplicate|PurchasedByMistake|ChangedMind|NotAsExpected|TechnicalIssues|Fraudulent|Other)
- Optionality
- optional
- Description
Why the order was refunded.
- Name
comment- Type
- string
- Optionality
- optional
- Description
Anything to add about the refund, up to 1,000 characters.
Request
POST https://demo.moonbase.sh/api/orders/external/refunds
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"externalId": "SHOP-1001",
"refundId": "SHOP-R-2001",
"reason": "ChangedMind"
}
Response
{
"id": "2b9d5c1e-7f4a-5e3b-9c8d-1a2b3c4d5e6f",
"status": "Completed",
"currency": "EUR",
"channel": "my-shopify-store",
"externalId": "shop-1001",
"isFullyRefunded": true,
"isPartiallyRefunded": false,
...
}
Import order
Importing an order records a purchase made in another system as a completed order in Moonbase, so your customers' purchase history and lifetime value carry over when you migrate.
The order is dated from when the purchase happened, not from when you import it, and importing it sends no emails or webhooks.
Since the payment was taken elsewhere, an imported order is never part of your payouts and has no receiptUrl, and a refund the other store makes is recorded rather than paid through Moonbase.
For sales another store or reseller is still making, record them as they happen instead.
Each externalId can only be imported once. Importing it again responds with 409: Conflict rather than creating a second order, and letter case and surrounding whitespace are ignored when comparing.
Any other problem, such as an unknown product or a line total that does not add up, responds with 400: Bad Request describing what is wrong, and nothing is imported.
Required body properties
- Name
externalId- Type
- string
- Description
The order's reference in the system you are moving from.
- Name
currency- Type
- string
- Description
Three-letter code of the currency the purchase was paid in.
- Name
completedAt- Type
- datetime
- Description
When the purchase happened, as an ISO-8601 date and time. Taken as UTC when it has no offset, and cannot be in the future.
- Name
lines- Type
- array
- Description
The line items of the order, at least one. Amounts follow
taxModewhen supplied, otherwise the tax mode of your prices in that currency: when prices include tax, so dounitPrice,discountandtotal, andtaxesis the part of them that was tax. Otherwisetaxescomes on top. Each line contains:- Name
productId- Type
- string
- Optionality
- optional
- Description
The ID of the product sold on this line. Each line needs exactly one of
productIdandbundleId.
- Name
bundleId- Type
- string
- Optionality
- optional
- Description
The ID of the bundle sold on this line.
- Name
variationId- Type
- string
- Optionality
- optional
- Description
The ID of the pricing variation sold. Defaults to the current default pricing variation of the product or bundle.
- Name
quantity- Type
- number
- Optionality
- optional
- Description
The number of units sold. Defaults to
1.
- Name
unitPrice- Type
- number
- Optionality
- optional
- Description
The price of one unit before discounts. Defaults to
0.
- Name
discount- Type
- number
- Optionality
- optional
- Description
The discount on one unit. Defaults to
0.
- Name
taxes- Type
- number
- Optionality
- optional
- Description
The total tax on the whole line. Defaults to
0.
- Name
total- Type
- number
- Optionality
- optional
- Description
The total for the whole line, treating tax the same way as
unitPrice: including it when prices include tax, and before tax otherwise, withtaxesadded on top. Defaults tounitPriceminusdiscount, timesquantity. Supply it to keep the rounding of the system you are moving from. It has to agree with the per-unit amounts to within a cent per unit.
- Name
received- Type
- number
- Optionality
- optional
- Description
For a sale a store or reseller made, what it paid you for the whole line, after keeping its cut and excluding tax. Net revenue in your sales analytics then shows this instead of the buyer's price before tax. Send it on every line of the order or on none.
- Name
provisionLicenses- Type
- boolean
- Optionality
- optional
- Description
Issue the licenses this line delivered, using the product's current license settings. Products that get their licenses from a key pool or an external generator also need
keyCodes, since Moonbase will not issue a new key for a purchase that was already fulfilled.
- Name
keyCodes- Type
- array
- Optionality
- optional
- Description
The license keys this line delivered, one per unit. Requires
provisionLicenses, and only works on product lines.
- Name
licenseExpiresAt- Type
- datetime
- Optionality
- optional
- Description
When the licenses from this line expire, as an ISO-8601 date and time. A date in the past imports them already expired.
Customer properties
Every order needs a customer. Provide either customerId or customer, not both.
With the customer portal enabled, customer.email identifies the customer, and customer.externalId is only kept on a customer created here. Without the portal, where several customers may share an email, customer.externalId also tells them apart, and a new customer is created when none has it. Customer external IDs sent by connected apps are ignored, because those IDs belong to the app's store. The order's own externalId still identifies the imported purchase.
- Name
customerId- Type
- string
- Optionality
- optional
- Description
The ID of an existing customer the purchase belongs to.
- Name
customer- Type
- object
- Optionality
- optional
- Description
The customer as your previous system knows them, matched to an existing customer as described above. They are created when there is none, without sending them any emails.
- Name
email- Type
- string
- Description
Email address of the customer.
- Name
name- Type
- string
- Optionality
- optional
- Description
Full name of the customer.
- Name
externalId- Type
- string
- Optionality
- optional
- Description
ID of this customer in your previous system.
- Name
address- Type
- object
- Optionality
- optional
- Description
Billing address of the customer, with the same properties as when importing a customer.
- Name
businessName- Type
- string
- Optionality
- optional
- Description
Registered business name, for a purchase made on behalf of a company.
- Name
taxId- Type
- string
- Optionality
- optional
- Description
The customer's business tax ID, for example a VAT number. Only kept when
addresshas acountryCode.
- Name
phone- Type
- string
- Optionality
- optional
- Description
Phone number of the customer.
Optional body properties
- Name
taxMode- Type
- enum(Inclusive|Exclusive)
- Optionality
- optional
- Description
Whether line
unitPrice,discountandtotalalready include tax (Inclusive) or have tax added (Exclusive). Defaults to the account's pricing mode for this currency under Account settings > Payments.
- Name
channel- Type
- string
- Optionality
- optional
- Description
Where the sale came from, for example
my-shopify-store, so you can tell sales from different sources apart. Letters, digits and dashes only, stored in lowercase. Defaults toimport.
Request
POST https://demo.moonbase.sh/api/orders/import
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"externalId": "ORD-1001",
"customerId": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"currency": "EUR",
"completedAt": "2024-03-01T10:00:00Z",
"lines": [
{
"productId": "example-app",
"quantity": 2,
"unitPrice": 40,
"taxes": 16,
"provisionLicenses": true
}
]
}
Response
{
"id": "8f14e45f-ceea-567a-9a36-0e4b8c1d2a7b",
"status": "Completed",
"currency": "EUR",
"completedAt": "2024-03-01T10:00:00.0000000Z",
...
}
Licenses
License endpoints let you manage the full life cycle of licenses, including individual activations. If you need to connect your own licensing system with Moonbase licenses, these endpoints should suffice. The license object contains the following:
- Name
variationId- Type
- string
- Optionality
- optional
- Description
The issuing product pricing variation, when known. Omitted on older licenses without one.
- Name
id- Type
- string
- Description
The Moonbase ID of the license.
- Name
ownerId- Type
- string
- Description
The Moonbase ID of the customer that owns this license.
- Name
productId- Type
- string
- Description
The Moonbase ID of the product that this license is for.
- Name
status- Type
- enum(Active|Revoked|Expired)
- Description
Current status of the license:
- Active: The license can be used by the customer
- Revoked: The license has been revoked by the merchant
- Expired: The subscription for the license has expired
- Name
activeNumberOfActivations- Type
- number
- Description
Number of devices currently activated on this license.
- Name
maxNumberOfActivations- Type
- number
- Description
Max number of devices allowed to activate this license.
- Name
offlineActivationsAllowed- Type
- boolean
- Description
Flag for if offline activations are allowed for this license.
- Name
releaseAccess- Type
- object
- Optionality
- optional
- Description
What a license that covers only some releases covers. Left out when the license covers every release.
- Name
updatesUntil- Type
- datetime
- Optionality
- optional
- Description
Releases published until then are covered, and every release while it hasn't passed.
- Name
upToMajor- Type
- number
- Optionality
- optional
- Description
Every version whose major version is at most this is covered.
A license with both covers a release that either of them covers.
- Name
properties- Type
- object
- Optionality
- optional
- Description
Custom properties attached to this license. See custom properties for more details on the shape and types of custom properties.
License example
{
"id": "32016591-73c5-4956-938c-e34366599bc7",
"ownerId": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"productId": "example-app",
"status": "Active",
"activeNumberOfActivations": 0,
"maxNumberOfActivations": 1,
"offlineActivationsAllowed": false
}
Get licenses
Use this endpoint to fetch all licenses page by page. For more details on how pagination works, see pagination.
Optional query parameters
- Name
pageSize- Type
- number
- Optionality
- optional
- Description
Adjust the size of each page returned.
- Name
productFilter- Type
- string
- Optionality
- optional
- Description
Optionally filter licenses belonging to this product ID.
- Name
before- Type
- datetime
- Optionality
- optional
- Description
Optionally filter licenses created before this ISO-8601 date and time.
- Name
after- Type
- datetime
- Optionality
- optional
- Description
Optionally filter licenses created after this ISO-8601 date and time.
Request
GET https://demo.moonbase.sh/api/licenses
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"items": [
{
"id": "32016591-73c5-4956-938c-e34366599bc7",
"ownerId": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"productId": "example-app",
"status": "Active",
...
}
],
"hasMore": false,
"next": null
}
Get license by ID
Use this endpoint to look up a license by its ID.
Request
GET https://demo.moonbase.sh/api/licenses/32016591-73c5-4956-938c-e34366599bc7
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"id": "32016591-73c5-4956-938c-e34366599bc7",
"ownerId": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"productId": "example-app",
"status": "Active",
...
}
Provision licenses
This endpoint can be used to create multiple licenses for a given customer for several products. In case you want to create the user in the same process, you may instead opt to provide customer details instead of an owner ID. The response will contain a list of licenses that have been provisioned.
Request body properties
- Name
ownerId- Type
- string
- Optionality
- optional
- Description
Moonbase ID of the customer that should receive the license(s). Skip this if submitting customer details instead.
- Name
customer- Type
- object
- Optionality
- optional
- Description
Provide this if you don't have an existing customer to grant the licenses to. This object must contain the following:
- Name
name- Type
- string
- Description
Full name of the customer.
- Name
email- Type
- string
- Description
Email address of the customer. If a customer already exists with this email, we attach the licenses to that user instead.
- Name
requests- Type
- array
- Description
A list of license requests that should be fulfilled, each object contain the following properties:
- Name
productId- Type
- string
- Description
Moonbase ID of the product you want to issue a license for.
- Name
quantity- Type
- number
- Optionality
- optional
- Description
Number of licenses to issue, defaults to 1.
- Name
limitPerCustomer- Type
- number
- Optionality
- optional
- Description
Use this to only provision licenses up to a certain number for the given customer.
- Name
expiresAt- Type
- datetime
- Optionality
- optional
- Description
ISO-8601 timestamp; if set, the provisioned licenses will expire at this point in time.
- Name
releaseAccess- Type
- object
- Optionality
- optional
- Description
Limits the licenses to some releases, with an
updatesUntildate, anupToMajorversion, or both, shaped like the license'sreleaseAccess. Left out, the licenses cover every release.
Request
POST https://demo.moonbase.sh/api/licenses/provision
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"ownerId": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"requests": [
{
"productId": "example-app"
}
]
}
Response
[
{
"id": "32016591-73c5-4956-938c-e34366599bc7",
"ownerId": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"productId": "example-app",
"status": "Active",
...
}
]
Import license
Importing a license is almost the same as provisioning it through the Moonbase app or API, with the exception of no communication to the customer being done. The license will be available on their account immediately, and can be used to import a large amount of licenses. This endpoint also allows you to add existing activations for a given license or external key codes previously generated, making migrations easier in some cases.
Request body properties
- Name
ownerId- Type
- string
- Optionality
- optional
- Description
Moonbase ID of the customer that should receive this license. Either
ownerIdorownerEmailmust be provided, but not both.
- Name
ownerEmail- Type
- string
- Optionality
- optional
- Description
Email address of an existing customer that should receive this license. Either
ownerIdorownerEmailmust be provided, but not both. The customer must already exist in your Moonbase account — unknown emails are rejected.
- Name
productId- Type
- string
- Description
Moonbase ID of the product that this license is for.
- Name
maxNumberOfActivations- Type
- number
- Optionality
- optional
- Description
Max number of devices allowed to activate this license. If omitted, Moonbase will use the currently configured value from the product.
- Name
offlineActivationsAllowed- Type
- boolean
- Optionality
- optional
- Description
Flag for if offline activations are allowed for this license. If omitted, Moonbase will use the currently configured value from the product.
- Name
activations- Type
- array
- Optionality
- optional
- Description
If you know devices that have already activated this license, you can also import them. It's important that the device signature will be the same so that license activation finds the correct seat to activate. Each activation contains the following properties:
- Name
deviceName- Type
- string
- Description
User-friendly name of the device.
- Name
deviceSignature- Type
- string
- Description
Fingerprint of the device generated by the licensing SDK.
- Name
activationMethod- Type
- enum(Online|Offline)
- Description
Flag for if this activation has been activated as an online or offline device.
- Name
lastValidation- Type
- datetime
- Description
ISO-8601 date and time for when the device was last validated.
- Name
keyCode- Type
- string
- Optionality
- optional
- Description
If you have an external license key code that you want to associate with this license, you can provide it here. Will be visible to the customer in their customer portal. Cannot be combined with
file.
- Name
file- Type
- object
- Optionality
- optional
- Description
An existing license file to attach to this license, for customers that already have a generated license file you want to migrate. Cannot be combined with
keyCode. Contains the following properties:- Name
fileName- Type
- string
- Description
Name of the file as it should appear to the customer.
- Name
data- Type
- string
- Description
Base64-encoded contents of the file.
- Name
contentType- Type
- string
- Description
MIME type of the file, for example
application/octet-stream.
- Name
externalId- Type
- string
- Optionality
- optional
- Description
This is an internal property, stored on licenses to let you correlate imported licenses with your existing systems.
- Name
expiresAt- Type
- datetime
- Optionality
- optional
- Description
Sets the expiry date of this license to this ISO-8601 date and time.
- Name
createdAt- Type
- datetime
- Optionality
- optional
- Description
Sets the created date of this license to this ISO-8601 date and time.
- Name
releaseAccess- Type
- object
- Optionality
- optional
- Description
Limits the license to some releases, with an
updatesUntildate, anupToMajorversion, or both, shaped like the license'sreleaseAccess. Left out, the license covers every release.
Request
POST https://demo.moonbase.sh/api/licenses/import
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"ownerId": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"productId": "example-app"
}
Response
{
"id": "32016591-73c5-4956-938c-e34366599bc7",
"ownerId": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"productId": "example-app",
"status": "Active",
...
}
Revoke license
Revoking a license makes it inaccessible for the owner, and causes any further client-side validations to fail. This is different from revoking license activations, which only disables single devices and doesn't prevent the user from re-activating their license.
Request
POST https://demo.moonbase.sh/api/licenses/32016591-73c5-4956-938c-e34366599bc7/revoke
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"id": "32016591-73c5-4956-938c-e34366599bc7",
"ownerId": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"productId": "example-app",
"status": "Active",
...
}
Set custom properties
Use this endpoint to set custom properties on a license. This replaces all existing custom properties on the license. See custom properties for more details on the shape and types of custom properties.
Request body
The body should be a JSON object where each key is the property name, and the value is a custom property object.
Request
PUT https://demo.moonbase.sh/api/licenses/32016591-73c5-4956-938c-e34366599bc7/custom-properties
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"seat_name": {
"type": "text",
"value": "Studio A",
"public": true,
"includeInToken": true
}
}
Response
{
"id": "32016591-73c5-4956-938c-e34366599bc7",
"ownerId": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"productId": "example-app",
"status": "Active",
...
}
Trials
Trial endpoints let you query the trials in Moonbase, start trials on your customers' devices, record trials another store gave, and import existing trials you may have. The trial object contains the following:
- Name
attribution- Type
- object
- Optionality
- optional
- Description
Marketing recorded when the trial started:
utm(when any),trafficTypeandsource(Visitfor the trial-start visit, orCustomerAcquisitionfor how the customer first arrived). Omitted on older trials. Recorded once rather than changing with later visits.
- Name
id- Type
- string
- Description
The Moonbase ID of the trial.
- Name
externalId- Type
- string
- Optionality
- optional
- Description
The store's reference for a trial recorded from another store, or your own for an imported one. Omitted when not set.
- Name
productId- Type
- string
- Description
The Moonbase ID of the product that this trial is for.
- Name
deviceName- Type
- string
- Description
Friendly name of the device that the trial is activated on.
- Name
deviceSignature- Type
- string
- Description
Hardware signature of the device that the trial is activated on.
- Name
lastValidatedAt- Type
- datetime
- Description
ISO-8601 date and time of the last validation.
- Name
expiresAt- Type
- datetime
- Optionality
- optional
- Description
ISO-8601 date and time of the expiry of this trial. Absent for an endless trial, one started while its product's trials never expire.
- Name
status- Type
- enum('Active' | 'Expired')
- Description
Current status of the trial, if it's active or expired.
- Name
customer- Type
- object
- Optionality
- optional
- Description
The customer the trial is for, shaped like the customer object. Omitted for a trial nobody owns.
- Name
issuedExternally- Type
- boolean
- Description
truefor a trial recorded from another store, which that store runs with its own licensing. You can't extend or end it in Moonbase, and it has no license token.
- Name
properties- Type
- object
- Optionality
- optional
- Description
Custom properties attached to this trial. See custom properties for more details on the shape and types of custom properties.
Trial example
{
"id": "5f113851778f34b175101c65657e7ea8",
"productId": "example-product",
"deviceName": "Example Device",
"deviceSignature": "89419872hc72nv150989",
"lastValidatedAt": "2025-11-24T17:26:37.0417505Z",
"status": "Expired",
"expiresAt": "2025-12-08T17:26:35.047223Z",
"customer": {
"id": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"name": "Example User",
"email": "user@example.com",
...
},
"issuedExternally": false
}
Get trials
Use this endpoint to fetch all trials page by page. For more details on how pagination works, see pagination.
Optional query parameters
- Name
pageSize- Type
- number
- Optionality
- optional
- Description
Adjust the size of each page returned.
- Name
productFilter- Type
- string
- Optionality
- optional
- Description
Optionally filter trials belonging to this product ID.
- Name
before- Type
- datetime
- Optionality
- optional
- Description
Optionally filter trials created before this ISO-8601 date and time.
- Name
after- Type
- datetime
- Optionality
- optional
- Description
Optionally filter trials created after this ISO-8601 date and time.
Request
GET https://demo.moonbase.sh/api/trials
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"items": [
{
"id": "5f113851778f34b175101c65657e7ea8",
"productId": "example-app",
"status": "Active",
...
}
],
"hasMore": false,
"next": null
}
Get trial by ID
Use this endpoint to look up a trial by its ID.
Request
GET https://demo.moonbase.sh/api/trials/5f113851778f34b175101c65657e7ea8
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"id": "5f113851778f34b175101c65657e7ea8",
"productId": "example-app",
"status": "Active",
...
}
Start trial
Use this endpoint to start a trial of a product on a device for one of your customers, for example from an installer that sets the product up on their computer.
Name the customer with customerId or customerEmail, or leave both out for a trial nobody owns, which only a product that doesn't require an account for trials allows.
A new trial lasts the product's trial length, and sends the TrialActivated webhook.
A device has one trial of each product. If the device already has one, you get that trial back as it is, with no extra days, whoever it was started for. A trial nobody owned becomes the named customer's. Send the device signature your licensing SDK computes on that device, so the app finds this trial when it requests its own. To put the trial on the device yourself, get its license token.
An unknown product or customer responds with 404: Not Found.
A product that doesn't allow trials, or that requires an account when no customer is named, responds with 400: Bad Request.
If the product's trials need a newsletter opt-in, the customer must have opted in to your newsletter, or the response is 403: Forbidden.
Required body properties
- Name
deviceName- Type
- string
- Description
User-friendly name of the device, shown to you and the customer.
- Name
deviceSignature- Type
- string
- Description
Fingerprint of the device, as generated by the licensing SDK.
Optional body properties
- Name
customerId- Type
- string
- Optionality
- optional
- Description
Moonbase ID of the customer the trial is for. Cannot be combined with
customerEmail.
- Name
customerEmail- Type
- string
- Optionality
- optional
- Description
Email address of an existing customer the trial is for.
- Name
utm- Type
- object
- Optionality
- optional
- Description
The visit's tags, referrer and click IDs, using
source,medium,campaign,term,content,referrer,idand any supported click-ID fields. Send only what your integration kept under the visitor's choice. Without it, attribution falls back to the customer's acquisition.
Optional query parameters
The same appVersion, platform and meta parameters as the Licensing API's metadata for analytics, describing the device the trial is for.
Request
POST https://demo.moonbase.sh/api/trials/example-app/request
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"customerEmail": "user@example.com",
"deviceName": "Studio Mac",
"deviceSignature": "89419872hc72nv150989"
}
Response
{
"id": "5f113851778f34b175101c65657e7ea8",
"productId": "example-app",
"deviceName": "Studio Mac",
"status": "Active",
"expiresAt": "2026-11-09T12:00:00.0000000Z",
"customer": {
"id": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"email": "user@example.com",
...
},
"issuedExternally": false,
...
}
Get trial token
Use this endpoint to get the signed license token for a trial, the same token its device gets when it requests the trial itself, so an app that started a trial for a device can put it there.
The response body is the token, with a content type of application/jwt.
Getting the token doesn't start the trial again or extend it: an expired trial's token says it has expired.
A trial recorded from another store has no token, and responds with 400: Bad Request.
Request
GET https://demo.moonbase.sh/api/trials/5f113851778f34b175101c65657e7ea8/token
Api-Key: mb_bbdac119b64649f6937e...
Response
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVmMTEzODUxNzc4ZjM0YjE3NTEwMWM2NTY1N2U3ZWE4Ii...
Record external trial
Use this endpoint to record a trial another store or app gave of its own copy of your product, as it starts, so it counts as the customer's trial: it shows on the customer, counts in your trial analytics, and starts the automations and TrialActivated webhooks a trial does.
The store's own licensing runs the trial, so Moonbase issues no license token for it, and the product's trial settings don't apply, apart from its trial length when you leave out expiresAt.
The trial is marked issuedExternally, and can't be extended or ended in Moonbase.
Sending the same externalId again responds with the trial already recorded instead of recording it twice, so a request that timed out is safe to retry.
To send trials the store gave before, include createdAt. The trial is then recorded as history: dated then and counted on that day, without starting automations or sending webhooks. A trial sent both as it started and later as history is recorded once.
An unknown product responds with 404: Not Found. An unknown customerId, or a createdAt in the future, responds with 400: Bad Request, and nothing is recorded.
Required body properties
- Name
productId- Type
- string
- Description
Moonbase ID of the product that was tried.
- Name
externalId- Type
- string
- Description
The store's reference for the trial, up to 200 characters.
Customer properties
Provide either customerId or customer, not both. Leave both out for a trial nobody owns.
With the customer portal enabled, customer.email identifies the customer, and customer.externalId is only kept on a customer created here. Without the portal, where several customers may share an email, customer.externalId also tells them apart, and a new customer is created when none has it. Customer external IDs sent by connected apps are ignored, because those IDs belong to the app's store. The trial's own externalId still identifies the trial.
- Name
customerId- Type
- string
- Optionality
- optional
- Description
The ID of an existing customer the trial is for.
- Name
customer- Type
- object
- Optionality
- optional
- Description
The person trying it as the store knows them, matched to an existing customer as described above. They get an account when there is none.
- Name
email- Type
- string
- Description
Email address of the customer.
- Name
name- Type
- string
- Optionality
- optional
- Description
Full name of the customer.
- Name
externalId- Type
- string
- Optionality
- optional
- Description
ID of this customer in the store.
Optional body properties
- Name
deviceName- Type
- string
- Optionality
- optional
- Description
The computer the trial runs on, when the store's trials are per computer, up to 200 characters. Left out, the trial shows as
Unknown device.
- Name
deviceSignature- Type
- string
- Optionality
- optional
- Description
The store's own identifier for that computer, up to 200 characters.
- Name
expiresAt- Type
- datetime
- Optionality
- optional
- Description
When the store's trial ends, as an ISO-8601 date and time, taken as UTC when it has no offset. Left out, the product's trial length applies from when the trial started, and a product whose trials never expire gives an endless trial.
- Name
createdAt- Type
- datetime
- Optionality
- optional
- Description
When the store gave the trial, for one sent after the fact, as an ISO-8601 date and time. Records the trial as history, as described above.
Request
POST https://demo.moonbase.sh/api/trials/external
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"productId": "example-app",
"externalId": "SHOP-1001",
"customer": {
"email": "user@example.com",
"name": "Example User"
},
"deviceName": "Studio Mac",
"expiresAt": "2026-11-09T12:00:00Z"
}
Response
{
"id": "ext_3f9c2b7a1d4e6f8091a2b3c4d5e6f708",
"externalId": "SHOP-1001",
"productId": "example-app",
"deviceName": "Studio Mac",
"status": "Active",
"expiresAt": "2026-11-09T12:00:00.0000000Z",
"customer": {
"id": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"name": "Example User",
"email": "user@example.com",
...
},
"issuedExternally": true,
...
}
Import trial
Importing a trial lets you import existing trials you may have, to prevent your users from re-starting trials from other systems.
Required body properties
- Name
productId- Type
- string
- Description
Moonbase ID of the product that this trial is for.
- Name
deviceName- Type
- string
- Description
User-friendly name of the device that the trial is activated on.
- Name
deviceSignature- Type
- string
- Description
Fingerprint of the device generated by the licensing SDK of choice.
- Name
expiresAt- Type
- datetime
- Description
ISO-8601 date and time of the expiry of this trial.
Optional body properties
- Name
ownerId- Type
- string
- Optionality
- optional
- Description
Moonbase ID of the customer that should be attributed to this trial.
- Name
externalId- Type
- string
- Optionality
- optional
- Description
ID of this trial in your existing system, returned as the trial's
externalId.
- Name
lastValidation- Type
- datetime
- Optionality
- optional
- Description
ISO-8601 date and time for when the device was last validated.
- Name
createdAt- Type
- datetime
- Optionality
- optional
- Description
Sets the created date of this trial to this ISO-8601 date and time.
Request
POST https://demo.moonbase.sh/api/trials/import
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"productId": "example-app",
"deviceName": "Example Device",
"deviceSignature": "89419872hc72nv150989",
"expiresAt": "2025-12-08T17:26:35.007223Z"
}
Response
{
"id": "5f113851778f34b175101c65657e7ea8",
"productId": "example-app",
"status": "Active",
...
}
Set custom properties
Use this endpoint to set custom properties on a trial. This replaces all existing custom properties on the trial. See custom properties for more details on the shape and types of custom properties.
Request body
The body should be a JSON object where each key is the property name, and the value is a custom property object.
Request
PUT https://demo.moonbase.sh/api/trials/5f113851778f34b175101c65657e7ea8/custom-properties
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"source": {
"type": "text",
"value": "website_banner",
"public": false,
"includeInToken": false
}
}
Response
{
"id": "5f113851778f34b175101c65657e7ea8",
"productId": "example-app",
"status": "Active",
...
}
Products
Product endpoints let you manage the products in your Moonbase account. The product object contains the following:
- Name
id- Type
- string
- Description
The Moonbase ID of the product.
- Name
name- Type
- string
- Description
The name of the product.
- Name
tagline- Type
- string
- Description
The tag line of the product.
- Name
description- Type
- string
- Description
The description of the product, in Markdown. The Storefront API also returns it as HTML.
- Name
status- Type
- enum(Active|Inactive|Private)
- Description
Current status of the product:
- Active: The product can be issued licenses for
- Inactive: The product cannot be used by any customer
- Private: Licensing, activation and fulfillment work exactly as they do for Active, but the product is hidden from your storefront and from every customer-facing API response unless the requesting customer owns it, and it cannot be purchased. Use it for products you hand out yourself, through this API or through a voucher.
The status is set in Moonbase rather than through this API, so it is read-only here.
- Name
purchasable- Type
- boolean
- Description
Flag for if this product can be purchased. A product that isn't purchasable stays off your storefront and is dropped from a customer's cart at checkout, but an order you prepare can still sell it.
- Name
fulfillment- Type
- object
- Nullability
- nullable
- Description
How the product is fulfilled, discriminated by its
type, ornullwhen it follows your account's default:- Moonbase: Moonbase issues the licenses, activated as
licensingConfigurationsets out. - DigitalProduct: file delivery only. A license records that the customer owns the product, with nothing to activate.
- KeyCodes: each license carries a key from the product's key code list.
- ILok: licenses are deposited through the iLok integration, as the iLok product named by
productId. - Custom: your own license generator, named by its
id, issues the licenses. - Disabled: a placeholder for a product sold and delivered elsewhere. It can't be bought, trialled or given new releases, and a license for it only records that the customer owns it.
- Moonbase: Moonbase issues the licenses, activated as
- Name
website- Type
- url
- Nullability
- nullable
- Description
Configured website URL for this product if any.
- Name
iconUrl- Type
- url
- Nullability
- nullable
- Description
Link to the icon added to this product if any. Set it with set product icon.
- Name
currentReleaseVersion- Type
- string
- Nullability
- nullable
- Description
Semantic version of the current release of this product if any.
- Name
notes- Type
- string
- Nullability
- nullable
- Description
Internal notes for this product. Not visible to customers.
- Name
defaultVariationId- Type
- string
- Nullability
- nullable
- Description
The ID of the default pricing variation.
- Name
releaseAccessControlLevel- Type
- enum(AllowAnonymous|AllowCustomers|AllowOwners|AllowGroupMembers|NoAccess)
- Description
Deprecated, use
releaseAccessControlinstead. Reports the level configured for the current release, so it cannot describe a product whose categories differ.
- Name
releaseAccessControl- Type
- object
- Description
Controls who can download releases of this product. Each category of release is controlled separately, so the current release can be open to everyone while older versions stay owner-only and unpublished builds are restricted to a beta group.
- Name
pastReleases- Type
- object
- Description
Applies to published releases that are no longer the current one.
- Name
currentRelease- Type
- object
- Description
Applies to the release the product currently points at.
- Name
preReleases- Type
- object
- Description
Applies to releases that have not been published yet.
All three have the same shape: a
level, plus agroupIdthat is only present when the level isAllowGroupMembers.- AllowAnonymous: anyone can download, no account needed
- AllowCustomers: any signed-in customer can download
- AllowOwners: only customers who own or subscribe to the product can download
- AllowGroupMembers: only members of the customer group named by
groupIdcan download. Membership is the whole test, so owning the product without being in the group is not enough. - NoAccess: nobody can download, owners included. The releases are still listed, with their notes, so you can withdraw old versions without hiding their history.
A product whose
statusisPrivateoverrides this when a download is actually attempted: every category also requires ownership, and any level other thanAllowGroupMembersandNoAccesscollapses to owners only. The values reported here are the ones you configured, not the ones a private product resolves to.
- Name
customerVisibility- Type
- enum(WhenOwned|Never|Always)
- Description
Controls when this product appears in a customer's account area:
- WhenOwned (default): visible only to customers who own a license for the product.
- Never: never surfaced to customers — useful for internal SKUs, bundle children, or products that are sold but should not show up in the inventory UI.
- Always: always visible, even to customers who don't own it — useful for upsell or cross-sell catalogs.
- Name
licensingConfiguration- Type
- object
- Description
Licensing configuration for this product.
- Name
numberOfActivationsPerLicense- Type
- number
- Description
Maximum number of concurrent activations allowed per license.
- Name
offlineActivationsEnabled- Type
- boolean
- Description
Whether offline activation is allowed.
- Name
autoProvisionOnActivation- Type
- boolean
- Description
Whether to automatically provision a license on activation.
- Name
includeInParentLicense- Type
- boolean
- Description
For an add-on, whether it is included in its main product's license: a device that activates the main product takes a seat of the add-on too, and the main product's license tokens list it.
- Name
trialsConfiguration- Type
- object
- Description
Trial configuration for this product.
- Name
enabled- Type
- boolean
- Description
Whether trials are enabled for this product.
- Name
requireAccount- Type
- boolean
- Description
Whether a customer account is required to start a trial.
- Name
numberOfDays- Type
- number
- Description
Duration of the trial period in days.
- Name
endless- Type
- boolean
- Description
Whether trials never expire. A trial started while this is on has no expiry, and
numberOfDaysonly applies again once it is turned off.
- Name
pricingConfiguration- Type
- array
- Description
Array of pricing variations for this product. Each variation defines a way the product can be purchased.
- Name
id- Type
- string
- Description
Unique identifier for this variation.
- Name
name- Type
- string
- Description
Display name for this variation.
- Name
entitlement- Type
- object
- Description
The type of entitlement granted. Either
PerpetualLicenseorSubscriptionLicensewith a grace period. APerpetualLicensethat covers only some releases has areleaseAccess, described under upsert product.
- Name
recurrence- Type
- object
- Description
The billing recurrence. Either
OneOfffor a one-time purchase orRecurringwith a cycle length.
- Name
price- Type
- object
- Description
Object mapping currency codes to amounts.
- Name
pricingTiers- Type
- array
- Optionality
- optional
- Description
Array of tiered pricing levels with
minQuantityandprice.
- Name
licenseConfigurationOverride- Type
- object
- Optionality
- optional
- Description
Override the product-level licensing configuration for this specific variation.
- Name
discounts- Type
- array
- Description
Array of pricing discounts for this product.
- Name
name- Type
- string
- Description
Display name for the discount.
- Name
description- Type
- string
- Optionality
- optional
- Description
Description of the discount.
- Name
discount- Type
- object
- Description
The discount type. Either
PercentageOffDiscountorFlatAmountOffDiscount.
- Name
exclusivity- Type
- object
- Optionality
- optional
- Description
Controls which customers can see and use this discount.
- Name
applicableVariationIds- Type
- array
- Optionality
- optional
- Description
Array of variation IDs this discount applies to.
- Name
validity- Type
- object
- Optionality
- optional
- Description
Time range for when this discount is valid.
- Name
recurringPaymentUseCount- Type
- number
- Optionality
- optional
- Description
Number of recurring payments the discount applies to before expiring.
- Name
promotionId- Type
- string
- Optionality
- optional
- Description
Present when the discount comes from a promotion running across your catalogue. The promotion owns the discount, so it cannot be changed or removed through the product endpoints.
- Name
properties- Type
- object
- Optionality
- optional
- Description
Custom properties attached to this product. See custom properties for more details on the shape and types of custom properties.
Product example
{
"id": "example-product",
"name": "AudioPanel",
"tagline": "This product is used for demo purposes",
"description": "Used for demo purposes",
"notes": null,
"status": "Active",
"purchasable": true,
"fulfillment": {
"type": "Moonbase"
},
"website": null,
"iconUrl": "https://assets.moonbase.sh/demo/products/example-product/icon/...",
"currentReleaseVersion": "1.0.0",
"defaultVariationId": "standard",
"releaseAccessControlLevel": "AllowOwners",
"releaseAccessControl": {
"pastReleases": {
"level": "AllowOwners"
},
"currentRelease": {
"level": "AllowOwners"
},
"preReleases": {
"level": "AllowGroupMembers",
"groupId": "beta-testers"
}
},
"customerVisibility": "WhenOwned",
"licensingConfiguration": {
"numberOfActivationsPerLicense": 3,
"offlineActivationsEnabled": false,
"autoProvisionOnActivation": false
},
"trialsConfiguration": {
"enabled": false,
"requireAccount": false,
"numberOfDays": 0
},
"pricingConfiguration": [
{
"id": "standard",
"name": "Standard",
"entitlement": {
"type": "PerpetualLicense"
},
"recurrence": {
"type": "OneOff"
},
"price": {
"USD": 49.99
}
}
],
"discounts": [],
"properties": {
"category": {
"type": "text",
"value": "Audio Tools",
"public": true,
"includeInToken": false
}
}
}
Get products
Use this endpoint to fetch all products page by page. For more details on how pagination works, see pagination.
Optional query parameters
- Name
pageSize- Type
- number
- Optionality
- optional
- Description
Adjust the size of each page returned.
- Name
status- Type
- enum(Active|Inactive|Private)
- Optionality
- optional
- Description
Only return products with this status. Omit it to return products of every status.
- Name
activeOnly- Type
- boolean
- Optionality
- optional
- Description
Deprecated, use
statusinstead.trueis equivalent tostatus=Active, and it is ignored whenstatusis supplied. Defaults tofalse.
Request
GET https://demo.moonbase.sh/api/products
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"items": [
{
"id": "exmaple-product",
"name": "Example Product",
...
}
],
"hasMore": false,
"next": null
}
Get product by ID
Use this endpoint to look up a product by their ID.
Request
GET https://demo.moonbase.sh/api/products/example-product
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"id": "example-product",
"name": "Example Product",
...
}
Upsert product
Use this endpoint to create a new product or update an existing one. The product ID is specified in the URL path. If a product with the given ID already exists, it will be updated; otherwise, a new product will be created.
Returns 201 Created when a new product is created, or 200 OK when an existing product is updated.
Required body parameters
- Name
name- Type
- string
- Description
The name of the product.
Optional body parameters
- Name
tagline- Type
- string
- Optionality
- optional
- Description
The tag line of the product.
- Name
description- Type
- string
- Optionality
- optional
- Description
The description of the product, in Markdown.
- Name
parentId- Type
- string
- Optionality
- optional
- Description
Parent product ID, used to create sub-products. Sub-products can also be addressed directly by using a dot in the product ID (for example,
parent-product.sub-product); when the ID already contains a dot,parentIdshould be omitted. Nested sub-products (a sub-product of a sub-product) are not allowed.
- Name
website- Type
- url
- Optionality
- optional
- Description
Website URL for this product.
- Name
notes- Type
- string
- Optionality
- optional
- Description
Internal notes for this product. Not visible to customers.
- Name
purchasable- Type
- boolean
- Optionality
- optional
- Description
Whether this product can be purchased. Defaults to
false.
- Name
fulfillment- Type
- object
- Optionality
- optional
- Description
How the product is fulfilled, such as
{ "type": "Disabled" }:Moonbase,DigitalProduct,KeyCodesorDisabled, as described in the product model. Left unchanged when omitted.ILokandCustomare set up in Moonbase, and sending them here responds with400: Bad Request.Disabledturns the product into a placeholder that is no longer purchasable or offers trials, and keeps its prices. While it stays disabled, making it purchasable, turning trials on, or creating or publishing a release responds with400: Bad Request. To sell it again, set anothertype, which can go in the same request that makes it purchasable.
- Name
defaultVariationId- Type
- string
- Optionality
- optional
- Description
The ID of the default pricing variation.
- Name
releaseAccessControl- Type
- object
- Optionality
- optional
- Description
Controls who can download releases of this product, one category at a time. Takes
pastReleases,currentReleaseandpreReleases, each an object with aleveland, when that level isAllowGroupMembers, thegroupIdof the customer group whose members may download. See the product schema above for what each level means.A category you leave out is left unchanged, so you can restrict pre-releases without restating the other two. Naming a group that does not exist is rejected outright, since a typo would otherwise quietly lock every customer out.
- Name
releaseAccessControlLevel- Type
- enum(AllowAnonymous|AllowCustomers|AllowOwners)
- Optionality
- optional
- Description
Deprecated, use
releaseAccessControlinstead. Applies one level to past, current and pre-releases alike, and is ignored whenreleaseAccessControlis supplied. It cannot expressAllowGroupMembers, which needs a group to go with it.
- Name
customerVisibility- Type
- enum(WhenOwned|Never|Always)
- Optionality
- optional
- Description
Controls when this product is shown in the customer-facing account area. Defaults to
WhenOwned. See the product schema above for what each value means.
- Name
properties- Type
- object
- Optionality
- optional
- Description
Custom properties to attach to this product. See custom properties for more details on the shape and types of custom properties.
- Name
licensingConfiguration- Type
- object
- Optionality
- optional
- Description
Licensing configuration for this product.
- Name
numberOfActivationsPerLicense- Type
- number
- Description
Maximum number of concurrent activations allowed per license.
- Name
offlineActivationsEnabled- Type
- boolean
- Description
Whether offline activation is allowed.
- Name
autoProvisionOnActivation- Type
- boolean
- Description
Whether to automatically provision a license on activation.
- Name
includeInParentLicense- Type
- boolean
- Optionality
- optional
- Description
For an add-on, whether to include it in its main product's license. Left unchanged when omitted, and only an add-on can set it to
true.
- Name
trialsConfiguration- Type
- object
- Optionality
- optional
- Description
Trial configuration for this product.
- Name
enabled- Type
- boolean
- Description
Whether trials are enabled for this product.
- Name
requireAccount- Type
- boolean
- Description
Whether a customer account is required to start a trial.
- Name
numberOfDays- Type
- number
- Description
Duration of the trial period in days.
- Name
endless- Type
- boolean
- Optionality
- optional
- Description
Whether trials never expire,
falsewhen left out. A trial started while this is on has no expiry, andnumberOfDaysonly applies again once it is turned off.
- Name
pricingConfiguration- Type
- array
- Optionality
- optional
- Description
Array of pricing variations for this product. Each variation defines a way the product can be purchased.
- Name
id- Type
- string
- Description
Unique identifier for this variation.
- Name
name- Type
- string
- Description
Display name for this variation.
- Name
entitlement- Type
- object
- Description
The type of entitlement granted. Use
{ "type": "PerpetualLicense" }for a perpetual license, or{ "type": "SubscriptionLicense", "gracePeriod": "..." }for a subscription with a grace period.On a one-off
PerpetualLicense, add areleaseAccessto sell licenses that cover only some releases, discriminated by itstype:{ "type": "TimeLimited", "period": { "count": 12, "unit": "Month" } }: releases published within the period after purchase.unitisDay,Week,MonthorYear, up to 10 years.{ "type": "MajorVersions", "additionalMajors": 0 }: the major version current at purchase, plus this many later ones. Needs a published release.{ "type": "UpToMajor", "major": 2 }: every version up to this major.{ "type": "AllReleases" }: removes the limit. LeavingreleaseAccessout keeps the variation's current one.
Older versions are always covered. Not available for add-ons, products with
autoProvisionOnActivation, or products whose licenses an external system issues.
- Name
recurrence- Type
- object
- Description
The billing recurrence. Use
{ "type": "OneOff" }for a one-time purchase, or{ "type": "Recurring", "cycleLength": "Monthly" }for recurring billing. Supported cycle lengths areMonthlyandYearly. Optionally includerenewalPriceto set a different price for renewals.
- Name
price- Type
- object
- Description
Object mapping currency codes to amounts, e.g.
{ "USD": 29.99, "EUR": 24.99 }.
- Name
pricingTiers- Type
- array
- Optionality
- optional
- Description
Array of tiered pricing levels. Each tier has a
minQuantity(number) andprice(object mapping currencies to amounts).
- Name
licenseConfigurationOverride- Type
- object
- Optionality
- optional
- Description
Override the product-level licensing configuration for this specific variation. Same shape as
licensingConfiguration.
- Name
discounts- Type
- array
- Optionality
- optional
- Description
Array of pricing discounts for this product. Replaces the discounts you manage yourself, so send the full list every time.
Discounts that a promotion put on the product are left out of this: any entry carrying a
promotionIdis ignored here, and the product re-attaches the ones its promotions own after the upsert. That makes it safe to read a product, change something, and send the whole thing back without stripping a running sale or duplicating it.- Name
name- Type
- string
- Description
Display name for the discount.
- Name
description- Type
- string
- Optionality
- optional
- Description
Description of the discount.
- Name
discount- Type
- object
- Description
The discount type. Use
{ "type": "PercentageOffDiscount", "percentage": 0.2 }for a percentage discount (value between 0 and 1), or{ "type": "FlatAmountOffDiscount", "total": { "USD": 5.00 } }for a flat amount off.
- Name
exclusivity- Type
- object
- Optionality
- optional
- Description
Controls which customers can see and use this discount.
To price upgrades and renewals of licenses that cover only some releases, use an
OwnsSomeOfcondition withoutdatedLicense, like{ "type": "OwnsSomeOf", "productIds": ["example-product"], "includeSubscriptions": false, "outdatedLicense": { "daysBeforeEnd": 30, "daysAfterEnd": 90 } }. It applies to an order line that upgrades a license whose updates end withindaysBeforeEnddays, or ended at mostdaysAfterEnddays ago (no limit whennull), or that is limited to an older major version than the current release.
- Name
applicableVariationIds- Type
- array
- Optionality
- optional
- Description
Array of variation IDs this discount applies to. If omitted, applies to all variations.
- Name
validity- Type
- object
- Optionality
- optional
- Description
Time range for when this discount is valid. Contains optional
fromandtodatetime fields.
- Name
recurringPaymentUseCount- Type
- number
- Optionality
- optional
- Description
Number of recurring payments the discount applies to before expiring.
Request
PUT https://demo.moonbase.sh/api/products/example-product
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"name": "AudioPanel",
"tagline": "Professional audio processing plugin",
"description": "A versatile audio plugin for mixing and mastering",
"purchasable": true,
"website": "https://example.org",
"licensingConfiguration": {
"numberOfActivationsPerLicense": 3,
"offlineActivationsEnabled": true,
"autoProvisionOnActivation": false
},
"trialsConfiguration": {
"enabled": true,
"requireAccount": false,
"numberOfDays": 14
},
"pricingConfiguration": [
{
"id": "standard",
"name": "Standard",
"entitlement": {
"type": "PerpetualLicense"
},
"recurrence": {
"type": "OneOff"
},
"price": {
"USD": 49.99
}
}
],
"defaultVariationId": "standard"
}
Response
{
"id": "example-product",
"name": "AudioPanel",
"tagline": "Professional audio processing plugin",
"description": "A versatile audio plugin for mixing and mastering",
"notes": null,
"status": "Active",
"purchasable": true,
"fulfillment": null,
"website": "https://example.org",
"iconUrl": null,
"currentReleaseVersion": null,
"defaultVariationId": "standard",
"releaseAccessControlLevel": "AllowAnonymous",
"releaseAccessControl": {
"pastReleases": {
"level": "AllowAnonymous"
},
"currentRelease": {
"level": "AllowAnonymous"
},
"preReleases": {
"level": "AllowAnonymous"
}
},
"customerVisibility": "WhenOwned",
"licensingConfiguration": {
"numberOfActivationsPerLicense": 3,
"offlineActivationsEnabled": true,
"autoProvisionOnActivation": false
},
"trialsConfiguration": {
"enabled": true,
"requireAccount": false,
"numberOfDays": 14
},
"pricingConfiguration": [
{
"id": "standard",
"name": "Standard",
"entitlement": {
"type": "PerpetualLicense"
},
"recurrence": {
"type": "OneOff"
},
"price": {
"USD": 49.99
}
}
],
"discounts": []
}
Set product icon
Use this endpoint to give a product a new icon.
Send the image as the icon field of a multipart/form-data body: a PNG, JPEG or WebP image under 4 MB.
Moonbase crops it to a square from the middle, scales it to 512 by 512 pixels and serves it as a PNG at the product's iconUrl, in place of the icon it had.
The response is the updated product.
An image Moonbase can't read, or one too large to process, responds with 400: Bad Request, and an unknown product with 404: Not Found.
Required form fields
- Name
icon- Type
- file
- Description
The image file.
Request
PUT https://demo.moonbase.sh/api/products/example-product/icon
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: multipart/form-data; boundary=MoonbaseBoundary
--MoonbaseBoundary
Content-Disposition: form-data; name="icon"; filename="icon.png"
Content-Type: image/png
(image data)
--MoonbaseBoundary--
Response
{
"id": "example-product",
"name": "AudioPanel",
"iconUrl": "https://assets.moonbase.sh/demo/products/example-product/icon/...",
...
}
Set custom properties
Use this endpoint to set custom properties on a product. This replaces all existing custom properties on the product. See custom properties for more details on the shape and types of custom properties.
Request body
The body should be a JSON object where each key is the property name, and the value is a custom property object.
Request
PUT https://demo.moonbase.sh/api/products/example-product/custom-properties
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"category": {
"type": "text",
"value": "Audio Tools",
"public": true,
"includeInToken": false
}
}
Response
{
"id": "example-product",
"name": "AudioPanel",
...
}
Product Releases
Product release endpoints let you manage the releases for the products in your Moonbase account, download their files for a customer, and record downloads you served yourself. The product release object contains the following:
- Name
version- Type
- string
- Description
The semantic version of this release.
- Name
description- Type
- string
- Nullability
- nullable
- Description
Changelog for this release if any, in Markdown. The Storefront API also returns it as HTML.
- Name
publishedAt- Type
- datetime
- Nullability
- nullable
- Description
ISO-8601 date and time for when this release was published if any.
- Name
scheduledAt- Type
- datetime
- Nullability
- nullable
- Description
UTC time when this unpublished release will be published automatically. Null for a draft without a schedule and for published releases.
- Name
downloadUrl- Type
- url
- Description
URL to download this release, based on the storefront mode of your Moonbase account.
- Name
hostedDownloadUrl- Type
- url
- Description
URL to download this release using the Moonbase hosted customer portal.
- Name
downloads- Type
- array
- Description
List of downloadable files for this release. Each download contains the following properties:
- Name
name- Type
- string
- Description
File name for this download
- Name
key- Type
- string
- Description
Unique key for this download.
- Name
platform- Type
- enum(Universal|Windows|Linux|Mac|iOS|Android)
- Description
The intended platform for this download.
- Name
arch- Type
- enum(Unknown|Universal|X86|X64|Arm|Arm64)
- Optionality
- optional
- Description
CPU architecture for this download. Omitted when not set. Lets you ship per-architecture binaries on the same release without encoding the arch into the filename.
- Name
size- Type
- number
- Description
The size of this file in bytes.
- Name
downloadUrl- Type
- url
- Description
URL to download this specific file, based on the storefront mode of your Moonbase account.
- Name
hostedDownloadUrl- Type
- url
- Description
URL to download this specific file using the Moonbase hosted customer portal.
- Name
directUrl- Type
- url
- Description
Direct URL to download this file, will depend on authentication based on your product security settings.
- Name
properties- Type
- object
- Optionality
- optional
- Description
Custom properties attached to this release. See custom properties for more details on the shape and types of custom properties.
To schedule a release, pass a future publishedAt to Publish release, or send it with publishImmediately=true when creating or updating a release. It stays unpublished until that time, with scheduledAt set and publishedAt null. The previous current version remains available. You can change the scheduled time through Set release date or remove the schedule.
Product release example
{
"version": "1.0.0",
"description": null,
"publishedAt": "2023-10-01T07:28:37.147407Z",
"downloadUrl": "https://example.org/?mb_intent=download_product...",
"hostedDownloadUrl": "https://demo.moonbase.sh/download?product_id=example-product&version=1.0.0",
"downloads": [
{
"name": "installer.exe",
"key": "demo/1d7c685e-3a4e-4051-8526-6df436b6fd27",
"platform": "Windows",
"arch": "X64",
"size": 2503,
"downloadUrl": "https://example.org/?mb_intent=download_product...",
"hostedDownloadUrl": "https://demo.moonbase.sh/download?product_id=example-product&version=1.0.0&key=1d7c685e-3a4e-4051-8526-6df436b6fd27",
"directUrl": "https://demo.moonbase.sh/api/customer/inventory/products/example-product/download/1.0.0/1d7c685e-3a4e-4051-8526-6df436b6fd27",
},
{
"name": "installer.exe",
"key": "demo/9f0a2c7e-b1d4-4f33-9a8a-5e5c8b1bd910",
"platform": "Windows",
"arch": "Arm64",
"size": 2491,
"downloadUrl": "https://example.org/?mb_intent=download_product...",
"hostedDownloadUrl": "https://demo.moonbase.sh/download?product_id=example-product&version=1.0.0&key=9f0a2c7e-b1d4-4f33-9a8a-5e5c8b1bd910",
"directUrl": "https://demo.moonbase.sh/api/customer/inventory/products/example-product/download/1.0.0/9f0a2c7e-b1d4-4f33-9a8a-5e5c8b1bd910",
}
]
}
Get product releases
Use this endpoint to fetch all releases for a product page by page. For more details on how pagination works, see pagination.
Optional query parameters
- Name
pageSize- Type
- number
- Optionality
- optional
- Description
Adjust the size of each page returned.
Request
GET https://demo.moonbase.sh/api/products/example-product/releases
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"items": [
{
"version": "1.0.0",
"description": null,
"publishedAt": "2023-10-01T07:28:37.147407Z",
...
}
],
"hasMore": false,
"next": null
}
Create release
Creating a new release lets you expose and publish uploaded files to your customers by tying downloads to a product release.
Required body properties
- Name
version- Type
- object
- Description
Semantic version of the new release. Object with a number for each part:
- Name
major- Type
- number
- Description
Major version part
- Name
minor- Type
- number
- Description
Minor version part
- Name
patch- Type
- number
- Description
Patch version part
- Name
description- Type
- string
- Optionality
- optional
- Description
Optional description of what this release is about, in Markdown.
- Name
downloads- Type
- array
- Description
List of downloads that this release should contain. For more information on how to prepare the key for these downloads, see downloads. Each object in this array must contain the following:
- Name
name- Type
- string
- Description
Name of this file.
- Name
key- Type
- string
- Description
Unique key generated by the download prepare endpoint.
- Name
platform- Type
- enum(Universal|Windows|Linux|Mac|iOS|Android)
- Description
The intended platform for this download.
- Name
arch- Type
- enum(Unknown|Universal|X86|X64|Arm|Arm64)
- Optionality
- optional
- Description
CPU architecture for this download. Omit for arch-agnostic binaries. Two downloads with the same
nameandplatformbut differentarchwill coexist on the release.
Optional body properties
- Name
publishedAt- Type
- datetime
- Optionality
- optional
- Description
With
publishImmediately=true, a past release date for imported history, or a future UTC time to schedule publication. WithoutpublishImmediately, specifying this date is refused.
Optional query parameters
- Name
publishImmediately- Type
- bool
- Optionality
- optional
- Description
Publish this new release, or schedule it when its body contains a future
publishedAt.
Request
POST https://demo.moonbase.sh/api/products/example-product/releases/new
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"version": {
"major": 1,
"minor": 0,
"patch": 0
},
"downloads": [
{
"name": "Installer.exe",
"platform": "Windows",
"arch": "X64",
"key": "demo/49b8da10-2d72-4bdf-bf9c-47e56c184bfa"
},
{
"name": "Installer.exe",
"platform": "Windows",
"arch": "Arm64",
"key": "demo/f3d24a7b-9c4f-4d61-8e2a-72b1a0e3c4d5"
}
]
}
Response
{
"version": "1.0.0",
"description": null,
"publishedAt": null,
...
}
Update release
Updating a release replaces the all downloads, and updates the description if given
Required body properties
- Name
description- Type
- string
- Optionality
- optional
- Description
Optional description of what this release is about, in Markdown.
- Name
downloads- Type
- array
- Description
List of downloads that this release should contain. For more information on how to prepare these downloads, see downloads. Each object in this array must contain the following:
- Name
name- Type
- string
- Description
Name of this file.
- Name
key- Type
- string
- Description
Unique key generated by the download prepare endpoint.
- Name
platform- Type
- enum(Universal|Windows|Linux|Mac|iOS|Android)
- Description
The intended platform for this download.
- Name
arch- Type
- enum(Unknown|Universal|X86|X64|Arm|Arm64)
- Optionality
- optional
- Description
CPU architecture for this download. Omit for arch-agnostic binaries. Two downloads with the same
nameandplatformbut differentarchwill coexist on the release.
Optional body properties
- Name
publishedAt- Type
- datetime
- Optionality
- optional
- Description
The date of a published release, the scheduled time of a scheduled release, or the date to publish or schedule with
publishImmediately=true. A future date schedules publication; leave it out to preserve the existing date.
Optional query parameters
- Name
publishImmediately- Type
- bool
- Optionality
- optional
- Description
Publish this updated release, or schedule it when its body contains a future
publishedAt.
Request
PUT https://demo.moonbase.sh/api/products/example-product/releases/1.0.0
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"description": "1.0.0 is the initial release of Example Product",
"downloads": [
{
"name": "Installer.exe",
"platform": "Windows",
"key": "demo/49b8da10-2d72-4bdf-bf9c-47e56c184bfa"
}
]
}
Response
{
"version": "1.0.0",
"description": "1.0.0 is the initial release of Example Product",
"publishedAt": null,
...
}
Add download
Using this endpoint, you can add more downloads to a release. These are deduplicated based on the platform, architecture, and file name, and is useful if you have separate build steps per platform or architecture that each add their own download to new releases.
If you submit the same name and platform with a different arch, both downloads are kept; submitting the same name, platform, and arch replaces the existing entry. Existing downloads without an arch continue to deduplicate by name and platform as before.
Required body properties
- Name
name- Type
- string
- Description
Name of this file.
- Name
key- Type
- string
- Description
Unique key generated by the download prepare endpoint.
- Name
platform- Type
- enum(Universal|Windows|Linux|Mac|iOS|Android)
- Description
The intended platform for this download.
- Name
arch- Type
- enum(Unknown|Universal|X86|X64|Arm|Arm64)
- Optionality
- optional
- Description
CPU architecture for this download. Omit for arch-agnostic binaries.
Request
POST https://demo.moonbase.sh/api/products/example-product/releases/1.0.0/add-download
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"name": "Installer.exe",
"platform": "Windows",
"key": "demo/49b8da10-2d72-4bdf-bf9c-47e56c184bfa"
}
Response
{
"version": "1.0.0",
"description": null,
"publishedAt": "2023-10-01T07:28:37.147407Z",
...
}
Publish release
Publishes an existing product release, making it available to your customers. The product's current version then points to this release, unless publishedAt dates it before the current one.
Pass a future publishedAt to schedule the release instead.
Optional query parameters
- Name
publishedAt- Type
- datetime
- Optionality
- optional
- Description
The date a release came out, or a future UTC time to schedule it. A future time sets
scheduledAtand leaves it unpublished until then. See Set release date. A release dated before the current one is published without becoming the current release, and sends noProductReleasePublishedwebhook.
Request
POST https://demo.moonbase.sh/api/products/example-product/releases/1.0.0/publish
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"version": "1.0.0",
"description": null,
"publishedAt": "2026-11-13T12:00:00Z",
"scheduledAt": null,
...
}
Schedule publication
POST https://demo.moonbase.sh/api/products/example-product/releases/1.1.0/publish?publishedAt=2027-02-01T12%3A00%3A00Z
Api-Key: mb_bbdac119b64649f6937e...
Scheduled response (excerpt)
{
"version": "1.1.0",
"publishedAt": null,
"scheduledAt": "2027-02-01T12:00:00Z"
}
Unschedule release
Removes the publication schedule from an unpublished release, leaving it as a draft. Requires products:write. Returns the release with scheduledAt: null. The files stay attached, and the product's current published version is unchanged.
Request
DELETE https://demo.moonbase.sh/api/products/{productId}/releases/{version}/schedule
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"version": "1.1.0",
"description": "New presets",
"publishedAt": null,
"scheduledAt": null,
"downloads": []
}
Set release date
Changes the date of a published release, for example to bring over the history of a product you are moving to Moonbase, or moves a scheduled release to another future time. The dates decide which releases a license with updates for a period covers, so add older releases with their dates before you sell those licenses.
Changing the date of a published release doesn't change which release is current, and sends no webhook. To release a scheduled release now, use Publish release.
Responds with 400: Bad Request for a draft without a schedule, a published release given a future date, or a scheduled release given a past one.
Required body properties
- Name
publishedAt- Type
- datetime
- Description
The date the release came out, or for a scheduled release, the future time to publish it.
Request
PUT https://demo.moonbase.sh/api/products/example-product/releases/1.0.0/release-date
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"publishedAt": "2025-03-14T00:00:00Z"
}
Response
{
"version": "1.0.0",
"description": null,
"publishedAt": "2025-03-14T00:00:00Z",
...
}
Set custom properties
Use this endpoint to set custom properties on a product release. This replaces all existing custom properties on the release. See custom properties for more details on the shape and types of custom properties.
Request body
The body should be a JSON object where each key is the property name, and the value is a custom property object.
Request
PUT https://demo.moonbase.sh/api/products/example-product/releases/1.0.0/custom-properties
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"min_os_version": {
"type": "text",
"value": "14.0",
"public": true,
"includeInToken": false
},
"is_prerelease": {
"type": "boolean",
"value": false,
"public": true,
"includeInToken": false
}
}
Response
{
"version": "1.0.0",
"description": null,
"publishedAt": "2023-10-01T07:28:37.147407Z",
...
}
Download latest release
Use this endpoint to get a link to the current release's file for a platform on behalf of a customer, so your own server or installer can download it for them.
Who may download is decided by the product's releaseAccessControl, checked against the customer you name, or against anyone when you name none.
Moonbase counts the download as the customer's, like one from their account. A key with read access to products is enough.
platform is one of Universal, Windows, Linux, Mac, iOS or Android, and has to match the file's exactly, so a Universal file is only found under Universal.
When the current release has several files for the platform, such as one per architecture, you get the first one: use download release file to choose.
A customer who may not download the release responds with 403: Forbidden, as does naming no customer for a release that only some customers may download.
An unknown product or customer, a product without a current release, or a release without a file for the platform responds with 404: Not Found.
Optional body properties
The body is required, so send {} to name no customer.
- Name
customerId- Type
- string
- Optionality
- optional
- Description
The ID of the customer the download is for.
- Name
customerEmail- Type
- string
- Optionality
- optional
- Description
The email address of the customer the download is for, instead of
customerId. Sending both responds with400: Bad Request.
Response body
- Name
url- Type
- url
- Description
Link to the file. It needs no authentication and works for 15 minutes.
- Name
version- Type
- string
- Description
The version of the release the file belongs to.
- Name
name- Type
- string
- Description
File name of the download.
- Name
platform- Type
- enum(Universal|Windows|Linux|Mac|iOS|Android)
- Description
The platform of the download.
- Name
size- Type
- number
- Description
The size of the file in bytes.
- Name
arch- Type
- enum(Unknown|Universal|X86|X64|Arm|Arm64)
- Optionality
- optional
- Description
CPU architecture of the download. Omitted when not set.
- Name
manifest- Type
- object
- Optionality
- optional
- Description
Where an installer puts the file's contents and the license, from the download or, when it has none, the product's default for its platform. Omitted when neither has one.
Request
POST https://demo.moonbase.sh/api/products/example-product/download/Windows/latest
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"customerEmail": "user@example.com"
}
Response
{
"url": "https://...",
"version": "1.0.0",
"name": "installer.exe",
"platform": "Windows",
"size": 2503,
"arch": "X64"
}
Download release file
Use this endpoint to get a link to one particular file of a release on behalf of a customer, for example the build for one architecture, or an older version.
It works like download latest release: access is decided by the product's releaseAccessControl for that release, which can be one not published yet, and the download counts as the customer's.
version is the release's version, such as 1.0.0, and key is the last part of the download's key as the release lists it, after the /.
An unknown product, customer, release or file responds with 404: Not Found, and a customer who may not download the release with 403: Forbidden.
Optional body properties
The body is required, so send {} to name no customer.
- Name
customerId- Type
- string
- Optionality
- optional
- Description
The ID of the customer the download is for.
- Name
customerEmail- Type
- string
- Optionality
- optional
- Description
The email address of the customer the download is for, instead of
customerId. Sending both responds with400: Bad Request.
The response has the same shape as for download latest release.
Request
POST https://demo.moonbase.sh/api/products/example-product/download/1.0.0/9f0a2c7e-b1d4-4f33-9a8a-5e5c8b1bd910
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"customerId": "6f2c1e9a-4b7d-4c3e-9a1f-8d5b2e7c0a43"
}
Response
{
"url": "https://...",
"version": "1.0.0",
"name": "installer.exe",
"platform": "Windows",
"size": 2491,
"arch": "Arm64"
}
Record external download
Use this endpoint to record a download that your own server, CDN or another store served from its own copy of the product, so it counts as the customer's download in Moonbase, like one from their account.
Nothing is checked against the product's releaseAccessControl, and the version doesn't have to be a release in Moonbase.
Responds with 204: No Content.
A customer you name has to exist already, for example from a sale or trial you recorded first: an unknown customer responds with 404: Not Found, as does an unknown product. Name no customer to record an anonymous download.
Required body properties
- Name
version- Type
- string
- Description
The version downloaded, such as
1.4.0.
- Name
platform- Type
- enum(Universal|Windows|Linux|Mac|iOS|Android)
- Description
The platform of the file downloaded.
Optional body properties
- Name
arch- Type
- enum(Unknown|Universal|X86|X64|Arm|Arm64)
- Optionality
- optional
- Description
CPU architecture of the file downloaded.
- Name
size- Type
- number
- Optionality
- optional
- Description
The size of the file in bytes.
- Name
externalId- Type
- string
- Optionality
- optional
- Description
Your reference for the download, up to 200 characters. Sending the same one again for the product within 7 days records nothing more, so a retried request is not counted twice.
- Name
customerId- Type
- string
- Optionality
- optional
- Description
The ID of the customer who downloaded it.
- Name
customerEmail- Type
- string
- Optionality
- optional
- Description
The email address of the customer who downloaded it, instead of
customerId. Sending both responds with400: Bad Request.
Request
POST https://demo.moonbase.sh/api/products/example-product/download/external
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"version": "1.4.0",
"platform": "Windows",
"arch": "X64",
"size": 1048576,
"externalId": "dl_20261026_8812",
"customerEmail": "user@example.com"
}
Response
HTTP/1.1 204 No Content
Downloads
Download endpoints let you upload files to your Moonbase account to use in product releases.
Prepare upload takes a whole file in one request, up to 5 GB.
For a larger file, or to retry a failed piece instead of the whole file, upload it in parts: start a multipart upload, sign the parts, upload each one to its URL, then complete the upload.
Either way, the key you get goes on a release download.
Prepare upload
Prepare to upload a file to Moonbase.
Mandatory query parameters
- Name
contentType- Type
- string
- Description
The MIME type of the content in this file. For binary files, you may use
application/octet-stream. This parameter is important so that customers know what file they are downloading later on.
Response body
- Name
key- Type
- string
- Description
The unique key for this file. Use this when creating product releases to connect the file to the release.
- Name
url- Type
- string
- Description
The URL where you may upload the file. This URL requires no authentication, and you may do a direct PUT with the file content. For example:
curl --upload-file Installer.exe {URL} \ -H 'Content-Type: application/octet-stream'
Request
POST https://demo.moonbase.sh/api/downloads/prepare?contentType=application%2foctet-stream
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"key": "demo/49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"url": "https://demo.moonbase.sh/..."
}
Start multipart upload
Use this endpoint to start uploading a file in parts.
The response has the upload's id and the file's key. Pass the key with every other call for this upload, and once the upload is complete, add it to a release like a key from prepare upload.
An upload that isn't completed within 7 days of starting it is discarded, along with its parts.
Required query parameters
- Name
contentType- Type
- string
- Description
The MIME type of the file, such as
application/zip. For binary files, you may useapplication/octet-stream.
Response body
- Name
id- Type
- string
- Description
The ID of the upload.
- Name
key- Type
- string
- Description
The unique key for the file.
Request
POST https://demo.moonbase.sh/api/downloads/multipart?contentType=application%2fzip
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"id": "VXBsb2FkIElEIGZvciBkZW1vIGluc3RhbGxlcg",
"key": "demo/1d7c685e-3a4e-4051-8526-6df436b6fd27"
}
Sign upload parts
Use this endpoint to get the URLs to upload the parts of a file to. Number the parts from 1 in the order they make up the file, and send the numbers as a JSON array, at most 1,000 at a time. Part numbers run from 1 to 10,000, and every part except the last must be at least 5 MiB.
Each URL takes a PUT of that part's bytes, needs no authentication, and works for an hour.
Keep the ETag header of each response, since you need it to complete the upload. For example:
curl -i --upload-file part-1.bin '{URL}'
You can sign a part again, for example to retry it once its URL has expired.
Part numbers out of range respond with 400: Bad Request, and an upload that doesn't exist or is already complete with 404: Not Found.
Required query parameters
- Name
key- Type
- string
- Description
The
keyof the upload.
Response body
An array with an entry for each part number:
- Name
partNumber- Type
- number
- Description
The part number.
- Name
url- Type
- url
- Description
The URL to upload that part to.
Request
POST https://demo.moonbase.sh/api/downloads/multipart/VXBsb2FkIElEIGZvciBkZW1vIGluc3RhbGxlcg/sign?key=demo/1d7c685e-3a4e-4051-8526-6df436b6fd27
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
[1, 2, 3]
Response
[
{
"partNumber": 1,
"url": "https://..."
},
{
"partNumber": 2,
"url": "https://..."
},
{
"partNumber": 3,
"url": "https://..."
}
]
Complete multipart upload
Use this endpoint once every part is uploaded, to put the file together.
Send each part's number and ETag, in any order. The file's key can then go on a release through create release, update release or add download.
Responds with 200: OK and no body.
If a part is missing, an ETag doesn't match, a part number is listed twice, or a part other than the last is under 5 MiB, it responds with 400: Bad Request saying which, and you can send a corrected list.
An upload that doesn't exist or is already complete responds with 404: Not Found.
Required query parameters
- Name
key- Type
- string
- Description
The
keyof the upload.
Request body
A JSON array with an entry for each part:
- Name
partNumber- Type
- number
- Description
The part number.
- Name
eTag- Type
- string
- Description
The
ETagheader the part's upload responded with.
Request
POST https://demo.moonbase.sh/api/downloads/multipart/VXBsb2FkIElEIGZvciBkZW1vIGluc3RhbGxlcg/complete?key=demo/1d7c685e-3a4e-4051-8526-6df436b6fd27
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
[
{ "partNumber": 1, "eTag": "\"a54357aff0632cce46d942af68356b38\"" },
{ "partNumber": 2, "eTag": "\"0c78aef83f66abc1fa1e8477f296d394\"" },
{ "partNumber": 3, "eTag": "\"acbd18db4cc2f85cedef654fccc4a4d8\"" }
]
Response
HTTP/1.1 200 OK
Get uploaded parts
Use this endpoint to list the parts of an upload that have arrived so far, for example to pick up an interrupted upload and send only the parts that are missing. The list can be sent as it is to complete the upload.
An upload that doesn't exist or is already complete responds with 404: Not Found.
Required query parameters
- Name
key- Type
- string
- Description
The
keyof the upload.
Response body
An array with an entry for each part uploaded:
- Name
partNumber- Type
- number
- Description
The part number.
- Name
size- Type
- number
- Description
The size of the part in bytes.
- Name
eTag- Type
- string
- Description
The part's
ETag.
Request
GET https://demo.moonbase.sh/api/downloads/multipart/VXBsb2FkIElEIGZvciBkZW1vIGluc3RhbGxlcg?key=demo/1d7c685e-3a4e-4051-8526-6df436b6fd27
Api-Key: mb_bbdac119b64649f6937e...
Response
[
{
"partNumber": 1,
"size": 5242880,
"eTag": "\"a54357aff0632cce46d942af68356b38\""
},
{
"partNumber": 2,
"size": 5242880,
"eTag": "\"0c78aef83f66abc1fa1e8477f296d394\""
}
]
Vouchers
Voucher endpoints let you manage vouchers, which are one-time-use codes that grant licenses to products and bundles. The voucher object contains the following:
- Name
id- Type
- string
- Description
The Moonbase ID of the voucher.
- Name
name- Type
- string
- Description
The name of the voucher.
- Name
description- Type
- string
- Description
Description of the voucher.
- Name
numberOfCodes- Type
- number
- Description
The number of codes associated with this voucher.
- Name
numberOfRedemptions- Type
- number
- Description
The number of times codes from this voucher have been redeemed.
- Name
redeemsProducts- Type
- array
- Description
List of products that this voucher redeems, each wrapped in a quantity/value object.
- Name
redeemsBundles- Type
- array
- Description
List of bundles that this voucher redeems, each wrapped in a quantity/value object.
- Name
properties- Type
- object
- Optionality
- optional
- Description
Custom properties attached to this voucher. See custom properties for more details on the shape and types of custom properties.
Voucher example
{
"id": "58927685-61ad-4caa-ad6f-8613d7200d4f",
"name": "Demo voucher",
"description": "Used for demo purposes",
"numberOfCodes": 100,
"numberOfRedemptions": 12,
"redeemsProducts": [
{
"quantity": 1,
"value": {
"id": "example-product",
"name": "AudioPanel",
...
}
}
],
"redeemsBundles": [],
"properties": {
"campaign": {
"type": "text",
"value": "summer_2026",
"public": true,
"includeInToken": false
}
}
}
Create voucher
Creates a new voucher with product and bundle entitlements.
Required body properties
- Name
name- Type
- string
- Description
Name of the voucher.
- Name
description- Type
- string
- Description
Description of the voucher.
Optional body properties
- Name
productEntitlements- Type
- record<productId, number>
- Optionality
- optional
- Description
A map of product IDs to the number of licenses to grant per redemption.
- Name
bundleEntitlements- Type
- record<bundleId, number>
- Optionality
- optional
- Description
A map of bundle IDs to the number of licenses to grant per redemption.
Request
POST https://demo.moonbase.sh/api/vouchers/create
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"name": "Demo voucher",
"description": "Used for demo purposes",
"productEntitlements": {
"example-product": 1
}
}
Response
{
"id": "58927685-61ad-4caa-ad6f-8613d7200d4f",
"name": "Demo voucher",
...
}
Get vouchers
Use this endpoint to fetch all vouchers page by page. For more details on how pagination works, see pagination.
Optional query parameters
- Name
pageSize- Type
- number
- Optionality
- optional
- Description
Adjust the size of each page returned.
Request
GET https://demo.moonbase.sh/api/vouchers
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"items": [
{
"id": "58927685-61ad-4caa-ad6f-8613d7200d4f",
"name": "Demo voucher",
...
}
],
"hasMore": false,
"next": null
}
Get voucher by ID
Use this endpoint to look up a voucher by its ID.
Request
GET https://demo.moonbase.sh/api/vouchers/58927685-61ad-4caa-ad6f-8613d7200d4f
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"id": "58927685-61ad-4caa-ad6f-8613d7200d4f",
"name": "Demo voucher",
...
}
Add voucher codes
Adds one or more codes to an existing voucher. Codes are normalized to uppercase.
Request body
The body should be a JSON array of code strings.
Request
PUT https://demo.moonbase.sh/api/vouchers/58927685-61ad-4caa-ad6f-8613d7200d4f/codes
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
[
"VOUCHER-CODE-001",
"VOUCHER-CODE-002"
]
Get voucher codes
Use this endpoint to fetch codes for a voucher page by page. For more details on how pagination works, see pagination.
Optional query parameters
- Name
pageSize- Type
- number
- Optionality
- optional
- Description
Adjust the size of each page returned.
- Name
redeemedBefore- Type
- datetime
- Optionality
- optional
- Description
Filter to codes redeemed before this ISO-8601 date and time.
- Name
redeemedAfter- Type
- datetime
- Optionality
- optional
- Description
Filter to codes redeemed after this ISO-8601 date and time.
Response content
The inner voucher code objects have the following schema:
- Name
voucherId- Type
- string
- Description
The Moonbase ID of the voucher this code belongs to.
- Name
code- Type
- string
- Description
The code string.
- Name
isRedeemed- Type
- boolean
- Description
Flag for if this code has been redeemed.
- Name
redeemedBy- Type
- string
- Optionality
- optional
- Description
The Moonbase ID of the customer who redeemed the code, if redeemed.
- Name
redeemedAt- Type
- datetime
- Optionality
- optional
- Description
ISO-8601 date and time of when the code was redeemed, if redeemed.
Request
GET https://demo.moonbase.sh/api/vouchers/58927685-61ad-4caa-ad6f-8613d7200d4f/codes
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"items": [
{
"voucherId": "58927685-61ad-4caa-ad6f-8613d7200d4f",
"code": "VOUCHER-CODE-001",
"isRedeemed": true,
"redeemedBy": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"redeemedAt": "2026-03-15T10:30:00Z"
}
],
"hasMore": false,
"next": null
}
Delete voucher code
Deletes a single code from a voucher.
Request
DELETE https://demo.moonbase.sh/api/vouchers/58927685-61ad-4caa-ad6f-8613d7200d4f/codes/VOUCHER-CODE-001
Api-Key: mb_bbdac119b64649f6937e...
Set custom properties
Use this endpoint to set custom properties on a voucher. This replaces all existing custom properties on the voucher. See custom properties for more details on the shape and types of custom properties.
Request body
The body should be a JSON object where each key is the property name, and the value is a custom property object.
Request
PUT https://demo.moonbase.sh/api/vouchers/58927685-61ad-4caa-ad6f-8613d7200d4f/custom-properties
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"campaign": {
"type": "text",
"value": "summer_2026",
"public": true,
"includeInToken": false
}
}
Response
{
"id": "58927685-61ad-4caa-ad6f-8613d7200d4f",
"name": "Demo voucher",
...
}
Coupons
Coupon endpoints let you manage coupons, which provide discount codes for products and bundles. The coupon object contains the following:
- Name
id- Type
- string
- Description
The Moonbase ID of the coupon.
- Name
name- Type
- string
- Description
The name of the coupon.
- Name
description- Type
- string
- Description
Description of the coupon.
- Name
numberOfCodes- Type
- number
- Description
The number of codes associated with this coupon.
- Name
numberOfRedemptions- Type
- number
- Description
The number of times codes from this coupon have been redeemed.
- Name
maxRedemptions- Type
- number
- Nullability
- nullable
- Description
How many times the coupon can be redeemed in all, across its codes.
nullfor no limit.
- Name
maxRedemptionsPerCode- Type
- number
- Nullability
- nullable
- Description
How many times each of its codes can be redeemed.
nullfor no limit.
- Name
combinable- Type
- boolean
- Description
Flag for if this coupon can be combined with product discounts.
- Name
discount- Type
- object
- Description
The discount this coupon applies. Can be either a flat amount off or a percentage off discount.
- Name
applicableProducts- Type
- array
- Description
List of products that this coupon can be applied to.
- Name
applicableBundles- Type
- array
- Description
List of bundles that this coupon can be applied to.
- Name
validity- Type
- object
- Optionality
- optional
- Description
Time range during which this coupon is valid, if restricted.
- Name
isDeleted- Type
- boolean
- Description
Flag for if this coupon has been deleted.
- Name
properties- Type
- object
- Optionality
- optional
- Description
Custom properties attached to this coupon. See custom properties for more details on the shape and types of custom properties.
Coupon example
{
"id": "SUMMER2026",
"name": "Summer Sale",
"description": "Summer 2026 promotion",
"numberOfCodes": 500,
"numberOfRedemptions": 42,
"maxRedemptions": null,
"maxRedemptionsPerCode": 1,
"combinable": false,
"discount": {
"type": "PercentageOffDiscount",
"percentage": 0.2
},
"applicableProducts": [ ... ],
"applicableBundles": [],
"validity": null,
"isDeleted": false,
"properties": {
"tracking_id": {
"type": "text",
"value": "promo_summer_2026",
"public": false,
"includeInToken": false
}
}
}
Create coupon
Creates a new coupon with a discount, product and bundle applicability, and an optional validity period.
Required body properties
- Name
name- Type
- string
- Description
Name of the coupon.
- Name
description- Type
- string
- Description
Description of the coupon.
- Name
discount- Type
- object
- Description
The discount this coupon applies. This is a discriminated object based on the
typefield:Percentage off
- Name
type- Type
- 'PercentageOffDiscount'
- Description
Discount type discriminator.
- Name
percentage- Type
- number
- Description
The percentage to discount, normalized to between 0 and 1.
Flat amount off
- Name
type- Type
- 'FlatAmountOffDiscount'
- Description
Discount type discriminator.
- Name
total- Type
- record<currency, number>
- Description
The flat amount to discount per currency.
Optional body properties
- Name
applicableProducts- Type
- record<productId, string[]>
- Optionality
- optional
- Description
A map of product IDs to an array of pricing variation IDs that this coupon applies to.
- Name
applicableBundles- Type
- record<bundleId, string[]>
- Optionality
- optional
- Description
A map of bundle IDs to an array of pricing variation IDs that this coupon applies to.
- Name
validity- Type
- object
- Optionality
- optional
- Description
Time range during which this coupon is valid.
- Name
from- Type
- datetime
- Description
ISO-8601 date and time for when the coupon becomes valid.
- Name
to- Type
- datetime
- Description
ISO-8601 date and time for when the coupon expires.
- Name
maxRedemptions- Type
- number
- Optionality
- optional
- Description
How many times the coupon can be redeemed in all, across its codes. At least 1. Leave it out for no limit.
- Name
maxRedemptionsPerCode- Type
- number
- Optionality
- optional
- Description
How many times each of its codes can be redeemed. Set it to
1for single-use codes. Leave it out for no limit.
Request
POST https://demo.moonbase.sh/api/coupons/create
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"name": "Summer Sale",
"description": "Summer 2026 promotion",
"discount": {
"type": "PercentageOffDiscount",
"percentage": 0.2
},
"applicableProducts": {
"example-product": ["default"]
}
}
Response
{
"id": "SUMMER2026",
"name": "Summer Sale",
...
}
Get coupons
Use this endpoint to fetch all coupons page by page. For more details on how pagination works, see pagination.
Optional query parameters
- Name
pageSize- Type
- number
- Optionality
- optional
- Description
Adjust the size of each page returned.
Request
GET https://demo.moonbase.sh/api/coupons
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"items": [
{
"id": "SUMMER2026",
"name": "Summer Sale",
...
}
],
"hasMore": false,
"next": null
}
Get coupon by ID
Use this endpoint to look up a coupon by its ID.
Request
GET https://demo.moonbase.sh/api/coupons/SUMMER2026
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"id": "SUMMER2026",
"name": "Summer Sale",
...
}
Add coupon codes
Adds one or more codes to an existing coupon. You can optionally set a validity period for the individual codes, separate from the coupon's overall validity.
Request body
The body should be a JSON array of code strings.
Optional query parameters
- Name
validFrom- Type
- datetime
- Optionality
- optional
- Description
ISO-8601 date and time for when these codes become valid.
- Name
validTo- Type
- datetime
- Optionality
- optional
- Description
ISO-8601 date and time for when these codes expire.
Request
PUT https://demo.moonbase.sh/api/coupons/SUMMER2026/codes
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
[
"SUMMER-001",
"SUMMER-002"
]
Get coupon codes
Use this endpoint to fetch codes for a coupon page by page. For more details on how pagination works, see pagination.
Optional query parameters
- Name
pageSize- Type
- number
- Optionality
- optional
- Description
Adjust the size of each page returned.
Response content
The inner coupon code objects have the following schema:
- Name
code- Type
- string
- Description
The code string.
- Name
numberOfRedemptions- Type
- number
- Description
The number of times this code has been redeemed.
- Name
validity- Type
- object
- Optionality
- optional
- Description
The validity period for this specific code, if set.
- Name
from- Type
- datetime
- Description
ISO-8601 date and time for when the code becomes valid.
- Name
to- Type
- datetime
- Description
ISO-8601 date and time for when the code expires.
Request
GET https://demo.moonbase.sh/api/coupons/SUMMER2026/codes
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"items": [
{
"code": "SUMMER-001",
"numberOfRedemptions": 3,
"validity": null
}
],
"hasMore": false,
"next": null
}
Delete coupon code
Deletes a single code from a coupon.
Request
DELETE https://demo.moonbase.sh/api/coupons/SUMMER2026/codes/SUMMER-001
Api-Key: mb_bbdac119b64649f6937e...
Set custom properties
Use this endpoint to set custom properties on a coupon. This replaces all existing custom properties on the coupon. See custom properties for more details on the shape and types of custom properties.
Request body
The body should be a JSON object where each key is the property name, and the value is a custom property object.
Request
PUT https://demo.moonbase.sh/api/coupons/SUMMER2026/custom-properties
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"tracking_id": {
"type": "text",
"value": "promo_summer_2026",
"public": false,
"includeInToken": false
}
}
Response
{
"id": "SUMMER2026",
"name": "Summer Sale",
...
}
Campaigns
Campaign endpoints let you write an email campaign, send or schedule it to a list or segment, and see who it reached. They are the same campaigns as on the Campaigns page in Moonbase, held to the same rules.
Sending needs a live Moonbase account with a verified sending domain and a marketing sender address, set up under Account settings > Email.
A campaign only reaches customers who opted in to its category, and your account can send a limited number of campaign emails each day (UTC): a send that reaches the limit pauses, and carries on by itself the next day. Get campaign usage shows how much of today's allowance is used.
The campaign object contains the following:
- Name
id- Type
- string
- Description
The Moonbase ID of the campaign.
- Name
name- Type
- string
- Description
The name of the campaign. Recipients do not see it.
- Name
slug- Type
- string
- Nullability
- nullable
- Description
The
utm_campaignadded to every link the campaign sends, unique within your account. Made from the name when the campaign is created, and kept when it is renamed.
- Name
status- Type
- enum(Draft|Scheduled|Sending|Paused|Sent|Cancelled|Failed)
- Description
Where the campaign is. Only a
Draftcan be edited.
- Name
category- Type
- enum(Newsletter|ProductUpdates)
- Description
Which opt-in a customer needs to get it:
communicationPreferences.newsletterOptInorproductUpdatesOptIn.
- Name
groupId- Type
- string
- Nullability
- nullable
- Description
The list or segment the campaign goes to, or
all-customersfor everyone. A list's or segment's ID is the last part of its address in Moonbase,app.moonbase.sh/customers/{groupId}.
- Name
audienceRule- Type
- object
- Nullability
- nullable
- Description
A rule that narrows the group to the members it matches, or
nullfor all of them.
- Name
subject- Type
- string
- Description
The subject line.
- Name
previewText- Type
- string
- Nullability
- nullable
- Description
The line inboxes show after the subject.
- Name
blocks- Type
- array
- Description
The body of the email, as a list of blocks.
- Name
bodyText- Type
- string
- Description
The plain-text part of the email, or empty when it is made from the blocks at send.
- Name
utm- Type
- object
- Description
The UTM parameters added to the campaign's links:
source(mb-campaign),medium(email),campaign(theslug) andcontent(newsletterorproduct-updates).
- Name
scheduledAt- Type
- datetime
- Nullability
- nullable
- Description
When a scheduled campaign starts sending.
- Name
localDelivery- Type
- object
- Nullability
- nullable
- Description
Set when each recipient gets the campaign at a time of day on their own clock, rather than everyone at once. Contains
localTime(HH:mm) andfallbackTimeZone.
- Name
sendStartedAt- Type
- datetime
- Nullability
- nullable
- Description
When the send started.
- Name
sendCompletedAt- Type
- datetime
- Nullability
- nullable
- Description
When the send finished.
- Name
recipientCount- Type
- number
- Description
How many recipients the send has. Zero until it starts. Compare
counters.sentwith it to follow a send.
- Name
counters- Type
- object
- Description
Running totals:
recipients,sent,failed,rejected,skippedNotOptedIn,skippedSuppressed,skippedUnconfirmed,membersScanned,delivered,bounced,complained,unsubscribed,openedandclicked.
- Name
pauseReason- Type
- enum(Manual|Deliverability|DailyLimitReached)
- Nullability
- nullable
- Description
Why a paused campaign is paused: by you, by Moonbase to protect your sending reputation (for example after too many spam complaints), or at the daily limit.
- Name
autoResumeAt- Type
- datetime
- Nullability
- nullable
- Description
When a campaign paused at the daily limit carries on by itself.
- Name
autoPausedReason- Type
- string
- Nullability
- nullable
- Description
What Moonbase paused the campaign for, in words.
- Name
errorMessage- Type
- string
- Nullability
- nullable
- Description
Why a
Failedcampaign failed.
- Name
created- Type
- object
- Description
When the campaign was created, containing an
attimestamp andby, who created it.
- Name
lastUpdated- Type
- object
- Description
When the campaign was last changed, containing an
attimestamp andby, who changed it.
Blocks
Each block is an object with a type and an id. Leave the id out on a new block and Moonbase assigns one; send it back to keep the block. Text fields can use variables such as {{ customer.first_name | "there" }}. Heading, text, button, discount code, coupon and voucher blocks take an optional alignment (Left, the default, Center or Right).
- Header: a panel or band with optional
title,subtitle,backgroundColorandshowLogo(defaults to true). A color-only band is a Header without copy or a logo. - Heading: a section heading,
text. - Text: a paragraph of Markdown,
text. - Button: a call to action,
labelandurl, with an optional second one,secondaryLabelandsecondaryUrl.backgroundColorcustomizes the first button. Colors accept#rgbor#rrggbb. - Image and HeroImage: an image inset in the body, or one running edge to edge, with
url,alt,linkUrl,widthandheight. Image also acceptssize(FillorOriginal) andalignmentfor its original size. A video is a linked Image: its thumbnail isurl, and the video page islinkUrl; it is not a separate block type. - Product: a card for one of your products,
productId, with an optionalctaLabelandctaUrl. Its name, icon and price are read when the email is sent. - DiscountCode: one code you already have,
code, with atitle. Everyone gets the same code. - Coupon: a code of its own for each recipient, made from the coupon
couponIdas the campaign sends, with atitle. - Voucher: a voucher code of its own for each recipient, from
voucherId, with atitleand an optionalbuttonLabelfor a redeem button. - License: licenses for up to five
products(each aproductIdandquantity) issued to every recipient as the campaign sends, with atitle. - Conditional: shows the
matchedblocks to recipients a rule,rule, matches, and theotherwiseblocks to everyone else. - Account: a button into the reader's account, with
createAccountLabelfor readers who have no password yet andlogInLabelfor everyone else, plus optionalalignment. Moonbase makes the personal link; do not supply a URL. - Review: asks for a product review, with
text,ctaLabel, andproducts(One, the default,ActivatedorOrdered).OnerequiresproductId;Activatedselects the products the reader most recently activated or received (a first activation for Moonbase licensing, a successful delivery for iLok, custom licenses and keys, or being issued a product without licensing);Orderedis only for automation emails triggered byProductPurchasedorOrderPlaced. At most five qualifying products appear. Moonbase makes the review links, and only asks customers who paid through this store, still own the product and have not reviewed it. - Countdown: exactly one of
endsAt(a UTC time) andendsAfter(a duration from each recipient's send, such as48h). Optionalstyle(Tiles,BandorHairlines),labels(days,hours,minutes,seconds),endedTextand hexcolorcustomize it. - Divider and Spacer: a line, or extra space, between sections.
If a visible Review block has no eligible products for a customer, the whole email is skipped with CannotReview. To still send the rest of the email to them, put the block inside a Conditional block on a CanReviewProducts rule with mode Any (and, for One, the same product). EmailDetails and EmailButtons are reserved for customer email templates and are refused in campaigns and automation emails.
Rules
Audience rules and conditional blocks use the same rule language as segments. Each rule is an object with a type:
- All, Any: every one, or at least one, of
conditionsmatches. Not:conditiondoes not match. - InGroup: in the lists or segments
groupIds, withmodeAllorAny. - OwnsItems: owns the
items(Product/{id}orBundle/{id}), withmodeandincludeSubscriptions. - CountryIn: lives in one of
countryCodes. - AcquiredVia, LifetimeValueBetween, SpentBetween, CounterBetween, HasFlag, CustomerDateWithin, CustomPropertyMatches: how the customer found you, what they have spent, their counts, flags, dates and custom properties.
- PerformedEvent, OpenedEmail, ValidatedAtLeast, WasActiveWithin, EnvironmentIs: what they did, which emails they opened, and how and where they use your products.
- OpenedCampaignEmail: opened the email one of the
campaigns(campaign IDs) sent them, with an optionalwithinduration such as30d. Wrapped in Not, it also matches customers the campaigns never reached. - OpenedAutomationStepEmail: opened the email one of the
steps(Send email step IDs) of the automationautomationIdsent them, with an optionalwithin. Opens from before mid-November 2026 are not counted. - ReviewedProducts: has reviewed all, any or none of the
products(mode), or any product when none are listed, with optionalminimumRatingandmaximumRatingfrom 1 to 5. - CanReviewProducts: can write a new review of all, any or none of the
products(mode), or any product when none are listed: they paid for it through your checkout, still own or subscribe to it, and have not reviewed it yet. Activation is not required.
A rule Moonbase does not know, or one with fields that do not fit, is refused with 400: Bad Request.
Campaign example
{
"id": "6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13",
"name": "Example Product 2.0 launch",
"slug": "example-product-2-0-launch",
"status": "Draft",
"category": "ProductUpdates",
"groupId": "example-product-owners",
"audienceRule": {
"type": "CountryIn",
"countryCodes": ["NO", "SE", "DK"]
},
"subject": "Example Product 2.0 is here",
"previewText": "A free update for every owner",
"blocks": [
{
"type": "Heading",
"id": "0b6e7c1a-5d2f-4a8b-9c3e-1f4a7b2d6e90",
"text": "Example Product 2.0 is here",
"alignment": "Left"
},
{
"type": "Text",
"id": "7d2a9f4c-3e1b-4c6d-8a5f-2b9e0c7d4a18",
"text": "Hi {{ customer.first_name | \"there\" }}, version 2.0 is out, and it is free for you.",
"alignment": "Left"
},
{
"type": "Button",
"id": "c4f81e2b-9a6d-4b3c-a7e5-6d0f2c8b1a94",
"label": "Download the update",
"url": "https://example.com/download",
"secondaryLabel": null,
"secondaryUrl": null,
"alignment": "Center"
}
],
"bodyText": "",
"utm": {
"source": "mb-campaign",
"medium": "email",
"campaign": "example-product-2-0-launch",
"content": "product-updates"
},
"scheduledAt": null,
"localDelivery": null,
"sendStartedAt": null,
"sendCompletedAt": null,
"recipientCount": 0,
"counters": {
"recipients": 0,
"sent": 0,
"opened": 0,
"clicked": 0,
...
},
"pauseReason": null,
"autoResumeAt": null,
"autoPausedReason": null,
"errorMessage": null,
"created": { "at": "2026-10-20T09:12:44.0000000Z", "by": { ... } },
"lastUpdated": { "at": "2026-10-20T09:12:44.0000000Z", "by": { ... } }
}
Get campaigns
Use this endpoint to fetch all campaigns page by page, newest first. For more details on how pagination works, see pagination.
Each campaign in the list leaves out audienceRule, previewText, blocks, bodyText, utm, autoPausedReason and errorMessage, and has hasAudienceRule instead. Get campaign by ID has the rest.
Optional query parameters
- Name
pageSize- Type
- number
- Optionality
- optional
- Description
Adjust the size of each page returned, up to 100.
Request
GET https://demo.moonbase.sh/api/campaigns
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"items": [
{
"id": "6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13",
"name": "Example Product 2.0 launch",
"status": "Sent",
"hasAudienceRule": true,
...
}
],
"hasMore": false,
"next": null,
"pageSize": 15
}
Get campaign by ID
Use this endpoint to look up a campaign, with its content, by its ID. If no campaign exists with the given ID, the API responds with 404: Not Found.
Request
GET https://demo.moonbase.sh/api/campaigns/6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"id": "6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13",
"name": "Example Product 2.0 launch",
...
}
Create campaign
Creates a draft campaign. Nothing is sent until you send or schedule it, so a draft is safe to create and look over in Moonbase first.
A group that does not exist, a block that does not fit, or a variable Moonbase does not know is refused with 400: Bad Request describing the problem.
Required body properties
- Name
name- Type
- string
- Description
The name of the campaign.
Optional body properties
- Name
category- Type
- enum(Newsletter|ProductUpdates)
- Optionality
- optional
- Description
Which opt-in a customer needs to get it. Defaults to
Newsletter.
- Name
groupId- Type
- string
- Optionality
- optional
- Description
The list or segment to send to. Leave it out, or send
all-customers, for everyone.
- Name
audienceRule- Type
- object
- Optionality
- optional
- Description
A rule that narrows the group to the members it matches.
- Name
subject- Type
- string
- Optionality
- optional
- Description
The subject line.
- Name
previewText- Type
- string
- Optionality
- optional
- Description
The line inboxes show after the subject.
- Name
blocks- Type
- array
- Optionality
- optional
- Description
The body, as a list of blocks. Leave out both this and
bodyTextto start from your account's starter layout.
- Name
bodyText- Type
- string
- Optionality
- optional
- Description
The plain-text part. Leave it out to have it made from the blocks at send.
- Name
slug- Type
- string
- Optionality
- optional
- Description
The
utm_campaignfor its links. Made from the name when left out. Whatever you send is normalized and made unique within your account, so read the one assigned from the response.
Request
POST https://demo.moonbase.sh/api/campaigns/create
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"name": "Example Product 2.0 launch",
"category": "ProductUpdates",
"groupId": "example-product-owners",
"subject": "Example Product 2.0 is here",
"previewText": "A free update for every owner",
"blocks": [
{ "type": "Heading", "text": "Example Product 2.0 is here" },
{ "type": "Text", "text": "Hi {{ customer.first_name | \"there\" }}, version 2.0 is out, and it is free for you." },
{ "type": "Button", "label": "Download the update", "url": "https://example.com/download", "alignment": "Center" }
]
}
Response
{
"id": "6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13",
"name": "Example Product 2.0 launch",
"slug": "example-product-2-0-launch",
"status": "Draft",
...
}
Update campaign
Changes a draft campaign. Every property is optional, and one you leave out keeps its value.
A campaign that has been scheduled or sent can still be renamed: send name alone. Anything else on a campaign that is no longer a Draft is refused with 400: Bad Request. Unschedule a scheduled campaign to edit it.
If someone else changes the campaign at the same moment, both changes are kept. In the rare case they cannot be, the API responds with 409: Conflict: read the campaign again and make your change to what it is now.
Optional body properties
- Name
name- Type
- string
- Optionality
- optional
- Description
The name of the campaign. Renaming does not change the
slug.
- Name
category- Type
- enum(Newsletter|ProductUpdates)
- Optionality
- optional
- Description
Which opt-in a customer needs to get it.
- Name
groupId- Type
- string
- Optionality
- optional
- Description
The list or segment to send to, or
all-customersfor everyone.
- Name
audienceRule- Type
- object
- Optionality
- optional
- Description
Replaces the rule that narrows the group.
- Name
clearAudienceRule- Type
- boolean
- Optionality
- optional
- Description
Set to
trueto drop the audience rule and send to every member of the group again.
- Name
subject- Type
- string
- Optionality
- optional
- Description
The subject line.
- Name
previewText- Type
- string
- Optionality
- optional
- Description
The line inboxes show after the subject. Send an empty string to remove it.
- Name
blocks- Type
- array
- Optionality
- optional
- Description
Replaces the whole body. A block sent with its
idkeeps it.
- Name
bodyText- Type
- string
- Optionality
- optional
- Description
The plain-text part. Send an empty string to have it made from the blocks again.
- Name
slug- Type
- string
- Optionality
- optional
- Description
A new
utm_campaignfor its links.
Request
PATCH https://demo.moonbase.sh/api/campaigns/6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"subject": "Example Product 2.0: free for owners",
"clearAudienceRule": true
}
Response
{
"id": "6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13",
"subject": "Example Product 2.0: free for owners",
"audienceRule": null,
...
}
Delete campaign
Deletes a campaign and responds with 204: No Content. A campaign that is sending is refused with 400: Bad Request: pause or cancel it first. Deleting a scheduled campaign stops it from being sent.
Request
DELETE https://demo.moonbase.sh/api/campaigns/6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13
Api-Key: mb_bbdac119b64649f6937e...
Schedule campaign
Schedules a draft to start sending at a future time, and responds with the campaign as Scheduled.
A scheduled campaign emails your customers at that time without anything more from you. Unschedule it to stop that.
Refused with 400: Bad Request when the account is not live, has no verified sending domain, the campaign has no group, subject or content, or the time is not in the future.
Required body properties
- Name
at- Type
- datetime
- Description
ISO-8601 date and time, in UTC, for the send to start.
Optional body properties
- Name
localDelivery- Type
- object
- Optionality
- optional
- Description
Set this to have each recipient get the campaign at 10:00 on their own clock, the first time that comes round after
at, rather than everyone atat. The send then goes out over up to a day.- Name
fallbackTimeZone- Type
- string
- Description
The IANA time zone, such as
Europe/Oslo, for recipients Moonbase cannot place.
Request
POST https://demo.moonbase.sh/api/campaigns/6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13/schedule
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"at": "2026-11-03T08:00:00Z"
}
Response
{
"id": "6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13",
"status": "Scheduled",
"scheduledAt": "2026-11-03T08:00:00Z",
...
}
Unschedule campaign
Takes a scheduled campaign back to Draft, so it can be edited or scheduled again. Refused with 400: Bad Request for a campaign that is not scheduled.
Request
POST https://demo.moonbase.sh/api/campaigns/6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13/unschedule
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"id": "6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13",
"status": "Draft",
"scheduledAt": null,
...
}
Send campaign
Starts sending a draft or scheduled campaign now, and responds with the campaign as Sending. The body is optional.
Refused with 400: Bad Request when the account is not live, has no verified sending domain, or the campaign has no group, subject or content.
Optional body properties
- Name
localDelivery- Type
- object
- Optionality
- optional
- Description
Set this to have each recipient get the campaign at 10:00 on their own clock, the next time that comes round, rather than everyone now. Takes
fallbackTimeZone, as when scheduling.
Request
POST https://demo.moonbase.sh/api/campaigns/6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13/send
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"id": "6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13",
"status": "Sending",
"sendStartedAt": "2026-10-20T10:02:13.0000000Z",
...
}
Pause campaign
Pauses a campaign that is sending, within an email or two. Refused with 400: Bad Request for a campaign that is not sending.
Request
POST https://demo.moonbase.sh/api/campaigns/6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13/pause
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"id": "6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13",
"status": "Paused",
"pauseReason": "Manual",
...
}
Resume campaign
Carries on sending a paused campaign to the recipients it has not reached yet, whatever paused it. Refused with 400: Bad Request for a campaign that is not paused.
Request
POST https://demo.moonbase.sh/api/campaigns/6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13/resume
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"id": "6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13",
"status": "Sending",
"pauseReason": null,
...
}
Cancel campaign
Stops a campaign for good. Whoever it has reached keeps their copy, and a scheduled campaign is not sent. Refused with 400: Bad Request for a campaign that is already sent or cancelled.
Request
POST https://demo.moonbase.sh/api/campaigns/6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13/cancel
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"id": "6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13",
"status": "Cancelled",
...
}
Get campaign recipients
Use this endpoint to fetch who a campaign was sent to and what became of each, most recently processed first. For more details on how pagination works, see pagination.
Only recipients the send has reached are listed, so a draft gives an empty page and a send in progress a partial one. Compare with the campaign's recipientCount.
Optional query parameters
- Name
status- Type
- enum(Sent|Skipped|Failed)
- Optionality
- optional
- Description
Only list recipients with this status.
- Name
pageSize- Type
- number
- Optionality
- optional
- Description
Adjust the size of each page returned, up to 100.
Response content
The inner recipient objects have the following schema:
- Name
customerId- Type
- string
- Description
The Moonbase ID of the customer, kept after the customer is deleted.
- Name
customer- Type
- object
- Optionality
- optional
- Description
Who the customer is now:
id,externalId(when set),name,emailandisDeleted. Omitted once the customer has been removed for good.
- Name
email- Type
- string
- Optionality
- optional
- Description
The address the campaign was sent to, which can differ from the customer's current one. Omitted once the customer is deleted.
- Name
status- Type
- enum(Sent|Skipped|Failed)
- Description
What the send did with this recipient.
- Name
skipReason- Type
- enum(NotOptedIn|Suppressed|Unconfirmed|Deleted|CannotReview)
- Optionality
- optional
- Description
Why a skipped recipient was not emailed.
CannotReviewmeans a visible review request had no eligible products for that customer.
- Name
sentAt- Type
- datetime
- Optionality
- optional
- Description
When the email was sent.
- Name
failureMessage- Type
- string
- Optionality
- optional
- Description
Why a failed recipient was not emailed. Omitted once the customer is deleted.
- Name
delivery- Type
- object
- Optionality
- optional
- Description
What the receiving inbox did with the email:
status(Sent,Delivered,Rejected,BouncedorComplained), andopenedAt,clickedAt,unsubscribedAtandfailurewhen they apply.
- Name
processedAt- Type
- datetime
- Optionality
- optional
- Description
When the send finished with this recipient, emailed or not.
Request
GET https://demo.moonbase.sh/api/campaigns/6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13/recipients?status=Sent
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"items": [
{
"customerId": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"customer": {
"id": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
"name": "Example User",
"email": "user@example.com",
"isDeleted": false
},
"email": "user@example.com",
"status": "Sent",
"sentAt": "2026-10-20T10:02:41.0000000Z",
"delivery": {
"status": "Delivered",
"openedAt": "2026-10-20T11:15:09.0000000Z"
},
"processedAt": "2026-10-20T10:02:41.0000000Z"
}
],
"hasMore": true,
"next": "/api/campaigns/6f1c2b9e-8d4a-4e3f-9a51-2c7d0e4b8a13/recipients?status=Sent&paginationToken=...",
"pageSize": 25
}
Get campaign usage
Use this endpoint to see how much of today's (UTC) allowance of campaign emails your account has used. A send that reaches the limit pauses with pauseReason DailyLimitReached, and carries on by itself at autoResumeAt.
Response content
- Name
quotas- Type
- array
- Description
One entry per daily allowance, each with
kind(Emails),usedtoday, andlimit, ornullwhen there is no limit.
Request
GET https://demo.moonbase.sh/api/campaigns/usage
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"quotas": [
{
"kind": "Emails",
"used": 1240,
"limit": ...
}
]
}
Automations
Automations are in beta and enabled for all accounts. Their API uses the same account, sending requirements and daily allowances as the Automations page in Moonbase.
Use Api-Key with automations:read for reads, or automations:write for changes. A key with full access also works. Turning an automation on or resuming it requires a live account and a ready definition. Email steps need the appropriate verified sender and recipient permission; the response's readiness explains what is missing.
Automation model
| Fields | Meaning |
|---|---|
id, name, slug | Server-assigned ID, internal name and campaign slug used in email links. |
status | Draft, Active, Paused or Off. |
pauseReason, pauseDetail | Null unless paused; Manual, VolumeLimit, Complaints or SendingBlocked, and an explanation where applicable. |
revision | Send the latest value when replacing the definition. A stale save returns 409. |
trigger, triggerSummary | The trigger object and its human-readable description; null before one is chosen. |
enrollment | { mode: "Once" }, the default, or { mode: "EveryTime" }. |
filter | A customer rule, or null to accept anyone the trigger enrolls. |
steps | Ordered step objects, including branches and inline email content. |
counters | enrolled, active, completed, exited, failed. Active is an approximate current count. |
readiness | { canTurnOn, problems }. Each problem has target, nullable stepId, code, message and related automations. |
warnings | Non-blocking issues with the same shape as readiness problems. |
everActivated | Once true, trigger kind and enrollment mode can no longer change. |
activeSince, turnedOnAt, pausedAt, turnedOffAt | Nullable UTC timestamps. Only events after the automation starts listening enroll customers. |
created, lastUpdated | Change metadata, with at and by. |
The list response returns summaries: the fields above except revision, pauseDetail, filter, steps, readiness, warnings, everActivated and activeSince, plus stepCount, which includes steps inside branches. Read a single automation for its editable definition.
Definition and enrollment
Create accepts a required name (up to 200 characters) and optional trigger, enrollment, filter and steps. Omitted enrollment defaults to Once, omitted filter means everyone, and omitted steps means an empty draft. Drafts can be incomplete; invalid definitions are refused as a whole. Definition errors are returned in errors, keyed by name, trigger, enrollment, filter, steps/{stepId} or automation.
An update replaces the entire definition. Start with a GET, keep the step IDs, edit it, then PUT its definition with the latest revision. Do not send the merchant editor's create payload, client-assigned automation ID, template key or time-zone setting: those are not this integration API's inputs.
Once allows one journey per customer. EveryTime allows later enrollments when the trigger fires again, subject to its re-enrollment interval and engine limits; it does not allow concurrent runs for the same customer. A customer manually removed from an automation cannot enter it again. Imports and historical backfills do not replay the events that start automations.
Triggers
Triggers use a kind discriminator. Item filters are items: ["Product/{id}", "Bundle/{id}"]; empty or omitted means any item.
| Kind | Additional fields and behavior |
|---|---|
TrialStarted | items. Anonymous device trials do not enroll anyone. |
ProductPurchased | items, optional channels and includeGifts. Includes products in bundles. |
OrderPlaced | Optional channels and includeGifts, for any completed live order. |
CheckoutStarted | items. Existing customers entering checkout, at most once per customer per day; a first-time guest is not yet a customer. |
SignedUp | No extra fields. An account is created at sign-up, checkout or license issuance. |
SubscriptionStarted, SubscriptionCancelled, SubscriptionExpired | items. Cancellation and loss of access are different events. |
SubscriptionRenewed | items. Each renewal for another period. |
SubscriptionCompleted | items. A subscription reaches the end of its milestone schedule. |
LicenseActivated | items. First activation of a license. |
ProductDownloaded | items. A customer downloads a product from your storefront, Moonbase Hub or an integration, at most once a day per customer. Anonymous downloads do not count. |
VoucherRedeemed | No extra fields. A customer redeems a voucher code. |
GroupJoined, GroupLeft | groupId for a list or segment. Imports, segment first fills, rule edits and refreshes do not count as joins. |
CampaignEmailOpened | Optional campaignId, otherwise any campaign. |
CampaignLinkClicked | Optional campaignId and linkId ({blockId}/{index}), otherwise any matching campaign link. |
Order trigger channels are store slugs, such as moonbase or my-shopify-store; an empty list listens on any channel, including live external sales. Historical imported orders do not trigger a journey. Gift purchases do not start order triggers unless includeGifts is true, and then they enroll the buyer, not the recipient. Campaign email triggers watch campaigns, not automation emails.
OrderRefunded and TrialEnded are coming soon. Their names may appear in types but cannot currently run an automation.
Steps
Each step has a type, caller-generated UUID id and optional label. Keep the ID across edits. The server assigns a stable key such as coupon_1; a key supplied in a request is ignored. Steps after it can use its output in copy, for example {{ steps.coupon_1.code }}. Do not reuse a deleted step's ID for a different action.
| Type | Input fields |
|---|---|
Wait | duration, a compact duration such as 30m, 36h or 3d. Leave at null: time-of-day waits have not shipped. |
Condition | rule, an All or Any root in the customer-rule language, and arrays matched and otherwise. Leave holdFor null: waiting for a match has not shipped. |
SendEmail | category (Newsletter or ProductUpdates), subject, optional previewText, bodyText, blocks; optional transactional (defaults to false) and quietPeriod. |
AddToGroup, RemoveFromGroup | groupId, a manually managed list. |
PersonalCoupon | couponId, optional validFor duration. Produces code, discount and expires_at. |
PersonalVoucher | voucherId. Produces code and redeem_url. |
SetProperty | property, valueType (Text, Number, Boolean, Date) and string value, which may use variables. |
Notify | to (team members or account notification addresses), subject and message. |
GrantLicense | productId, quantity from 1 to 10, optional expiresAfter duration. Produces product, and expires_at when it expires. |
Webhook | webhookId, one of your account's configured webhooks. Sends AutomationStepReached; it cannot select a connected app's webhook. |
GoogleAdsConversion | destinationId, a Google Ads account connected in Moonbase, action (id and name of a conversion action other than the ones Moonbase sends purchases, trials and leads to), and optional value. |
MetaConversion | destinationId, a Meta dataset connected in Moonbase, eventName (a custom event: a letter followed by letters, digits or underscores, up to 40 characters, other than Meta's standard events and the ones Moonbase sends itself), and optional value. |
SendEmail content is sent inline, including when inside a condition. Its contentId is server-assigned and ignored on input. Blocks use the campaign format, including personal codes and review requests. Marketing emails follow their category's opt-in. quietPeriod, from 1h to 30d (such as 2d), skips an email when another campaign or automation recently sent marketing email; earlier emails in the same run do not count.
Conversion steps need the Google Ads or Meta integration enabled on your account, and record a conversion when the customer reaches the step. value is a fixed amount in your account's default currency; leave it out to send no value. A step whose account or dataset is disconnected, or whose customer's ad consent does not allow it, is skipped. The API does not list connected accounts and datasets: to find a destinationId and action, add the step to an automation in Moonbase and read that automation here.
transactional: true is for delivering what the customer requested, such as a license, trial or purchase. It is validated for that purpose and does not permit marketing without consent. It is sent only when the trigger was set off by the customer; a manually enrolled customer does not receive it. Quiet periods do not suppress transactional delivery.
All step types in the table are supported. Condition branches rejoin the following step. Limits and readiness can prevent turning a particular definition on; unavailable triggers and unsupported waiting modes are not made available by saving them in a draft.
Inside a Condition's All or Any root, these additional rule types can inspect the current journey:
PerformedSinceEntry:eventType, optionalitems,minimumCountand optionalmaximumCount. Counts matching activity after enrollment, excluding the event that started the run.SpentSinceEntry:eventType, optionalitems, and optionalminimumandmaximumcurrency-to-amount maps. Measures spending after enrollment.OpenedAutomationEmail: nullablestepIdfor an earlier SendEmail step, and a positivewithinduration such as2d. A null step ID means the last email sent on this run.
These rules are only valid inside an automation's Condition, not its enrollment filter, campaigns or customer segments.
Automation example (excerpt)
{
"id": "b05ac6e5-1ed8-4dd4-a977-bff839cf6e27",
"name": "Welcome new customers",
"slug": "welcome-new-customers",
"status": "Draft",
"revision": 1,
"trigger": {
"kind": "SignedUp"
},
"enrollment": {
"mode": "Once"
},
"filter": null,
"steps": [
{
"type": "Wait",
"id": "f0a731e6-ef13-4e71-b072-f329e720f2b5",
"key": "wait_1",
"label": "Give them time to explore",
"duration": "1d",
"at": null
}
],
"counters": {
"enrolled": 0,
"active": 0,
"completed": 0,
"exited": 0,
"failed": 0
},
"readiness": {
"canTurnOn": true,
"problems": []
},
"warnings": [],
"everActivated": false,
"activeSince": null
}
Get automations
Lists automation summaries, newest first. Optional status filters to Draft, Active, Paused or Off. pageSize defaults to 15 and is clamped to 1 through 50; follow the standard next path without dropping the status filter.
Request
GET https://demo.moonbase.sh/api/automations?status=Draft&pageSize=15
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"items": [],
"hasMore": false,
"next": null,
"pageSize": 15
}
Get automation by ID
Returns the complete automation model, including inline email content, latest revision, readiness and warnings. Use it as the starting point for a replacement save. An automation outside this account or one that does not exist returns 404.
Request
GET https://demo.moonbase.sh/api/automations/{automationId}
Api-Key: mb_bbdac119b64649f6937e...
Create automation
Creates a draft and returns 200 with the automation model, including its server-assigned ID, step keys and email content IDs. Sending only name creates an incomplete draft. The example includes a complete welcome definition; it is not active until you turn it on. Invalid input is refused without creating a partial automation.
Request
POST https://demo.moonbase.sh/api/automations/create
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"name": "Welcome new customers",
"trigger": {
"kind": "SignedUp"
},
"enrollment": {
"mode": "Once"
},
"filter": null,
"steps": [
{
"type": "Wait",
"id": "f0a731e6-ef13-4e71-b072-f329e720f2b5",
"label": "Give them time to explore",
"duration": "1d"
},
{
"type": "SendEmail",
"id": "7d6c1075-c625-41a4-8747-fc329ce63e51",
"category": "ProductUpdates",
"subject": "Getting started with your plugins",
"previewText": null,
"bodyText": "Open your account to get started.",
"blocks": [
{
"type": "Text",
"text": "Thanks for joining us. Your downloads are waiting in your account."
},
{
"type": "Account",
"createAccountLabel": "Create your account",
"logInLabel": "Open your account"
}
]
}
]
}
Update automation
Replaces name, trigger, enrollment, filter and every step, including the steps' email content. Send revision from the latest GET. Omitted optional definition fields take their defaults; they are not a partial patch. Returns 200 with the saved automation.
A stale revision returns 409: Conflict; read the latest version and reconcile before retrying. Changing an active definition affects customers from their next step. Removing a step customers are standing on is refused unless impactAcknowledged: true explicitly accepts the reported impact. The refusal says how many customers are waiting and where they would go. Keep that flag false until you have reviewed it. Once everActivated is true, trigger kind and enrollment mode cannot change.
Request
PUT https://demo.moonbase.sh/api/automations/{automationId}
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"revision": 1,
"name": "Welcome new customers",
"trigger": {
"kind": "SignedUp"
},
"enrollment": {
"mode": "Once"
},
"filter": null,
"steps": [
{
"type": "Wait",
"id": "f0a731e6-ef13-4e71-b072-f329e720f2b5",
"label": "Give them time to explore",
"duration": "1d"
},
{
"type": "SendEmail",
"id": "7d6c1075-c625-41a4-8747-fc329ce63e51",
"category": "ProductUpdates",
"subject": "Getting started with your plugins",
"previewText": null,
"bodyText": "Open your account to get started.",
"blocks": [
{
"type": "Text",
"text": "Thanks for joining us. Your downloads are waiting in your account."
},
{
"type": "Account",
"createAccountLabel": "Create your account",
"logInLabel": "Open your account"
}
]
}
],
"impactAcknowledged": false
}
Turn on automation
Starts listening for its trigger and returns the automation. Requires a live account and readiness.canTurnOn; a refusal reports all readiness problems. Events from before activation do not enroll customers.
Request
POST https://demo.moonbase.sh/api/automations/{automationId}/turn-on
Api-Key: mb_bbdac119b64649f6937e...
Pause automation
Stops new enrollments and holds active runs where they are. Their phase becomes Parked; resume continues them. Returns the paused automation.
Request
POST https://demo.moonbase.sh/api/automations/{automationId}/pause
Api-Key: mb_bbdac119b64649f6937e...
Resume automation
Resumes a paused automation and its parked runs, subject to the same readiness and sending requirements as turning it on. Returns the active automation.
Request
POST https://demo.moonbase.sh/api/automations/{automationId}/resume
Api-Key: mb_bbdac119b64649f6937e...
Turn off automation
Stops listening and ends every active run. Turning it on again later does not restore those runs. Returns the automation with status Off.
Request
POST https://demo.moonbase.sh/api/automations/{automationId}/turn-off
Api-Key: mb_bbdac119b64649f6937e...
Delete automation
Deletes a draft or an automation that has been turned off, returning 204: No Content. Turn an active or paused automation off before deleting it. An unknown automation returns 404.
Request
DELETE https://demo.moonbase.sh/api/automations/{automationId}
Api-Key: mb_bbdac119b64649f6937e...
Response status
HTTP/1.1 204 No Content
Get automation usage
Returns quotas, an array with kind, used and limit for each account-wide daily allowance. Counts use the UTC day; a null limit means there is no allowance limit for that kind. Runs can be deferred at an allowance rather than failed. Guard pauses, such as complaints or an unusual enrollment volume, are reported separately on the automation.
Request
GET https://demo.moonbase.sh/api/automations/usage
Api-Key: mb_bbdac119b64649f6937e...
Get automation statistics
Returns counters (enrolled, active, completed, exited, failed), exitReasons (counts keyed by exit-reason name), and steps (counts keyed by step UUID, including deleted steps). A step has reached, done, skipped, failed, matched, otherwise, opened, clicked and approximate waiting counts. An unknown automation returns 404.
Request
GET https://demo.moonbase.sh/api/automations/{automationId}/stats
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"counters": {
"enrolled": 10,
"active": 2,
"completed": 8,
"exited": 0,
"failed": 0
},
"exitReasons": {
"RemovedByMerchant": 0,
"EmailBlocked": 0,
"TurnedOff": 0,
"AutomationDeleted": 0,
"CustomerDeleted": 0,
"CustomerMerged": 0
},
"steps": {
"f0a731e6-ef13-4e71-b072-f329e720f2b5": {
"reached": 10,
"done": 8,
"skipped": 0,
"failed": 0,
"matched": 0,
"otherwise": 0,
"opened": 0,
"clicked": 0,
"waiting": 2
}
}
}
Get automation runs
Lists runs by most recent enrollment. Optional status is a comma-separated list of Active, Completed, Exited, Failed; an invalid status returns 400. pageSize defaults to 25 and is clamped to 1 through 100. Follow next with the same filter. An existing draft with no runs returns an empty page, while an unknown automation returns 404.
Run model
A run is one customer's journey. It contains id, automationId, customerId, optional current customer summary, status (Active, Completed, Exited or Failed), phase, nullable exitReason, enteredAt, nullable endedAt, currentStepId, wakeAt and lastActivityAt. Current step and wake time are null after a run ends. The customer ID remains even if their customer record has been removed.
While active, phase is Ready, Waiting, Deferred, Parked or AwaitingConfirmation (waiting for email confirmation). It has no meaning once terminal. Exit reasons include RemovedByMerchant, EmailBlocked, TurnedOff, AutomationDeleted, CustomerDeleted and CustomerMerged.
A run detail also has optional automation (id, name, status), timeline (oldest-first { at, kind, stepId, detail } entries), and timelineTruncated, which tells you whether old entries have been left out.
Request
GET https://demo.moonbase.sh/api/automations/{automationId}/runs?status=Active,Completed&pageSize=25
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"items": [],
"hasMore": false,
"next": null,
"pageSize": 25
}
Get automation run
Returns the run detail, including its timeline and automation summary. Returns 404 when the account, automation and run do not match.
Request
GET https://demo.moonbase.sh/api/automations/{automationId}/runs/{runId}
Api-Key: mb_bbdac119b64649f6937e...
Add customer to automation
Adds the customer at the first step of an active automation and returns their run with 200. The body requires a Moonbase customerId. A refusal to enroll returns 409 with its reason, such as a once-only journey already taken, a previous manual removal, or an enrollment limit. An unknown automation or customer returns 404. Manual enrollment does not make a transactional email a customer request.
Request
POST https://demo.moonbase.sh/api/automations/{automationId}/runs
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json
{
"customerId": "641c6c86-e11a-48f1-b537-14aa5436ec78"
}
Remove customer from automation
Ends the customer's run and returns its new run view. They cannot enter this automation again, even when its enrollment mode is EveryTime. Returns 404 for a missing or mismatched automation or run.
Request
POST https://demo.moonbase.sh/api/automations/{automationId}/runs/{runId}/exit
Api-Key: mb_bbdac119b64649f6937e...
Get customer automation runs
Lists a customer's automation run details, including timelines and optional automation summaries. Requires automations:read, rather than customers:read. pageSize defaults to 25 and is clamped to 1 through 100; follow next for the remaining history.
Request
GET https://demo.moonbase.sh/api/customers/{customerId}/automations
Api-Key: mb_bbdac119b64649f6937e...
Response
{
"items": [],
"hasMore": false,
"next": null,
"pageSize": 25
}