# An organization's environments

> An organization's environments — prod, staging, sandbox — are where its apps are deployed, each with its own database and address. `osyrin org environments` lists them highest-ranked first, the one an app's own address serves, and says whether the plan has room for another; `osyrin org add-environment` creates one, below the existing ones unless `--rank` says otherwise.

<!-- id: zones-environments-of-an-organization · area: zones · stability: preview · html: https://osysharp.com/reference/zones/environments-of-an-organization/ -->

## Summary        {#summary}

`osyrin org environments --org acme` lists the organization's environments with their rank and the offering each runs
on. `osyrin org add-environment staging --name Staging --org acme` creates one. Deploy into it with
`osy deploy --env staging` ([Deploying your app to an environment](https://osysharp.com/reference/local/deploying-your-app/)).

## Signature      {#signature}

```console
osyrin org environments [--org <slug>] [--server <url>] [--json]
osyrin org add-environment <slug> [--name <name>] [--offering <name>] [--rank <n>] [--org <slug>] [--server <url>] [--json]
```

## Description    {#description}

**The highest-ranked environment is the one people get.** An app's own address, `<app>.<domain>`, serves the
highest-ranked environment it is deployed to; `<app>--<environment>.<domain>` serves any one of them. Rank is also the
promotion order: a version moves upward, from sandbox to staging to prod. `osyrin org environments` lists them
highest first and marks the one the bare address serves.

**A new environment goes below the others.** `add-environment` ranks the new one under every existing environment, so
adding a staging environment beside a live production one never changes what your users are served. Pass
`--rank <n>` to place it somewhere else — the highest rank serves the address. When the lowest environment is already
at rank 0 there is no room below it, and the command asks for `--rank`.

**It runs on an offering.** An offering decides which zones an environment's apps run in and where their data lives.
Left out, the default offering is used, or the only one your organization may use; with several and no default the
command names them and asks for `--offering`.

**A plan may limit how many.** The free plan has one environment, production. When the plan has no room for another,
`osyrin org environments` says so in the plan's own words (`refusal` under `--json`), and `add-environment` is
refused with the same sentence.

Who may create one: an Owner or Admin of the organization.

- `--org` — the organization; needed when you belong to more than one.
- `--server` — the Osyrin to ask (default: the one you signed in to).
- `--json` — `environments` prints `{organization, environments: [{slug, name, rank, offering, servesTheBareAddress}],
  mayAddAnother, refusal}`; `add-environment` prints the new environment's id, slug, name, rank and offering.

## Examples       {#examples}

```console
osyrin org environments --org acme --server https://osyrin.app
osyrin org add-environment staging --name Staging --org acme --server https://osyrin.app
osy deploy --env staging --server https://osyrin.app
```

## See also       {#see-also}

[Deploying your app to an environment](https://osysharp.com/reference/local/deploying-your-app/) — deploying into an environment.

[Deploying an application to a cloud platform — the zone builds it](https://osysharp.com/reference/zones/deploying-an-application/) — what a deploy does in the zone.

[What your plan allows, and how much of it is used](https://osysharp.com/reference/zones/plans-and-limits/) — how many environments a plan includes.
