# Examples

> Source: https://truto.one/docs/cli/examples/

Worked examples for common CLI workflows. Assumes you have run `truto login` and have at least one integrated account.

## Orientation

```bash
truto whoami
truto whoami -o json
truto whoami -p staging
truto profiles list
truto team get -o json
```

## Discover integrations

```bash
truto integrations list
truto integrations list --name hubspot
truto integrations unified-apis <integration-id>
truto integrations tools <integration-id>
```

## Manage tenants

```bash
# List tenants in this environment
truto tenants list

# Pre-create a tenant with metadata before the customer connects
# --metadata '{"tier":"enterprise"}' also works; the flag value is parsed as JSON.
truto tenants create -b '{"id":"acme-1","name":"Acme Corp","metadata":{"tier":"enterprise","region":"wnam"}}'

# Bulk create up to 1000 tenants from a JSON file or stdin
# Default mode is insert (skips existing ids). Use --mode upsert to update them.
truto tenants create-bulk -b '[{"id":"acme-1","name":"Acme Corp"}]'
truto tenants create-bulk --mode upsert -b '[{"id":"acme-1","name":"Acme Corp","metadata":{"tier":"gold"}}]'
cat tenants.json | truto tenants create-bulk --stdin

# Inspect one tenant
truto tenants get acme-1

# Delete a tenant (fails with 409 if it still has integrated accounts)
truto tenants delete acme-1

# Open the tenants page in your browser
truto open tenants
truto open tenants acme-1
```

## Discover what an account can do

```bash
ACCOUNT=<your-integrated-account-id>

truto accounts tools $ACCOUNT
truto accounts identify $ACCOUNT
truto accounts tools $ACCOUNT --methods list
truto accounts tools $ACCOUNT --methods read --tags contacts

truto capabilities $ACCOUNT --type proxy
```

:::callout{type="tip"}
Start with `accounts tools` when you don't know which resources an account supports.
:::

## Proxy API

```bash
ACCOUNT=<your-integrated-account-id>

truto proxy contacts -a $ACCOUNT
truto proxy contacts 1 -m get -a $ACCOUNT -o json
truto proxy contacts -m create -a $ACCOUNT -b '{"properties":{"email":"jane@example.com"}}'
```

## Unified API

```bash
ACCOUNT=<your-integrated-account-id>

truto unified crm contacts -a $ACCOUNT
truto unified crm contacts <id> -m get -a $ACCOUNT -o json
truto unified crm contacts -m create -a $ACCOUNT -b '{"first_name":"Jane","last_name":"Doe"}'
```

## Test a response mapping

```bash
# Evaluate a mapping against a saved raw API response (no live call)
truto unified test-mapping \
  --model crm --resource contacts --integration hubspot \
  --input sample-list-response.json

# Or pass the JSONata expression directly
truto unified test-mapping \
  --mapping '$map(results, function($r) { $r })' \
  --input sample-list-response.json
```

## Export and analyze

```bash
ACCOUNT=<your-integrated-account-id>

truto export crm/contacts -a $ACCOUNT -o ndjson --out contacts.ndjson
truto export crm/contacts -a $ACCOUNT -o ndjson | jq -r '.email_addresses[]?.email' | sort -u
wc -l < contacts.ndjson
```

## Profiles and staging

```bash
truto login --token $STAGING_TOKEN --profile-name staging   # staging is now the active profile
truto integrations list
truto use default   # back to the profile from your first login
```

## Integration build workflow

New integration: build, then apply.

```bash
export ANTHROPIC_API_KEY=sk-ant-...
# Agentic build → working file → refinement (press Enter when done) → my-vendor.integration.json
# With only an Anthropic key, pick Off at the doc verifier prompt, or pass --no-verify-docs
truto integrations build https://docs.vendor.com/openapi.json my-vendor
truto integrations apply my-vendor.integration.json
```

Existing integration, new endpoints only: build with `--only-missing`, then apply. It adds the endpoints the docs list that the live integration lacks, and leaves everything already live as it is.

```bash
truto integrations build https://docs.vendor.com/openapi.json my-vendor --only-missing
truto integrations apply my-vendor.integration.json
```

Apply runs the same checks as `truto integrations lint`, so linting first is optional.

### Build on Fireworks AI instead of Anthropic

```bash
export FIREWORKS_API_KEY=...
export FIRECRAWL_API_KEY=...        # required for web_search / web_fetch under Fireworks

# Default workhorse (glm-5p3-flash) for agent + extraction, deepseek-v4p1-flash for classification
truto integrations build https://docs.vendor.com/openapi.json my-vendor \
  --llm-provider fireworks

# Pin a different workhorse (MiniMax M3) and keep the cheap classifier (naming a workhorse pins classification too)
truto integrations build https://docs.vendor.com/openapi.json my-vendor \
  --llm-provider fireworks \
  --llm-model minimax-m3 \
  --llm-classification-model deepseek-v4p1-flash

# Use Fireworks-hosted Qwen3 embeddings instead of the local ONNX default
truto integrations build https://docs.vendor.com/openapi.json my-vendor \
  --llm-provider fireworks \
  --embedding-provider fireworks \
  --embedding-model qwen3-embedding-8b
```

See [AI-powered build — LLM providers](/docs/cli/integrations-build#llm-providers) for the full preset table and the `--anthropic-model` / `--llm-model` exclusivity rule.

To add a single endpoint when you already have the HTTP verb and path, use `truto integrations add-method` — see [Add method](/docs/cli/integrations-add-method).

## Unified mappings build workflow

```bash
export ANTHROPIC_API_KEY=sk-ant-...
ACCOUNT=<your-integrated-account-id>

# Agentic build → JSONata mapping rows grounded on live samples → my-vendor.crm.mappings.json
truto unified-mappings build my-vendor crm --account $ACCOUNT

# Audit, then push to the base mapping rows
truto unified-mappings validate my-vendor.crm.mappings.json
truto unified-mappings apply my-vendor.crm.mappings.json --target base
```

See [Unified mappings build](/docs/cli/unified-mappings) for the sample ladder, flags, and the MappingFile shape.

## Verbose debugging

```bash
truto proxy contacts -a $ACCOUNT -v
# stderr shows → GET ... and ← status
```

## Piping between commands

```bash
# Create multiple integrations from a file
cat integrations.ndjson | truto integrations create --stdin

# Copy contacts to another account (--stdin takes one JSON body per call).
# Unified records go to the unified create, keeping only the fields to copy.
truto export crm/contacts -a $ACCOUNT_A -o ndjson | \
  head -5 | \
  while IFS= read -r record; do
    printf '%s' "$record" | jq '{first_name, last_name, email_addresses}' | \
      truto unified crm contacts -m create -a $ACCOUNT_B --stdin
  done
```

## More help

- [Data plane](/docs/cli/data-plane) — unified vs proxy
- [Power features](/docs/cli/power-features) — export, diff, JSONata
- [AI-powered build](/docs/cli/integrations-build) — full build options
- Run `truto context` for an LLM-oriented reference (`truto context --full` for the full tree)
