Docly Developers
Function API only Updated 01 Dec 2026

getSubscription()

Returns the subscription the site belongs to: the plan, the monthly price, the limits, this month's usage of storage, transfer, users and AI, and the users with access to the subscription's workspaces. Use it to show a customer's administrator what the solution costs and who uses it.

The function only ever returns the site's own subscription (the one on the site's workspace) and takes no arguments. It returns null when the workspace has no subscription.

Available in API scripts only, like promptAI: the answer contains the users' e-mail addresses, and a page is cached and shown to every visitor.

Parameters

This function takes no parameters.

Returns

null when the site's workspace has no subscription. Otherwise an object:

  • plan: "Start", "Business", "Advanced", "Enterprise", or "Custom" when the limits are not a standard plan. name: the subscription's name.
  • monthlyPrice and currency: the monthly price excluding VAT, for example 365 and "NOK". monthlyPrice is null when the price is by agreement.
  • limits: storageGb, transferGb (per month, including ordered add-ons), users (user licenses) and workspaces. null means no fixed limit.
  • period: month ("yyyy-MM"), days in the month, and updated, when the usage was last summed up (UTC, null before the first time).
  • usage: storageGb stored now, transferGb this month, users with access (the user licenses in use, to compare with limits.users; everyone in users counts, also those who only have access to the website), and ai with cost, currency and calls. storageGbPerDay, transferGbPerDay and ai.costPerDay have one entry per day of the month (UTC, index 0 is the 1st); a day without a storage measurement is null.
  • users: an array of { email, access, lastLogin } for the owners and everyone with an accepted share in the subscription's workspaces, also those who only have access to the website. access is the strongest the user has: "owner", "admin", "edit", "read" or "web". lastLogin is an ISO date, or null if the user has never signed in. The most recent sign-in comes first.

GB are decimal (1 GB = 1,000,000,000 bytes). The AI cost is in the currency Docly records it in (ai.currency, "USD"); convert it yourself if you show it in another currency.

Throws error 1 if the subscription cannot be read right now, or no answer arrives within the script's execution timeout.

Example

Normal JavaScript, running in the browser or on the Docly™ server.
let sub = docly.getSubscription();
if (sub == null) return { subscription: false };

return {
    plan: sub.plan,
    price: sub.monthlyPrice,
    currency: sub.currency,
    storageUsedGb: sub.usage.storageGb,
    storageLimitGb: sub.limits.storageGb,
    userLicenses: sub.limits.users,
    usersWithAccess: sub.usage.users,
    aiCost: sub.usage.ai.cost,
    aiCurrency: sub.usage.ai.currency,
    users: sub.users
};