TrashItem

The trash: what was deleted and can still be put back.

Deleting an app, database, bucket, dict, queue, repo, volume, inbox or agent moves it here, restorable for 30 days, then purged for good. delete() on each of them returns its TrashItem:

item = noclick.Dict.from_name("rates-cache").delete()
item.restore()   # back under its name, every key with it

A database's restore lands what it rewound here too, as a database_copy: restoring that puts it back into its database. While it's in the trash its name is free and its storage is billed as before; restoring is free. purge() deletes it for good now: the one deletion that can't be undone, so through MCP it waits for a person.

class TrashItem

Something deleted, restorable until purgeAfter.

Attributes
idstring
kindTrashKind

What it is.

resourceIdstring

Its id as it was, and will be again once restored.

namestring | null
userIdstring | null

The user it was deleted from (null for the account's).

trashedAtDate | null
purgeAfterDate | null

When it's purged for good unless restored first.

operationIdstring | null

The deletion's operation (on the item a delete() returned): Operation.undo() on it restores it too.

Types
type TrashKind =
  | "project" | "database" | "database_copy" | "bucket" | "dict" | "queue" | "repo" | "volume" | "inbox" | "agent"
  | "skill" | "memory";

fromIdstatic

static fromId(trashId: string, options?: CallOptions): TrashItem

A lazy reference to an item in the trash by its id.

Parameters
trashIdstringrequired
options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

The item; it loads the first time it's used.

Types
/** `undefined` = the ambient user (from `asUser`), `null` = the account itself. */
type UserOption = UserRef | null | undefined;

/** A `User` or your own id for the user. */
type UserRef = string | UserLike;

/** Anything that can name a user lazily (a `User`). */
interface UserLike {
  _userId(): Promise<string>;
}

liststatic

static list(
  options?: TrashListOptions & { limit?: number },
): Promise<TrashItem[]>

What's in the trash, newest first.

Parameters
options.kindTrashKind

One kind; omitted, every kind.

options.limitnumber

Return at most this many.

options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

options.userFilterUserFilter

Which users the read covers (user_id query), instead of acting as one (user).

Returns

Each item, with when it's purged unless restored first.

Types
type TrashKind =
  | "project" | "database" | "database_copy" | "bucket" | "dict" | "queue" | "repo" | "volume" | "inbox" | "agent"
  | "skill" | "memory";

/**
 * Which users a read covers: `ALL_USERS`, `NO_USER`, a `User` or your id for one. Sent as the
 * `user_id` query parameter, never as the `NoClick-User` header, so it filters without acting as the user.
 */
type UserFilter = typeof ALL_USERS | typeof NO_USER | UserRef;

/** A `User` or your own id for the user. */
type UserRef = string | UserLike;

/** Anything that can name a user lazily (a `User`). */
interface UserLike {
  _userId(): Promise<string>;
}

/** `undefined` = the ambient user (from `asUser`), `null` = the account itself. */
type UserOption = UserRef | null | undefined;

listPagestatic

static listPage(
  options?: TrashListOptions & PageOptions,
): Promise<Page<TrashItem>>

One page of the trash; pass nextCursor back as cursor.

Parameters
options.kindTrashKind

One kind; omitted, every kind.

options.cursorstring | null

The next_cursor of the page before; omit it for the first page.

options.limitnumber

Return at most this many.

options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

options.userFilterUserFilter

Which users the read covers (user_id query), instead of acting as one (user).

Returns

A page whose data holds the items and whose next_cursor is None on the last page.

Types
type TrashKind =
  | "project" | "database" | "database_copy" | "bucket" | "dict" | "queue" | "repo" | "volume" | "inbox" | "agent"
  | "skill" | "memory";

/**
 * Which users a read covers: `ALL_USERS`, `NO_USER`, a `User` or your id for one. Sent as the
 * `user_id` query parameter, never as the `NoClick-User` header, so it filters without acting as the user.
 */
type UserFilter = typeof ALL_USERS | typeof NO_USER | UserRef;

/** A `User` or your own id for the user. */
type UserRef = string | UserLike;

/** Anything that can name a user lazily (a `User`). */
interface UserLike {
  _userId(): Promise<string>;
}

/** `undefined` = the ambient user (from `asUser`), `null` = the account itself. */
type UserOption = UserRef | null | undefined;

restore

restore(): Promise<JsonObject>

Put it back where it was, under its name, with everything in it; throws Conflict when something new has taken its name since. A database_copy goes back into its database: a restore of its own (its operation), which keeps what the database holds now as a copy the same way. Returns the restored resource as its own API shows it.

Returns

The restored resource as its own API shows it, with restored: True.

Types
type JsonObject = { [key: string]: unknown };

purge

purge(): Promise<void>

Delete it for good now: the one deletion that can't be undone.

DeletePreview

interface DeletePreview

What a deletion would do, in words a person reads before agreeing: what it deletes, what stops working (dependsOnIt), the data that goes (dataLost), what stops being billed (stopsBilling), and whether it's reversible and how (undo). Nothing is deleted by asking. confirmToken is what a call through MCP sends to confirm it, within expiresInS.

Attributes
deletesstring
dependsOnItstring[]
dataLoststring[]
stopsBillingstring[]
reversibleboolean
undostring | null
confirmTokenstring | null
expiresInSnumber | null
rawJsonObject

The response JSON exactly as the API sent it.

Types
type JsonObject = { [key: string]: unknown };

previewDelete

function previewDelete(
  method: "DELETE" | "POST",
  path: string,
  options?: { body?: unknown; user?: UserOption; client?: NoClick },
): Promise<DeletionPreview>

What method path would delete (DELETE, or POST for a cancel, close or clear), as the account sees it (user: as one of its users does): what goes, what depends on it, what data is lost and whether it can be taken back. body is the call's own, for a deletion judged by it (a workflow's edits that remove steps). Nothing is deleted.

