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 in your Moonbase account settings, 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...'

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.

Pagination example

{
    "items": [
        {
            ...
        }
    ],
    "hasMore": true,
    "next": "/api/customers?paginationToken=..."
}

Customers

Use customer endpoints to manage your customer accounts and get insights into who are buying your products. The customer object will contain the following fields:

  • Name
    id
    Type
    string
    Description

    The Moonbase ID of the customer.

  • Name
    name
    Type
    string
    Description

    The full name of the customer.

  • 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
    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 as City.

    • Name
      region
      Type
      string
      Description

      Region of the address, only required if no locality is given.
      Also known as State.

  • 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.

Customer example

{
    "id": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
    "name": "Tobias",
    "businessName": null,
    "taxId": null,
    "email": "tobias@moonbase.sh",
    "emailConfirmed": true,
    "hasPassword": true,
    "isDeleted": false,
    "ownedProducts": [
        "example-app"
    ],
    "subscribedProducts": [],
    "address": null,
    "communicationPreferences": {
        "newsletterOptIn": true
    }
}

GET Authenticated/api/customers

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.

Request

POST
/api/customers
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 Authenticated/api/customers/{id|email}

Get customer by ID or email

Use this endpoint to look up a customer by their ID or email address.

Request

POST
/api/customers/{id|email}
GET https://demo.moonbase.sh/api/customers/tobias@moonbase.sh
Api-Key: mb_bbdac119b64649f6937e...

Response

{
    "id": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
    "name": "Tobias",
    ...
}

POST Authenticated/api/customers/import

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.

In case a customer account 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.

  • 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
    password
    Type
    string
    Optionality
    optional
    Description

    The initial password for the user. Must contain lower case characters, uppercase characters, numbers and a symbol.

  • 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 as City.

    • Name
      region
      Type
      string
      Description

      Region of the address, only required if no locality is given.
      Also known as State.

Request

POST
/api/customers/import
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
    }
}

Response

{
    "id": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
    "name": "Example User",
    ...
}

PATCH Authenticated/api/customers/{id}

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
    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
/api/customers/{id}
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 Authenticated/api/customers/{id}

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
/api/customers/{id}
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",
    ...
}

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
    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.

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 Authenticated/api/licenses

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
/api/licenses
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 Authenticated/api/licenses/{id}

Get license by ID

Use this endpoint to look up a license by its ID.

Request

GET
/api/licenses/{id}
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",
    ...
}

POST Authenticated/api/licenses/provision

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.

Request

POST
/api/licenses/provision
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",
        ...
    }
]

POST Authenticated/api/licenses/import

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, making migrations easier in some cases.

Required body properties

  • Name
    ownerId
    Type
    string
    Description

    Moonbase ID of the customer that should receive this license.

  • Name
    productId
    Type
    string
    Description

    Moonbase ID of the product that this license is for.

Optional body properties

  • 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.

Request

POST
/api/licenses/import
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",
    ...
}

POST Authenticated/api/licenses/{licenseId}/revoke

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
/api/licenses/{licenseId}/revoke
POST https://demo.moonbase.sh/api/licenses/32016591-73c5-4956-938c-e34366599bc7/revoke
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",
    ...
}

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.

  • Name
    status
    Type
    enum(Active|Inactive)
    Description

    Current status of the product:

    • Active: The product can be issued licenses for
    • Inactive: The product cannot be used by any customer
  • Name
    purchasable
    Type
    boolean
    Description

    Flag for if this product can be purchased.

  • 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.

  • Name
    currentReleaseVersion
    Type
    string
    Nullability
    nullable
    Description

    Semantic version of the current release of this product if any.

Product example

{
    "id": "example-product",
    "name": "AudioPanel",
    "tagline": "This product is used for demo purposes",
    "description": "Used for demo purposes",
    "status": "Active",
    "purchasable": true,
    "website": null,
    "iconUrl": "https://assets.moonbase.sh/demo/products/example-product/icon/...",
    "currentReleaseVersion": "1.0.0"
}

GET Authenticated/api/products

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.

Request

GET
/api/products
GET https://demo.moonbase.sh/api/products
Api-Key: mb_bbdac119b64649f6937e...

Response

{
    "items": [
        {
            "id": "exmaple-product",
            "name": "Example Product",
            ...
        }
    ],
    "hasMore": false,
    "next": null
}

GET Authenticated/api/products/{id}

Get product by ID

Use this endpoint to look up a product by their ID.

Request

GET
/api/products/{id}
GET https://demo.moonbase.sh/api/products/example-product
Api-Key: mb_bbdac119b64649f6937e...

Response

{
    "id": "example-product",
    "name": "Example Product",
    ...
}

Product Releases

Product release endpoints let you manage the releases for the products in your Moonbase account. 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.

  • Name
    publishedAt
    Type
    datetime
    Nullability
    nullable
    Description

    ISO-8601 date and time for when this release was published if any.

  • 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
      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.

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": "Universal",
            "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",
        }
    ]
}

GET Authenticated/api/products/{productId}/releases

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
/api/products/{productId}/releases
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
}

POST Authenticated/api/products/{productId}/releases/new

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
    string
    Description

    Semantic version of the new release.

  • Name
    description
    Type
    string
    Optionality
    optional
    Description

    Optional description of what this release is about.

  • 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.

Optional query parameters

  • Name
    publishImmediately
    Type
    bool
    Optionality
    optional
    Description

    Flag that can be given to immediately publish this new release.

Request

POST
/api/products/{productId}/releases/new
POST https://demo.moonbase.sh/api/products/example-product/releases/new
Api-Key: mb_bbdac119b64649f6937e...
Content-Type: application/json

{
    "version": "1.0.0",
    "downloads": [
        {
            "name": "Installer.exe",
            "platform": "Windows",
            "key": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa"
        }
    ]
}

Response

{
    "version": "1.0.0",
    "description": null,
    "publishedAt": null,
    ...
}

PUT Authenticated/api/products/{productId}/releases/{version}

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.

  • 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.

Optional query parameters

  • Name
    publishImmediately
    Type
    bool
    Optionality
    optional
    Description

    Flag that can be given to immediately publish this updated release.

Request

PUT
/api/products/{productId}/releases/{version}
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": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa"
        }
    ]
}

Response

{
    "version": "1.0.0",
    "description": "1.0.0 is the initial release of Example Product",
    "publishedAt": null,
    ...
}

POST Authenticated/api/products/{productId}/releases/{version}/add-download

Add download

Using this endpoint, you can add more downloads to a release. These are deduplicated based on the platform and file name, and is useful if you have separate build steps per platform that each add their own download to new releases.

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.

Request

POST
/api/products/{productId}/releases/{version}/add-download
PUT 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": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa"
}

Response

{
    "version": "1.0.0",
    "description": null,
    "publishedAt": "2023-10-01T07:28:37.147407Z",
    ...
}

POST Authenticated/api/products/{productId}/releases/{version}/publish

Publish release

Publish an existing product release. This makes the release available to your customers, and also updates the current version of the product to point to this release.

Request

POST
/api/products/{productId}/releases/{version}/publish
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": null,
    ...
}

Downloads

Download endpoints let you upload files to your Moonbase account to use in product releases.

POST Authenticated/api/downloads/prepare

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
/api/downloads/prepare
POST https://demo.moonbase.sh/api/downloads/prepare?contentType=application%2foctet-stream
Api-Key: mb_bbdac119b64649f6937e...

Response

{
    "key": "49b8da10-2d72-4bdf-bf9c-47e56c184bfa",
    "url": "https://demo.moonbase.sh/..."
}

Was this page helpful?