# Machines are storages

Canonical URL: https://developers.iagenify.com/sdk/concepts/machines-are-storages/
Language: en

The machine running the SDK registers itself on your account the first time it exchanges a key. That is what gives an agent somewhere to work, and it is why its files never leave the machine.

Status: registered on first call · files stay local

## The idea {#idea}

A storage is anywhere your data lives, and the list is deliberately mixed: a computer, a browser device, managed cloud storage, and databases or buckets you connect with your own credentials. They differ in where the bytes are — not in how you reach them.

| Kind | Where its data is | Reached with |
| --- | --- | --- |
| computer | on that machine, under ~/.iagenify/files | storage.files |
| phone | in that browser | a files bridge you supply |
| IaGenify Cloud | managed for you | storage.run() |
| connected database or bucket | with your provider, your credentials | storage.run() |

## How a machine arrives {#registering}

You do not register it. On the first key exchange the SDK reports the machine id, the environment and the detected resources, and the machine appears in the list. It keeps the same identity afterwards because the storage id is cached with the session.

```javascript
const pc = await api.storage.get();   // this machine

pc.id;
pc.type;        // "filesystem"
pc.hostname;
pc.isDefault;

await api.storage.list();             // every storage on the account
```

## Why a computer keeps its files {#local}

A computer storage holds no bytes on the server, and that is enforced rather than merely intended: an upload aimed at one is refused with `storage_is_local`. An agent working there reads and writes through the machine itself.

```javascript
// Refused — a computer is not a destination for an upload
await api.files.create({ name: "notes.md", content }).save({ localOnly: false });
// IaGenifyError: storage_is_local

// This is the way: the file is written on the machine
await pc.files.write("notes.md", content);
```

## The default storage {#default}

Every account has one, and it is where a save with no destination goes. A computer is a poor default for that reason — it cannot receive one — so the default normally points at managed cloud storage.

```javascript
await api.getStorage();              // the default
await api.storage.remove(id);        // allowed even for the default
                                     // another storage inherits the flag
```

- [api.storage](/sdk/ref/storage): Connecting, listing, creating and removing.
- [The files bridge](/sdk/runtimes/browser): Giving an agent file operations where there is no disk.

```python
pc = api.storage.get()   # this machine

pc.id
pc.type          # "filesystem"
pc.machine_id
pc.is_default

api.storage.list()       # every storage on the account
```

```python
# Refused — a computer is not a destination for an upload
api.files.create(name="notes.md", content=content).save(local_only=False)
# IaGenifyError: storage_is_local

# This is the way: the file is written on the machine
pc.files.write("notes.md", content)
```

```python
api.get_storage()             # the default
api.storage.remove(storage_id)  # allowed even for the default:
                                # another storage inherits the flag
```
