- list - List License Keys
- get - Get License Key
- update - Update License Key
- getActivation - Get Activation
- validate - Validate License Key
- activate - Activate License Key
- deactivate - Deactivate License Key
Get license keys connected to the given organization & filters.
Scopes: license_keys:read license_keys:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.licenseKeys.list({
organizationId: "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
});
for await (const page of result) {
console.log(page);
}
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { licenseKeysList } from "@polar-sh/sdk/funcs/licenseKeysList.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const res = await licenseKeysList(polar, {
organizationId: "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
});
if (res.ok) {
const { value: result } = res;
for await (const page of result) {
console.log(page);
}
} else {
console.log("licenseKeysList failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.LicenseKeysListRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.LicenseKeysListResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.Unauthorized | 401 | application/json |
| errors.ResourceNotFound | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Get a license key.
Scopes: license_keys:read license_keys:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.licenseKeys.get({
id: "<value>",
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { licenseKeysGet } from "@polar-sh/sdk/funcs/licenseKeysGet.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const res = await licenseKeysGet(polar, {
id: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("licenseKeysGet failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.LicenseKeysGetRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.LicenseKeyWithActivations>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.Unauthorized | 401 | application/json |
| errors.ResourceNotFound | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Update a license key.
Scopes: license_keys:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.licenseKeys.update({
id: "<value>",
licenseKeyUpdate: {},
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { licenseKeysUpdate } from "@polar-sh/sdk/funcs/licenseKeysUpdate.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const res = await licenseKeysUpdate(polar, {
id: "<value>",
licenseKeyUpdate: {},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("licenseKeysUpdate failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.LicenseKeysUpdateRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.LicenseKeyRead>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.Unauthorized | 401 | application/json |
| errors.ResourceNotFound | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Get a license key activation.
Scopes: license_keys:read license_keys:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.licenseKeys.getActivation({
id: "<value>",
activationId: "<value>",
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { licenseKeysGetActivation } from "@polar-sh/sdk/funcs/licenseKeysGetActivation.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const res = await licenseKeysGetActivation(polar, {
id: "<value>",
activationId: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("licenseKeysGetActivation failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.LicenseKeysGetActivationRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.LicenseKeyActivationRead>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.Unauthorized | 401 | application/json |
| errors.ResourceNotFound | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Validate a license key.
Scopes: license_keys:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.licenseKeys.validate({
key: "<key>",
organizationId: "<value>",
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { licenseKeysValidate } from "@polar-sh/sdk/funcs/licenseKeysValidate.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const res = await licenseKeysValidate(polar, {
key: "<key>",
organizationId: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("licenseKeysValidate failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
components.LicenseKeyValidate | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.ValidatedLicenseKey>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ResourceNotFound | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Activate a license key instance.
Scopes: license_keys:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.licenseKeys.activate({
key: "<key>",
organizationId: "<value>",
label: "<value>",
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { licenseKeysActivate } from "@polar-sh/sdk/funcs/licenseKeysActivate.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const res = await licenseKeysActivate(polar, {
key: "<key>",
organizationId: "<value>",
label: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("licenseKeysActivate failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
components.LicenseKeyActivate | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.LicenseKeyActivationRead>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.NotPermitted | 403 | application/json |
| errors.ResourceNotFound | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Deactivate a license key instance.
Scopes: license_keys:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
await polar.licenseKeys.deactivate({
key: "<key>",
organizationId: "<value>",
activationId: "<value>",
});
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { licenseKeysDeactivate } from "@polar-sh/sdk/funcs/licenseKeysDeactivate.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const res = await licenseKeysDeactivate(polar, {
key: "<key>",
organizationId: "<value>",
activationId: "<value>",
});
if (res.ok) {
const { value: result } = res;
} else {
console.log("licenseKeysDeactivate failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
components.LicenseKeyDeactivate | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<void>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ResourceNotFound | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |