# Overview

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

What the account holds in IaGenify Cloud, what the plan allows, and how to add more. Two calls, and neither of them creates a storage.

Status: 2 calls · usage() is free · add-ons cost credits

`api.cloud` is about **space**, not about data. Creating a storage is [api.storage.create()](/sdk/ref/storage/create), reading and writing it is [run()](/sdk/ref/connected-storage/run); this resource answers the two questions those two cannot: how much room is left, and how to get more.

## The surface {#surface}

| Call | Does | Costs |
| --- | --- | --- |
| api.cloud.usage() | The whole picture: plan, per-service totals, per-storage ceilings, add-ons. | nothing |
| api.cloud.addons.buy({ service, gb }) | Adds gigabytes, billed monthly in credits. | credits |

```javascript
const usage = await api.cloud.usage();

console.log(usage.pack);                       // "free" | "go" | "starter"
console.log(usage.object.usedBytes, "of", usage.object.quotaBytes);

for (const base of usage.nosql.storages) {
  console.log(base.label, base.usedBytes, "of", base.quotaBytes, base.overQuota ? "FULL" : "");
}
```

## Three services, counted apart {#three}

A NoSQL Database, a SQL Database and an Object Storage each have their own count and their own ceiling. Nothing moves between them: filling one does not take room from another, and the free space of one is not usable by another.

| Plan | NoSQL Database | SQL Database | Object Storage |
| --- | --- | --- | --- |
| Free | 50 MB × 1 | 50 MB × 1 | 100 MB × 1 |
| Go | 500 MB × 2 | 500 MB × 2 | 1 GB × 1 |
| Starter | 1 GB × 2 | 1 GB × 2 | 2 GB × 1 |
| Enterprise | 5 GB × 2 | 5 GB × 2 | 10 GB × 1 |

Read as « the ceiling of one storage × how many of them the plan allows ». Details on [Quotas and plans](/sdk/ref/cloud/quotas).

## The ceiling is per storage, and that is the number that refuses a write {#per-storage}

> **A total with room left can still refuse**
>
> Two 500 MB databases are two guarantees of 500 MB, not one of a gigabyte. So a write into a full one is refused while the service total shows space — and the per-storage figure, in usage()..storages[], is the one to show a user.

## Hosting and mail take the object storage {#hosting}

What a host keeps online, and what a mailbox keeps, are counted in the account's Object Storage — the same bytes, the same ceiling. `usage().object.hostingBytes` says how much of it is hosting, which is what makes the total add up when nothing of yours seems to account for it.

## What happens when it is full {#full}

| Operation | Past the ceiling |
| --- | --- |
| Writing | Refused — `quota_exceeded` (403). |
| Reading | Works. |
| Deleting | Works. This is how you get back under. |

That asymmetry is deliberate: a storage you cannot read and cannot empty would be a storage you cannot rescue.

## Buying space {#addons}

```javascript
const { charged, usage } = await api.cloud.addons.buy({ service: "object", gb: 1 });
// charged: 200   — credits taken now
// usage:   the fresh report, ceilings already raised
```

Two add-ons only: `database`, shared by NoSQL and SQL, and `object`. An add-on is a pool laid on top of the guaranteed ceilings — it fills in where a storage has run out, and it can never eat into another one's guarantee.

- [usage()](/sdk/ref/cloud/usage): The whole report, field by field.
- [addons.buy()](/sdk/ref/cloud/addons-buy): What it charges, and when it renews.
- [Quotas and plans](/sdk/ref/cloud/quotas): What each plan includes, per storage.

```python
usage = api.cloud.usage()

print(usage["pack"])                                        # "free" | "go" | "starter"
print(usage["object"]["usedBytes"], "of", usage["object"]["quotaBytes"])

for base in usage["nosql"]["storages"]:
    print(base["label"], base["usedBytes"], "of", base["quotaBytes"], "FULL" if base["overQuota"] else "")
```

```python
result = api.cloud.addons.buy(service="object", gb=1)
result["charged"]   # 200 — credits taken now
result["usage"]     # the fresh report, ceilings already raised
```
