# dflow projects:create

> Create a project, and optionally its first environment.

Web page: /docs/cli/path/projects-create/

This creates a project in the current workspace and selects it. The CLI labels the workspace id `org` in errors and in saved config. Pass `--environment` when you already know the environment name. That creates the environment and selects it too.

```bash
dflow projects:create NAME
dflow projects:create NAME --environment ENVIRONMENT --region REGION
```

## Flags

`--environment` also creates that environment and selects it. `--region` sets that environment's region, for example `eu`, and is refused without `--environment`. `--idempotency-key` is sent on both requests, so a retry does not create a second project. This command does not accept `--project`. `--output`, `--api`, and `--context` still apply.

## What you see

The terminal prints `name`, `status`, `id`, and `selected`. The new project is saved, and the previously selected environment is cleared. With `--environment`, a second block prints that environment and selects it.

A duplicate project name exits 4 and leaves the saved selection unchanged. If the environment name already exists, the new project stays selected and the environment selection is empty.

JSON without `--environment` prints the project. With `--environment`, the environment is nested under `environment`.

## When it fails

Exit 1: a bad name, `--region` without `--environment`, or no current workspace. Exit 2: auth. Exit 3: the workspace is not one you belong to. Exit 4: the project or the environment already exists. Exit 10: the API could not be reached.
