# Redirect CLI commands

> This page describes the CLI command that are used to manage project assets with the Uniform redirect features.

Source: https://docs.uniform.app/docs/guides/cli/commands/redirect

The commands in this section allow you to manage project assets
that involve Uniform's redirect features. This includes:

| Project asset | Command | More information |
| --- | --- | --- |
| Redirect commands | [redirect](#redirect-commands) | Capabilities |

## Redirect commands

These commands should be added as a script command in your project, rather than run directly in the terminal. For example, in the package.json file of a next.js project:

```json
"scripts": {
    "uniform:fetch-redirects": "uniform redirect definition list"
  },
```

### Get redirects

```bash
uniform redirect definition get <id>
```

_command_  
Fetch a redirect definition from the Uniform project.

| Command | Output details |
| --- | --- |
| -f, --format  <br>_string (optional, default value: YAML)_ | Format for the output (YAML or JSON) |
| -o, --filename  <br>_string (optional)_ | File name for the output. If not specified the output is written to stdout. |
| -p, --project  <br>_string_ | Uniform project id. If not specified, the environment variable `UNIFORM_CLI_PROJECT_ID` is used. |
| -f, --format  <br>_string (optional, default value: YAML)_ | Uniform API key. If not specified, the environment variable `UNIFORM_API_KEY` is used. |
| --apiHost  <br>_string (optional, default value: https://uniform.app)_ | Uniform host. If not specified, the environment variable `UNIFORM_CLI_BASE_URL` is used. If the environment variable isn't set, the default value is used. |
| --proxy  <br>_string (optional)_ | Proxy server. If not specified, the following environment variables are used (with the first match being used): `HTTPS_PROXY`, `https_proxy`, `ALL_PROXY`, `all_proxy`. If no match is found, no proxy server is used. |

### List Redirects

```bash
uniform redirect definition list
```

_command_  
List redirect definitions from the Uniform project.

| Command | Output details |
| --- | --- |
| -f, --format  <br>_string (optional, default value: YAML)_ | Format for the output (YAML or JSON) |
| -o, --filename  <br>_string (optional)_ | File name for the output. If not specified the output is written to stdout. |
| -p, --project  <br>_string_ | Uniform project id. If not specified, the environment variable `UNIFORM_CLI_PROJECT_ID` is used. |
| -f, --format  <br>_string (optional, default value: YAML)_ | Uniform API key. If not specified, the environment variable `UNIFORM_API_KEY` is used. |
| --apiHost  <br>_string (optional, default value: https://uniform.app)_ | Uniform host. If not specified, the environment variable `UNIFORM_CLI_BASE_URL` is used. If the environment variable isn't set, the default value is used. |
| --proxy  <br>_string (optional)_ | Proxy server. If not specified, the following environment variables are used (with the first match being used): `HTTPS_PROXY`, `https_proxy`, `ALL_PROXY`, `all_proxy`. If no match is found, no proxy server is used. |

### Pull Redirect

```bash
uniform redirect definition pull <directory or file path>
```

_command_  
Fetch all Redirect definitions from the Uniform project and save them locally.

- If a directory path is specified, a separate file is created for each Redirect.
- If a file path is specified, all Redirect definitions are saved in a single file.

| Command | Output details |
| --- | --- |
| -w, --what-if  <br>_boolean (optional)_ | If true, reports what would be done but changes no files. |
| -m, --mode  <br>string (optional, default value: mirror) | Specifies what kind of changes can be made.  <br>`create` - Create new files but don't update existing files.  <br>`createOrUpdate` - Create new files and update existing files but delete no files.  <br>`mirror` - Create new files, update existing files, and delete files that don't match existing objects in the Uniform project. |
| -d, --diff  <br>string (optional, default value: off) | Specifies which changes are written to stdout. If not specified, the environment variable UNIFORM_CLI_DIFF_MODE is used. If the environment variable isn't set, the default value is used.  <br>`off` - No changes are written.  <br>`update` - Only update changes are written.  <br>`on` - Update, create, and delete changes are written. |
| -f, --format  <br>_string (optional, default value: YAML)_ | Format for the output (YAML or JSON) |
| -p, --project  <br>_string_ | Uniform project id. If not specified, the environment variable `UNIFORM_CLI_PROJECT_ID` is used. |
| -f, --format  <br>_string (optional, default value: YAML)_ | Uniform API key. If not specified, the environment variable `UNIFORM_API_KEY` is used. |
| --apiHost  <br>_string (optional, default value: https://uniform.app)_ | Uniform host. If not specified, the environment variable `UNIFORM_CLI_BASE_URL` is used. If the environment variable isn't set, the default value is used. |
| --proxy  <br>_string (optional)_ | Proxy server. If not specified, the following environment variables are used (with the first match being used): `HTTPS_PROXY`, `https_proxy`, `ALL_PROXY`, `all_proxy`. If no match is found, no proxy server is used. |

### Push redirect

```bash
uniform redirect definition push <directory or file path>
```

_command_  
Insert or update all Redirect definitions from local disk to the Uniform project.

- If a directory path is specified, the Redirect defined in the files in the directory used.
- If a file path is specified, the Redirect in the file are used.

| Command | Output details |
| --- | --- |
| -w, --what-if  <br>_boolean (optional)_ | If true, reports what would be done but changes no files. |
| -m, --mode  <br>string (optional, default value: mirror) | Specifies what kind of changes can be made.  <br>`create` - Create new files but don't update existing files.  <br>`createOrUpdate` - Create new files and update existing files but delete no files.  <br>`mirror` - Create new files, update existing files, and delete files that don't match existing objects in the Uniform project. |
| -d, --diff  <br>string (optional, default value: off) | Specifies which changes are written to stdout. If not specified, the environment variable UNIFORM_CLI_DIFF_MODE is used. If the environment variable isn't set, the default value is used.  <br>`off` - No changes are written.  <br>`update` - Only update changes are written.  <br>`on` - Update, create, and delete changes are written. |
| -p, --project  <br>_string_ | Uniform project id. If not specified, the environment variable `UNIFORM_CLI_PROJECT_ID` is used. |
| -f, --format  <br>_string (optional, default value: YAML)_ | Uniform API key. If not specified, the environment variable `UNIFORM_API_KEY` is used. |
| --apiHost  <br>_string (optional, default value: https://uniform.app)_ | Uniform host. If not specified, the environment variable `UNIFORM_CLI_BASE_URL` is used. If the environment variable isn't set, the default value is used. |
| --proxy  <br>_string (optional)_ | Proxy server. If not specified, the following environment variables are used (with the first match being used): `HTTPS_PROXY`, `https_proxy`, `ALL_PROXY`, `all_proxy`. If no match is found, no proxy server is used. |

### Remove Redirect

```bash
uniform redirect definition remove <id>
```

_command_  
Delete a Redirect definition from the Uniform project.

| Command | Output details |
| --- | --- |
| -p, --project  <br>_string_ | Uniform project id. If not specified, the environment variable `UNIFORM_CLI_PROJECT_ID` is used. |
| -f, --format  <br>_string (optional, default value: YAML)_ | Uniform API key. If not specified, the environment variable `UNIFORM_API_KEY` is used. |
| --apiHost  <br>_string (optional, default value: https://uniform.app)_ | Uniform host. If not specified, the environment variable `UNIFORM_CLI_BASE_URL` is used. If the environment variable isn't set, the default value is used. |
| --proxy  <br>_string (optional)_ | Proxy server. If not specified, the following environment variables are used (with the first match being used): `HTTPS_PROXY`, `https_proxy`, `ALL_PROXY`, `all_proxy`. If no match is found, no proxy server is used. |

### Update Redirect

```bash
uniform redirect definition update <filename>
```

_command_  
Insert or update a Redirect definition from a local file to the Uniform project.

| Command | Output details |
| --- | --- |
| -p, --project  <br>_string_ | Uniform project id. If not specified, the environment variable `UNIFORM_CLI_PROJECT_ID` is used. |
| -f, --format  <br>_string (optional, default value: YAML)_ | Uniform API key. If not specified, the environment variable `UNIFORM_API_KEY` is used. |
| --apiHost  <br>_string (optional, default value: https://uniform.app)_ | Uniform host. If not specified, the environment variable `UNIFORM_CLI_BASE_URL` is used. If the environment variable isn't set, the default value is used. |
| --proxy  <br>_string (optional)_ | Proxy server. If not specified, the following environment variables are used (with the first match being used): `HTTPS_PROXY`, `https_proxy`, `ALL_PROXY`, `all_proxy`. If no match is found, no proxy server is used. |
