> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squarecloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# JavaScript SDK: migrating from v4 to v5

> Upgrade @squarecloud/api from v4 to v5: client.users and backups removed, a new apps.create() result and dns() shape, with the smallest patches needed.

## Requirements

Unchanged from v4: **Node.js 20.0.0** or newer, both ESM and CJS.

## Breaking changes summary

| v4.x | v5.x |
| - | - |
| `client.users.*` (deprecated proxy) | Removed. Use `client.user.*` |
| `app.backup` / `app.backups` | Removed. Use `app.snapshots` |
| `Backup` export | Removed. Use `Snapshot` / `DatabaseSnapshot` |
| `api.applications.create(file)` returns `{ id, name, lang, ram }` | Returns `{ id, name, ram, cpu, language, description?, subdomain? }` |
| `app.network.dns()` returns `{ ownership, ssl }` | Returns an array of DNS records |

## `client.users` removed

Unlike the v3 to v4 migration, there is no deprecated proxy this time. `client.users` no longer exists, calling it throws.

```typescript theme={"system"}
// v4
await api.users.get();

// v5
await api.user.get();
```

## Backups removed

`app.backup` and `app.backups` are gone, along with the `Backup` export. Snapshots are the only supported path for both applications and databases.

```typescript theme={"system"}
// v4
await app.backups.create();
await app.backup.list();

// v5
await app.snapshots.create();
await app.snapshots.list();
```

Use the `Snapshot` class for application snapshots and `DatabaseSnapshot` for database snapshots.

## `api.applications.create(file)` return shape

The created application now returns richer language and resource data instead of the flat `lang`/`ram` pair.

```typescript theme={"system"}
// v4
const { id, name, lang, ram } = await api.applications.create(file);

// v5
const { id, name, ram, cpu, language, description, subdomain } =
    await api.applications.create(file);

// language is now an object, e.g. { name: "javascript", version: "22" }
// cpu is the allocated CPU shares (number)
// description and subdomain are only present when set in squarecloud.config
```

## `app.network.dns()` shape

`dns()` now returns an array of DNS records instead of a single `{ ownership, ssl }` object.

```typescript theme={"system"}
// v4
const { ownership, ssl } = await app.network.dns();

// v5
const records = await app.network.dns();
// [{ type: "txt", name, value, status }, { type: "cname", name, value: "cname.squareweb.app", status }]
```

`txt` records cover both ownership and SSL validation; the `cname` record is the traffic record. `status` reflects the validation state (`pending`, `pending_validation`, `active`, and so on).

## Other changes

* `ApplicationLanguage` now includes `ruby`, alongside javascript, typescript, python, java, elixir, go, rust, php, dotnet and static.
* Error codes were standardized. New names are exported through `APIErrorCode`; the old names remain available as deprecated type aliases. See [Errors](/en/sdks/js/errors) for the current codes.

## Next steps

<CardGroup cols={2}>
  <Card title="Client" icon="plug" href="/en/sdks/js/client">
    Install the SDK and create a client.
  </Card>

  <Card title="Errors" icon="triangle-exclamation" href="/en/sdks/js/errors">
    Error class, retries and rate limits.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.