---
title: "env pull"
description: "Write DATABASE_URL template to .env"
canonical: "https://pgbeam.com/docs/cli/projects/env/pull"
last-updated: "2026-10-30T13:32:17.000Z"
---

# env pull

> Write DATABASE_URL template to .env

URL: https://pgbeam.com/docs/cli/projects/env/pull

{/* Auto-generated from CLI commands. Do not edit. Run `pnpm generate:cli-docs` to regenerate. */}

Write a `DATABASE_URL` connection string template to a `.env` file (or a custom file via `--file`). The URL points to the project's PgBeam proxy host. You'll need to replace `USER`, `PASS`, and `YOUR_DB` with your actual upstream database credentials. If the file already contains a `DATABASE_URL`, you'll be prompted before overwriting unless `--yes` is passed.

## Usage

```bash
pgbeam env pull [flags]
```

## Options

| Option           | Description                                                            | Required | Default |
| ---------------- | ---------------------------------------------------------------------- | -------- | ------- |
| `--file <value>` | Path to the output file                                                | No       | `.env`  |
| `--yes`, `-y`    | Skip the confirmation prompt if the file already contains DATABASE_URL | No       | `false` |

> **Global options**
>
> All [global options](/docs/cli/global-options) (`--token`, `--profile`,
> `--project`, `--org`, `--json`, `--no-color`, `--no-trunc`, `--debug`) are
> also available on this command.

## Examples

```bash
# Write DATABASE_URL to .env
pgbeam env pull

# Write to a custom file
pgbeam env pull --file .env.local

# Overwrite existing DATABASE_URL without confirmation
pgbeam env pull --yes
```

## Output

Prints a success message confirming the file was written and reminds you to replace the placeholder credentials (USER, PASS, YOUR_DB).