# Overview

Canonical URL: https://developers.iagenify.com/sdk/ref/storage/
Language: en

Where data lives: storages you create with us, databases and buckets you connect, and the devices your code runs on.

Status: 6 methods · three families · one object type back

Everything here hands back the same kind of object — a [ConnectedStorage](/sdk/ref/connected-storage) — whatever is behind it. That is the point: your code reads a database the same way whether we host it or you connected it.

## Three families {#families}

| Family | Made by | Holds |
| --- | --- | --- |
| IaGenify Cloud | create({ service }) | A NoSQL base, an SQL base, or object storage. |
| Connected | connect({ type, provider, endpoint }) | Your own database or bucket, read through us. |
| Devices | the SDK, or device() | A computer or a phone — its files stay on it. |

A computer registers itself the first time the SDK runs on it; you never call anything for that. A phone cannot register itself — the SDK is not on it — so [device()](/sdk/ref/storage/device) exists for that one case.

## The methods {#methods}

| Method | Does |
| --- | --- |
| create({ service, label }) | Opens an IaGenify Cloud storage. No credentials to supply. |
| connect({ label, type, provider, endpoint }) | Registers one of yours. |
| device({ deviceId, name, userAgent }) | Registers a phone. |
| get({ id }) | One storage, or the default with no argument. |
| list() | All of them, newest first. |
| remove(id) | Disconnects or deletes one. |

## What it looks like {#example}

```javascript
// Ours — nothing to configure
const base = await api.storage.create({ service: "nosql", label: "App data" });

// Yours — put the URI in credentials, which is encrypted
const mongo = await api.storage.connect({
  label: "Prod", type: "database", provider: "mongodb",
  endpoint: { credentials: { uri: "mongodb+srv://…/mydb" } },
});

// Read either one the same way
await base.run({ action: "collections" });
await mongo.run({ action: "find", collection: "users", filter: {}, options: { limit: 20 } });
```

> **Credentials go in credentials**
>
> Put the connection URI inside endpoint.credentials, which is encrypted at rest. A storage never hands its endpoint back — the server uses it to connect, and you are the one who supplied it.

## The default {#default}

Every account is created with its own object storage, and that one carries the default flag — so a save with no target has somewhere to go. Exactly one active storage carries it; delete that one and the flag is handed to another rather than left nowhere.

## A storage is not where an agent works {#agent}

> **The agent works on the device it was given**
>
> machine is a separate choice from the default storage. An agent reads the disk it is on; connected storages are things it queries, not where it lives.

- [create()](/sdk/ref/storage/create): An IaGenify Cloud storage, with no credentials to hold.
- [connect()](/sdk/ref/storage/connect): Registering your own database or bucket.
- [ConnectedStorage](/sdk/ref/connected-storage): What all six methods hand back.

```python
# Ours — nothing to configure
base = api.storage.create(service="nosql", label="App data")

# Yours — put the URI in credentials, which is encrypted
mongo = api.storage.connect(
    label="Prod", type="database", provider="mongodb",
    endpoint={"credentials": {"uri": "mongodb+srv://…/mydb"}},
)

# Read either one the same way
base.run(action="collections")
mongo.run(action="find", collection="users", filter={}, options={"limit": 20})
```
