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

# Quickstart

> Common lofty-cli recipes you can copy and run today. Each example assumes you have already completed Install and Authentication.

Common `lofty-cli` recipes you can copy and run today. Each example assumes you have already completed **[Install](https://developer.lofty.com/cli/install.md)** and **[Authentication](https://developer.lofty.com/cli/authentication.md)**.

## 1. List leads

```bash theme={null}
lofty-cli leads list
```

Limit to fields you actually need:

```bash theme={null}
lofty-cli leads list --return-fields leadId,firstName,lastName,stage
```

Fuzzy-search by name, phone, or email — the server matches all three:

```bash theme={null}
lofty-cli leads list --query "John Smith"
```

## 2. Get one record by ID

```bash theme={null}
lofty-cli leads get --id 1234567890123 --format yaml
```

## 3. Create a record from JSON

Pass the request body as inline JSON:

```bash theme={null}
lofty-cli leads create --body '{"firstName":"Jane","lastName":"Doe","email":"jane@example.com"}'
```

For larger payloads, source the body from a file:

```bash theme={null}
lofty-cli leads create --body @lead-payload.json
```

## 4. Pipe to `jq` for ad-hoc analytics

```bash theme={null}
# Count leads by stage
lofty-cli leads list --json \
  | jq -r '.[].stage' \
  | sort | uniq -c | sort -rn
```

## 5. Bulk export to CSV

```bash theme={null}
lofty-cli leads list --format csv > leads-$(date +%Y%m%d).csv
```

Append more pages without repeating the header:

```bash theme={null}
lofty-cli leads list --offset 1000 --format csv --no-header >> leads-$(date +%Y%m%d).csv
```

## 6. Use the CLI from a script with strict error handling

```bash theme={null}
#!/usr/bin/env bash
set -euo pipefail

LEAD_ID=$(lofty-cli leads list --json | jq -r '.[0].leadId')
echo "First lead ID: $LEAD_ID"

lofty-cli leads get --id "$LEAD_ID" --format yaml
```

## 7. Run from CI/CD

Configure environment variables once on the runner:

```bash theme={null}
export LOFTY_CLIENT_ID="your-client-id"
export LOFTY_CLIENT_SECRET="your-client-secret"
export LOFTY_CUSTOMER_KEY="your-customer-key"
```

Then any command works without an interactive `auth login`:

```bash theme={null}
lofty-cli auth test
lofty-cli leads list --json
```

## 8. Discover commands you do not know

The CLI is fully self-describing. Walk the help tree until you find what you need:

```bash theme={null}
lofty-cli --help                      # all top-level resources
lofty-cli leads --help                # subcommands of `leads`
lofty-cli leads list --help           # options for `leads list`
```

Or browse the **[Command Reference](https://developer.lofty.com/cli/reference)** on this site.

## Next steps

> [card] [API Reference](https://developer.lofty.com/api-reference/leads/overview.md)
>
> Cross-reference commands with the live API spec.

> [card] [Output formats](https://developer.lofty.com/cli/output-formats.md)
>
> Piping patterns for JSON, CSV, YAML, and text.

> [card] [Troubleshooting](https://developer.lofty.com/cli/troubleshooting.md)
>
> Common fixes when something fails unexpectedly.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.