> ## Documentation Index
> Fetch the complete documentation index at: https://formbnb.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Tool

> Manage FormBnB forms from the command line

The `@formbnb/cli` package lets you manage forms, preview form HTML, view submissions, and configure API access from your terminal.

## Installation

```bash theme={null}
npm install -g @formbnb/cli
```

## Authentication

Login to your FormBnB account:

```bash theme={null}
formbnb login
```

This opens a browser for authentication and stores your credentials locally.

```bash theme={null}
formbnb logout  # Clear stored credentials
formbnb whoami  # Show current user
```

## Commands

### Forms

```bash theme={null}
# List all forms
formbnb forms list

# Create a new form
formbnb forms create --name "Contact Form"

# Get form details
formbnb forms get <form-id>

# Update a form
formbnb forms update <form-id> --name "New Name"

# Delete a form
formbnb forms delete <form-id>
```

### Submissions

```bash theme={null}
# List recent submissions
formbnb submissions list <form-id>

# Export submissions to CSV
formbnb submissions export <form-id> --format csv > submissions.csv
```

### Form HTML

```bash theme={null}
# Download a form's HTML to edit locally
formbnb forms edit <form-id> --file ./form.html

# Upload local HTML back to the form
formbnb forms save <form-id> --file ./form.html

# Create a new form and starter HTML file
formbnb forms create-page --name "Contact Form" --file ./form.html --preview
```

## Configuration

```bash theme={null}
formbnb config set api-key sk_your_api_key
formbnb config set base-url https://api.formbnb.com
formbnb config get
```

You can also authenticate with environment variables:

```bash theme={null}
export FORMBNB_API_KEY=sk_your_api_key
export FORMBNB_API_URL=https://api.formbnb.com
```
