Parameters
servicestringrequirednosql · sql · object. Missing → the SDK throws.
labelstringThe display name. The service's own name by default.
The three services
| service | Is | Read and written with |
|---|---|---|
| nosql | A document database — collections and documents. | run({ action: "find" | "insert" | "aggregate" … }) |
| sql | A relational database — tables and SQL. | run({ action: "sql" }) |
| object | Object storage — keys and bytes. | run({ action: "objects" | "put" | "remove" }) |
const base = await api.storage.create({ service: "nosql", label: "App data" });
base.id;
base.label; // "App data"
base.type; // "database"
base.service; // "nosql"
base.provider; // "iagenify"
await base.run({ action: "insert", collection: "events", documents: JSON.stringify([{ at: Date.now() }]) });
await base.run({ action: "count", collection: "events" });import json, time
base = api.storage.create(service="nosql", label="App data")
base.id
base.label # "App data"
base.type # "database"
base.service # "nosql"
base.provider # "iagenify"
base.run(action="insert", collection="events", documents=json.dumps([{"at": int(time.time() * 1000)}]))
base.run(action="count", collection="events")Why this rather than connecting your own
| IaGenify Cloud | Connected | |
|---|---|---|
| Credentials | none to hold | yours, to supply and rotate |
| Setup | one call | an account somewhere else |
| Space | what your plan gives, extendable | whatever you pay for there |
| Portability | ours | yours, and it stays yours |
The calls are identical either way, so this is not a decision you are locked into — the code that reads one reads the other.
How many, and how much
The plan decides how many storages per service and how much space each one gets. Both are readable before you hit them with api.cloud.usage(), which is better than discovering a limit through a refusal.
const usage = await api.cloud.usage();
// per service: what is used, what the plan includes, what is available
const base = await api.storage.create({ service: "nosql", label: "App data" });usage = api.cloud.usage()
# per service: what is used, what the plan includes, what is available
base = api.storage.create(service="nosql", label="App data")quota_exceeded stops you adding; reading and deleting keep working, so you can always get your data out and make room. That asymmetry is deliberate.
Errors
| Code | Status | When |
|---|---|---|
| invalid_service | 400 | Not one of the three — thrown by the SDK when absent. |
| cloud_storage_limit | 403 | The plan's count for that service is reached. |
| cloud_service_unavailable | 503 | That service cannot be served right now. |