Help

License keys

A license key is a code that proves someone bought a product. Creators use keys so only paying customers can run their plugin, and they can cancel a key at any time. This guide covers both sides.

Video guide

2 min 50 s · music and on-screen subtitles, so it works with the sound off. Everything in it is written out below.

If you bought a product

  1. 1. Open your library

    After you pay, or claim a free product, open My library from your account. If the creator uses license keys, the product's card shows your key under the product details.

  2. 2. Press Copy key

    A key looks like BBB-7K2QD-9XH4M-3TPVA-8CNRB. It is made for you and that one product.

  3. 3. Paste it where the creator says

    Often that is one line in the plugin's config file, like license-key: "BBB-7K2QD-9XH4M-3TPVA-8CNRB", or a box in their app. The product page or the creator's instructions say exactly where. Restart the server if they tell you to.

Keep your key private. Anyone who has it can run the product as you. Don't put it in screenshots or public chats. If it leaks, tell the creator so they can revoke it.

If you sell a product

Step 1: Turn keys on

Open License keys in your creator studio and tick Issue keys next to the product.

  • Every buyer gets their own key. It is created the first time they open their library after buying or claiming, including people who got the product before you switched keys on.
  • You can see each key under Issued keys, with how many times it has been checked and when it was last checked. Search by any part of a key.
  • Your product's slug is the last part of its address: builtbybharat.com/product/your-product-slug. You will need it in your code.

Step 2: Check the key from your code

Your plugin or app sends one request to our server, which answers whether the key is good. Use a POST request with a JSON body. Never put the key in a link.

POST https://builtbybharat.com/api/v1/licenses/verify
Content-Type: application/json

{"key": "BBB-7K2QD-9XH4M-3TPVA-8CNRB", "product": "your-product-slug"}
What each answer means
AnswerWhat it means
{"valid":true,"product":"your-product-slug"}The key is real, belongs to this product and has not been revoked. Let the plugin run.
{"valid":false,"reason":"invalid"}Not a key for this product: a typo, an unknown key, a key for a different product, or you have switched Issue keys off.
{"valid":false,"reason":"revoked"}You revoked this key.
HTTP 429More than 60 checks in a minute from one IP address. Wait a moment, and keep answers in memory so you ask less often.
HTTP 400 or 413The request wasn't JSON like the example above, or it was larger than 2 KB.

Keys are not case-sensitive and spaces around them are ignored. The answer never says who bought the product. Up to 60 checks a minute are allowed from one IP address.

Code to copy

Replace the product slug with your own, and the key with the one your buyer entered.

Java (Minecraft plugins)

Needs Java 11 or newer. Call it from an async task, never from the server's main thread.

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;

public final class License {
    private static final URI VERIFY = URI.create("https://builtbybharat.com/api/v1/licenses/verify");
    private static final HttpClient HTTP = HttpClient.newHttpClient();

    /** True only when the server says the key is valid for this product. */
    public static boolean check(String key) throws Exception {
        // Keys hold only letters, digits and dashes. Refuse anything else before building the JSON.
        if (!key.matches("[A-Za-z0-9-]{1,40}")) return false;
        String body = "{\"key\":\"" + key + "\",\"product\":\"your-product-slug\"}";
        HttpRequest request = HttpRequest.newBuilder(VERIFY)
                .header("Content-Type", "application/json")
                .timeout(Duration.ofSeconds(10))
                .POST(HttpRequest.BodyPublishers.ofString(body))
                .build();
        HttpResponse<String> response = HTTP.send(request, HttpResponse.BodyHandlers.ofString());
        if (response.statusCode() != 200) throw new IllegalStateException("License check failed: HTTP " + response.statusCode());
        return response.body().contains("\"valid\":true"); // or parse it with Gson or Jackson
    }
}
Node.js

Needs Node.js 18 or newer, which has fetch built in.

const VERIFY_URL = "https://builtbybharat.com/api/v1/licenses/verify";

/** Resolves to true only when the key is valid for this product. */
async function checkLicense(key) {
  const res = await fetch(VERIFY_URL, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ key, product: "your-product-slug" }),
  });
  if (!res.ok) throw new Error(`License check failed: HTTP ${res.status}`); // 429 means too many checks
  const data = await res.json();
  return data.valid === true; // otherwise data.reason is "invalid" or "revoked"
}
Python

Needs the requests package: pip install requests

import requests

VERIFY_URL = "https://builtbybharat.com/api/v1/licenses/verify"

def check_license(key: str) -> bool:
    """True only when the key is valid for this product."""
    res = requests.post(VERIFY_URL, json={"key": key, "product": "your-product-slug"}, timeout=10)
    if res.status_code != 200:  # 429 means too many checks
        raise RuntimeError(f"License check failed: HTTP {res.status_code}")
    return res.json().get("valid") is True  # otherwise "reason" is "invalid" or "revoked"
curl (to try it by hand)

Paste it into a terminal. Replace the key and the product slug.

curl -s -X POST https://builtbybharat.com/api/v1/licenses/verify \
  -H "Content-Type: application/json" \
  -d '{"key":"BBB-7K2QD-9XH4M-3TPVA-8CNRB","product":"your-product-slug"}'

Good habits

  • Check when your plugin starts, then remember the answer for a few hours.
  • In a Minecraft plugin, run the check in an async task so the server never lags while it waits.
  • If our server can't be reached, decide ahead of time whether to keep running on the last good answer. For most plugins that is kinder to your buyers.
  • Don't print keys in logs or chat, and don't ship a key of your own inside the file you sell.

Step 3: Revoke a key, or restore it

In License keys, find the key under Issued keys and press Revoke, then confirm. Your plugin getsrevoked on its next check, and the buyer sees Revoked by the creator in their library. Press Restore to undo it.

Revoking only stops the key passing your check. It does not refund the buyer or remove their purchase. Refunds are handled under the refund policy.

Questions

I can't see a license key in my library.
Only products whose creator has turned keys on show one. If the product should have a key, ask the creator. They can switch it on, and your key appears the next time you open your library.
The plugin says my key is invalid.
Check you copied the whole key, with the dashes and nothing extra. Make sure it is the key for this product, since each product has its own. Keys are not case-sensitive. If it still fails, tell the creator: they can see their issued keys and how often each was checked.
My key says “Revoked by the creator”.
The creator cancelled it, which they normally do for a reason such as a refund or a leaked key. Contact them from the product page or their store page. Revoking a key doesn't remove your purchase or your downloads, and refunds follow our refund policy.
Can one key be used on more than one server?
That is the creator's choice. Our check only says whether a key is valid for a product. It does not count servers or devices, so a creator who wants to limit that has to do it in their own code.
Does the check tell me who bought a key?
No. The answer only says valid or not, and never includes the buyer's name, email or order.
How often should my plugin check?
Once when it starts, then again every few hours at most. Keep the last good answer in memory and use it if our server can't be reached for a while. Servers that share one IP address also share the limit of 60 checks a minute.
What if I turn Issue keys off?
Keys stop being shown in libraries and every check for that product answers invalid until you switch it back on. Nothing is deleted, so the same keys work again when you do.
Do free products get keys?
Yes, if the creator turns keys on. Each free claim gets its own key, just like a paid purchase.

Still stuck? Contact us and say which product and which side you are on, creator or buyer.