const { impact } = await previewDelete("DELETE", `/v1/agents/${agent.id}`);
console.log(impact.deletes, impact.reversible ? impact.undo : "for good");
Parameters
method"DELETE" | "POST"required
pathstringrequired
options.bodyunknown
options.userUserOption

Who the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

The preview.

Types
/** `undefined` = the ambient user (from `asUser`), `null` = the account itself. */
type UserOption = UserRef | null | undefined;

/** A `User` or your own id for the user. */
type UserRef = string | UserLike;

/** Anything that can name a user lazily (a `User`). */
interface UserLike {
  _userId(): Promise<string>;
}

DeletionPreview

interface DeletionPreview

A deletion previewed: its operation, method and path, what it's called (title), its impact, and the confirmToken (good for expiresInS seconds) the call takes.

Attributes
operationstring
methodstring
pathstring
titlestring | null
impactDeletionImpact
confirmTokenstring
expiresInSnumber
rawJsonObject

The response JSON exactly as the API sent it.

Types
type JsonObject = { [key: string]: unknown };

DeletionImpact

interface DeletionImpact

What a deletion does, in words a person reads before agreeing; effects says some of dependsOnIt as data too.

Attributes
deletesstring
dependsOnItstring[]

What has to go first, or stops working with it.

dataLoststring[]
stopsBillingstring[]
reversibleboolean

Whether it can be taken back (undo says how).

undostring | null
effectsDeletionEffect[]

DeletionEffect

interface DeletionEffect

One line of a deletion's dependsOnIt said as data, for a page that groups what happens: what it's about (kind, id and name, null where you can't see it), what happens to it (outcome, the area's own word: a listener moves, stops or waits), where it goes (to) and the line that says it, word for word. Several may share a line.

Attributes
kindstring
idstring | null
namestring | null
outcomestring
to{ kind: string; id: string; name: string } | null
linestring