---
title: "auth login"
description: "Authenticate with PgBeam"
canonical: "https://pgbeam.com/docs/cli/auth/login"
last-updated: "2026-09-14T19:37:21.000Z"
---

# auth login

> Authenticate with PgBeam

URL: https://pgbeam.com/docs/cli/auth/login

Authenticate with PgBeam to access your projects and databases. Login uses an API key, which you generate from the PgBeam dashboard under Settings > API Keys; running the command prompts you to paste it. The key is verified against the API before it is stored (an invalid key fails the login), and your organization is resolved automatically: a single visible organization is selected for you, multiple organizations prompt a pick. Credentials are stored in a local profile on disk (`~/.config/pgbeam/`). You can maintain multiple profiles for different environments using the `--profile` flag.

## Usage

## Options

Option

Description

Required

Default

`--api-key`

Authenticate with an API key (the default and only method)

No

`false`

All global options (`--token`, `--profile`,
`--project`, `--org`, `--json`, `--no-color`, `--no-trunc`, `--debug`) are
also available on this command.

## Examples

## Output

On success, prints a confirmation with the authenticated profile name and the selected organization, ready for `pgbeam projects list`. The token is stored locally and used for all subsequent commands. A key the API rejects (401) is not stored and the command exits non-zero.