api.storage

remove()

api.storage.remove(id) → Promise<Result>

Disconnects a storage. For one of ours, that also erases what was in it — and the response says which happened.

DELETE /api/storage/:idfreedisconnect or delete
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

Parameters

idstringrequired

From list(). Missing → the SDK throws.

Two very different outcomes

StorageWhat happensResponse
Connected (yours)We forget the connection. Your data is untouched.{ ok: true }
IaGenify Cloud (ours)The data is erased with it.{ ok: true, deleted: true }
A computer or a phoneWe forget the device. Its files stay on it.{ ok: true }
deleted: true means the data is gone

For a storage we host there is nowhere else for it to be. Read what matters out first — reading is free — because nothing here is recoverable.

const result = await api.storage.remove(id);

if (result.deleted) {
  // What was in it no longer exists anywhere.
}
result = api.storage.remove(storage_id)

if result.get("deleted"):
    pass  # What was in it no longer exists anywhere.

Removing the default is allowed

It is not refused: the flag is handed to another active storage, in a deliberate order rather than whatever sorts first.

Preferred heirWhy
An IaGenify Cloud storageIt can actually hold bytes for you.
Another connected storageSame, through your own provider.
A computer or a phone, lastA save with no target cannot write there at all.
The most recent, on a tieThe one most likely to be in use.

That order is the point: a default pointing at a device is a default that refuses every untargeted save. Read list() afterwards to see who took it.

await api.storage.remove(previousDefault);

const now = (await api.storage.list()).find((s) => s.isDefault);
console.log(`the default is now ${now.label} (${now.type})`);
api.storage.remove(previous_default)

now = next(s for s in api.storage.list() if s.is_default)
print(f"the default is now {now.label} ({now.type})")

Before you remove a connected storage

  • Files saved to it through api.files lose the place they point at — list them first.
  • Anything indexed from it stops being findable by meaning.
  • An agent that was given it will no longer find it, and will say so rather than guess.

Errors

CodeStatusWhen
— (thrown locally)—No id passed.
storage_not_found404No active storage of this account with that id.

Removing twice answers 404 the second time. Note what is not here: there is no refusal for « this one is the default ». Every storage can be removed, the flag simply moves — otherwise the storage an account is born with could never be removed at all.