MediaGrabber Pro

SDK Overview

Install the license SDK, initialize the client, and understand the four calls you'll use.

The @theplugins/license-sdk client wraps the portal's Public API so your plugin can validate licenses and report usage with a few typed calls.

Install

npm install @theplugins/license-sdk
# or: pnpm add @theplugins/license-sdk

Framework-agnostic ESM, zero required dependencies. Runs in Node servers, serverless/edge functions, and WordPress sidecars.

Initialize

import { LicenseClient } from '@theplugins/license-sdk'
 
const client = new LicenseClient({
  apiUrl: process.env.LICENSE_API_URL!, // your portal's public origin
})

Store apiUrl in an environment variable so the same build can point at staging or production.

The four calls

Almost every integration uses just these:

CallWhenPage
activate()Once, on first run per installActivation
validate()On startup / periodicallyValidation
reportUsage()After each metered operationMetered Usage
entitlements()Anytime you need limits/usageValidation

Result shape

Every call returns a discriminated Result — check ok before reading data:

const res = await client.validate({ licenseKey, fingerprint })
 
if (!res.ok) {
  // res.error is a human-readable message; res.code is a stable code
  console.error(res.code, res.error)
  return
}
 
// res.data is fully typed here
console.log(res.data.active, res.data.plan.name)

This means you never have to wrap calls in try/catch for expected failures (invalid key, limit reached) — those come back as ok: false.

Next

On this page

SDK Overview | MediaGrabber Pro