API Keys

Pretty uses two authentication methods: browser-based login for interactive use, and API keys for the CLI, CI, and integrations.

How auth works

The Pretty web dashboard uses Clerk for authentication — you sign in with email, Google, or GitHub. The CLI and API use API keys (prefixed with pd_sk_) for authentication.

When you run pretty login, the CLI opens a browser window to authenticate via Clerk, then provisions an API key automatically and saves it locally.

Creating API keys

API keys can be created in two ways:

Via the CLI

The simplest approach — run pretty login and the CLI handles everything:

pretty login

Credentials are saved to ~/.pretty/credentials.json.

Via the dashboard

  1. Sign in at prettydraft.com/app
  2. Go to your workspace dashboard
  3. Create a new API key in the API Keys section
  4. Copy the key — it's only shown once

Using API keys in CI

For CI pipelines (GitHub Actions, GitLab CI, etc.), use the --token flag to authenticate without a browser:

pretty login --token $PRETTY_API_KEY

Or set the token in your CI environment and pass it directly:

# GitHub Actions example
- name: Generate social assets
  env:
    PRETTY_API_KEY: ${{ secrets.PRETTY_API_KEY }}
  run: |
    pretty login --token $PRETTY_API_KEY
    pretty -p "Generate social media kit from brand/ assets"

Credential storage

Credentials are stored in ~/.pretty/credentials.json:

{
  "token": "pd_sk_...",
  "api_url": "https://api.prettydraft.com",
  "default_project": "my-project"
}

The file contains your API key, the API server URL, and your default project name. Run pretty logout to remove it.

Per-directory project config

When you run pretty init my-project, a local config file is created at .pretty/project.json in the current directory. This overrides the default project for any pretty commands run in that directory:

{
  "project_id": "prj_...",
  "project_name": "my-project"
}

Project resolution

Pretty resolves which project to use in this order:

  1. --project flag — explicit, always wins
  2. .pretty/project.json — local directory config (from pretty init)
  3. default_project in credentials — user-wide default
  4. Fallback — creates or finds a "default" project