Account
Your account: its plan, balance, month's spend, counts, limits and defaults (Account.get), changing its
defaults (update), the account at a glance with what waits and what failed (status), the public endpoints a
publishable key may call, what an id or key prefix names (resolve), and a one-tap payment link for its owner.
class AccountThe account at a glance (GET /v1/account): its plan's planTier, balance (remaining_usd, null when it can't
be read, never 0), this month's spend, how many of each thing it has (counts), its limits and features, its
defaultRegion and the default a paused user is told (spendingPaused), and what the platform offers (scopes,
explicitScopes). The signed-in owner also reads email, spendCap and consoleKeyId; one of the account's own
secret keys reads the rest.
| id | string | |
| string | null | ||
| owner | { name?: string; email?: string; phone?: string } | null | Who owns it, as NoClick knows them ( |
| planTier | string | null | |
| balance | JsonObject | |
| month | JsonObject | |
| spendCap | JsonObject | null | |
| counts | Record<string, number> | |
| limits | Record<string, number> | |
| features | Record<string, boolean> | |
| defaultRegion | string | null | |
| spendingPaused | PausedSpendingDefault | null | |
| consoleKeyId | string | null | |
| scopes | string[] | What a key with every scope ( |
| explicitScopes | string[] | The scopes a key holds only when it names them. |
| raw | JsonObject | The response JSON exactly as the API sent it. |
type JsonObject = { [key: string]: unknown };getstatic
static get(options?: AccountCallOptions): Promise<Account>Read the account: the signed-in owner, or one of the account's own secret keys acting for it (a key acting for one
of its users is refused with PermissionDenied).
const account = await Account.get();
console.log(account.planTier, account.balance.remaining_usd);The client to send with; defaults to the module client built from NOCLICK_API_KEY.
The account.
updatestatic
static update(
changes: AccountChanges,
options?: { client?: NoClick },
): Promise<Account>Change the account's defaults: only the fields given; null clears one. The signed-in owner's alone. Resolves to
the account as it is now.
await Account.update({ defaultRegion: "eu", spendCapUsd: 200 });The client to send with; defaults to the module client built from NOCLICK_API_KEY.
The account as it is now.
/** What `Account.update` changes: only the fields given; `null` clears one. */
interface AccountChanges {
/** The region new resources take when a call names none; `null` clears it. */
defaultRegion?: string | null;
/** What a paused user is told when their spending is paused without a message; `null` removes it. */
spendingPaused?: PausedSpendingDefault | null;
/** The monthly spending cap in whole dollars; `null` removes it. Only the signed-in owner sets, raises or removes it. */
spendCapUsd?: number | null;
}statusstatic
static status(options?: AccountCallOptions): Promise<AccountStatus>The account at a glance, as the key calling sees it: which account (or which of its users the key acts for), its plan, balance, this month's spend against its caps, approvals waiting on a person, what failed in the last day and what ran last. A user's session is refused.
const status = await Account.status();
console.log(status.account.name ?? status.account.id, status.balance.remaining_usd);The client to send with; defaults to the module client built from NOCLICK_API_KEY.
The status.
publicEndpointsstatic
static publicEndpoints(options?: AccountCallOptions): Promise<PublicEndpoint[]>What a publishable key may list: the account's public endpoints (a shared agent's page, a published workflow), each
by kind and id. The signed-in owner's alone.
for (const endpoint of await Account.publicEndpoints()) console.log(endpoint.kind, endpoint.name, endpoint.url);The client to send with; defaults to the module client built from NOCLICK_API_KEY.
Each PublicEndpoint.
resolvestatic
static resolve(ref: string, options?: AccountCallOptions): Promise<ObjectRef>What ref names in the account: an object's id, a key's prefix (nk_live_ab12…) or one of your users' ids,
resolved to its type and id (and the user it belongs to). Nothing it names rejects with NotFound. The
signed-in owner's alone.
const found = await Account.resolve("nk_live_ab12");
console.log(found.type, found.id);The client to send with; defaults to the module client built from NOCLICK_API_KEY.
Its type and id, and the user it belongs to.
paymentLinkstatic
static paymentLink(
request: {
kind?: "funds" | "plan" | "topup";
amountUsd?: number;
plan?: string;
billingPeriod?: "monthly" | "yearly";
creditsPerMonth?: number;
},
options?: { client?: NoClick },
): Promise<PaymentLink>A one-tap link that pays for the account, made for its owner to open: funds for its balance (amountUsd, whole
dollars; the plan's fee is paid with them), or a plan to move to. Opening it needs no sign-in, so only the
signed-in owner and the account's assistant make one. Its operation (operationId) succeeds once they've paid;
the same purchase asked for again while its link is open answers that link.
const link = await Account.paymentLink({ kind: "funds", amountUsd: 20 });
console.log(link.priceUsd, link.url);The client to send with; defaults to the module client built from NOCLICK_API_KEY.
The link.
AccountStatus
interface AccountStatusThe account at a glance (Account.status): account (its id, name, email, or acting_for: the user a key
acts for), userId, its plan, balance, month, caps with what each spent, the approvals waiting on a
person (approvalsPending), what failed in the last day (failing) and what ran last (operations).
| account | JsonObject | |
| userId | string | null | |
| plan | JsonObject | null | |
| balance | JsonObject | |
| month | JsonObject | |
| caps | JsonObject[] | |
| approvalsPending | JsonObject[] | |
| failing | JsonObject[] | |
| operations | JsonObject | |
| raw | JsonObject | The response JSON exactly as the API sent it. |
type JsonObject = { [key: string]: unknown };ObjectRef
interface ObjectRefWhat Account.resolve found: the object's type and id, and the user it belongs to (null: the account).
| type | string | |
| id | string | |
| userId | string | null | |
| raw | JsonObject | The response JSON exactly as the API sent it. |
type JsonObject = { [key: string]: unknown };PausedSpendingDefault
interface PausedSpendingDefaultWhat a paused user is told when a pause names no message, and the button with it.
| message | string | null | |
| action | { label: string; url: string } | null |
PaymentLink
interface PaymentLinkA payment link (Account.paymentLink): what it buys (label), what checkout charges (priceUsd), its url, when it lapses, and its operation.
| kind | string | |
| label | string | |
| priceUsd | number | |
| url | string | |
| expiresAt | Date | null | |
| operationId | string | null | |
| raw | JsonObject | The response JSON exactly as the API sent it. |
type JsonObject = { [key: string]: unknown };PublicEndpoint
interface PublicEndpointSomething the owner made public that a publishable key may call; name and url are null once it stopped being public.
| kind | string | |
| id | string | |
| name | string | null | |
| url | string | null | |
| userId | string | null | |
| raw | JsonObject | The response JSON exactly as the API sent it. |
type JsonObject = { [key: string]: unknown };