Use license keys to secure and control access to your software. Each key corresponds to a customer purchase, which you can validate through our API, allowing you to grant or revoke access as needed.
Here’s how the license key process typically works with FileJar:
Create a license key list in FileJar (either manually, by copy-pasting a list of keys you already have, or auto-generate using a pattern you provide in FileJar).
Associate a license key with a product in your store - every time someone purchases that product, a unique key from the list will be assigned to them.
The customer enters the key they've received into your software or application.
Your software sends a request to FileJar to verify whether the key is valid and to identify who it belongs to (FileJar will respond with a field called
success
which can be eithertrue
for valid keys orfalse
for invalid keys)Successful responses (for valid keys) also contain details about the
order_id
assigned to the license key, theproduct_id
and thecustomer_email
Finally, your software decides whether to grant access to the user or not, based on the response received from the FileJar Validation API
Below you can find the technical details of the Validation API endpoint, along with the format of the request and response, as well as code examples for JavaScript and Python.
Endpoint
POST https://app.filejar.com/api/validate
Request JSON Body (requires two parameters: shop
and key
)
{
"shop": "your-store.myshopify.com",
"key": "KEY-YOU-WANT-TO-CHECK"
}
Error Response (500)
{
"success": false,
"error": "License key not found"
}
Successful Response (200)
{
"success": true,
"created_at": "2025-01-01T01:01:01.000+00:00",
"assigned_at": "2025-01-02T01:01:01.000+00:00",
"order_id": "987654321",
"assigned": true,
"product_id": "123456789",
"customer_email": "[email protected]"
}
Example Code (JavaScript)
// Replace these values with your store and key
const shopName = "your-store.myshopify.com";
const licenseKey = "KEY-YOU-WANT-TO-CHECK";
async function validateLicense() {
const url = "https://app.filejar.com/api/validate";
const payload = {
shop: shopName,
key: licenseKey
};
try {
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(payload)
});
// Parse the JSON response
const data = await response.json();
if (response.ok && data.success) {
console.log("License key is valid.");
console.log("Details:", data);
} else {
console.error("License key is invalid or not found.");
console.error("Error:", data.error || data);
}
} catch (error) {
console.error("An error occurred while validating the license key:", error);
}
}
// Call the function to validate the license
validateLicense();
Example Code (Python)
import requests
url = "https://app.filejar.com/api/validate"
payload = {
"shop": "your-store.myshopify.com",
"key": "KEY-YOU-WANT-TO-CHECK"
}
headers = {
"Content-Type": "application/json"
}
try:
response = requests.post(url, json=payload, headers=headers)
if response.status_code == 200:
data = response.json()
if data.get("success"):
print("License key is valid.")
print("Details:", data)
else:
print("License key is invalid or not found.")
print("Error:", data.get("error"))
else:
print(f"Request failed with status code {response.status_code}")
print("Response:", response.text)
except requests.exceptions.RequestException as e:
print("An error occurred while validating the license key:", e)