Masuga Smile Doodle

Popular Pages

How to Make Craft CMS Plugin Licenses Using the Craftnet API

Ryan Masuga Sep 5, 2018 Read time: 3 minute read
How to Make Craft CMS Plugin Licenses Using the Craftnet API

Need to give away a free license for a commercial plugin in the Craft CMS Plugin Store? There is no GUI at to do this, so use the Craftnet API to easily generate license keys without a purchase.

We developed Link Vault for Craft 3 and had been using it on projects for a few months before it was approved and accepted into the Craft Plugin store as a commercial plugin.

Plugins that are in the Craft Plugin Store communicate with sites on which they’re installed, so now that Link Vault was in this official plugin list (and commercial), we were presented with license key “nag notices” in our Craft control panels.

Craft Plugin License Key Nag Notice

We needed to be able to gift ourselves a few licenses to cover the sites it was in use on (we could just pay ourselves, but that feels a little Inception-y, and I don’t want to rip a hole in the space-time continuum). Further, we will want to grandfather in all the users who had bought Link Vault for Craft 2 and may want to upgrade those sites. There is currently no way to do this when logged into, so you have to use the Craftnet API to create a plugin license, which is easy to do.

New Craft ID API Token

To generate a license key without requiring a purchase, you need your Craft ID username, and an API token from your account. Under Developer Settings, click “Generate New API Token” and copy that somewhere, because when you return to the page, it will be all asterisks.

With those two pieces of information, you have enough to generate a license key. Assuming my login is masugadesign and my API Token is uurzawyghj3ebb7mp8r762h7dn8htstx8xsl7ou7, I would open a terminal window and enter:

$ curl \
   -u masugadesign:uurzawyghj3ebb7mp8r762h7dn8htstx8xsl7ou7 \
   -d $'{
          "edition": "standard",
          "plugin": "linkvault",
          "email": ""

This will generate a standard Link Vault license for the user associated with the ”” email address.

The response that comes back looks like this:


If you (or the person to whom you assigned the license) look under Plugins in your Craft ID account, you will see the new license there, under Licenses > Plugins.

New License Listed Under Plugins

Enter the full license key in your Craft control panel, and the green check-mark will indicate that you're all set.

Valid Craft Plugin


Just yesterday, Studio Espresso released Craftnet CP plugin for Craft CMS 3.x, which is a Craft plugin that allows you to "Generate one or more licenses for a plugin." You could try this as well, but note that the author says "Note that I made this mostly for myself and that future development will take place if and when I need it. Issues and PR's will be handled on a best-effort basis."

Update: Fred Carlsen of Superbig pointed out that he also has a plugin called Craftnet CLI, which should make this process a bit nicer via the command line.

Gray Masuga Texture Gray Masuga Texture

You Might Also Like

How to Fix an Empty H1 Tag on Your Shopify Homepage

How to Fix an Empty H1 Tag on Your Shopify Homepage

Ryan Masuga Aug 15, 2022  ·  5 minute read

Shopify's Dawn theme homepage may get an SEO warning for an empty h1 header element. This is a missed opportunity to help search engines understand what your page is about. Small edits to the theme code can fix this technical SEO issue.

Subscribe to Our Newsletter

A few times a year we send out a newsletter with tips and info related to web design, SEO, and things you may find interesting.

No spam. Unsubscribe any time.