# Admin resources

> Source: https://truto.one/docs/cli/admin-resources/

Admin commands manage Truto platform resources. All follow the same pattern:

```bash
truto <resource> <operation> [args] [options]
```

Operations: `list`, `get`, `create`, `update`, `delete` (where supported). See [Global options](/docs/cli/global-options) for shared flags.

## Integrated accounts (`accounts`)

Live tenant connections to integrations.

```bash
truto accounts list
truto accounts list --integration-name hubspot --status active
truto accounts get <id>
truto accounts create -b '{"environment_integration_id":"...","tenant_id":"...","context":{},"authentication_method":"oauth2"}'
truto accounts update <id> -b '{"status":"inactive"}'
truto accounts refresh-credentials <id>
truto accounts create-token <id>              # short-lived scoped token
truto accounts identify <id>                  # integration, tenant, status in one call
truto accounts tools <id> --methods list,get
```

:::callout{type="warning"}
The command is **`accounts`**, not `integrated-accounts` (shorter alias for the `integrated-account` API path).
:::

**Filters:** `--tenant-id`, `--is-sandbox`, `--integration-name`, `--status`, `--features-super-query`, `--created-at`, `--updated-at`

**Status values:** `active`, `connecting`, `post_install_error`, `validation_error`, `needs_reauth`

**Bulk delete** — delete every account for a tenant, or a specific list of accounts, in a single request:

```bash
# Delete every account for a tenant (capped at 1000 per request; repeat until matched_count < 1000)
curl -X POST https://api.truto.one/integrated-account/bulk-delete \
  -H 'Authorization: Bearer <token>' -H 'Content-Type: application/json' \
  -d '{"tenant_id":"acme-corp"}'

# Or delete a specific list of account UUIDs (max 99 per request because of D1's parameter limit)
curl -X POST https://api.truto.one/integrated-account/bulk-delete \
  -H 'Authorization: Bearer <token>' -H 'Content-Type: application/json' \
  -d '{"ids":["79a39d69-e27e-49cb-b9a9-79f5eea7aa26","0c74a4ad-7b8e-4f3a-9c1d-2e4f5a6b7c8d"]}'
```

## Tenants

External identities that own integrated accounts. One tenant, many connected accounts.

```bash
truto tenants list
truto tenants list --name acme
truto tenants get <id>
truto tenants create -b '{"id":"acme-corp","name":"Acme Corp","metadata":{"tier":"gold"}}'
truto tenants update <id> -b '{"name":"Acme Corp","metadata":{"tier":"platinum"}}'
truto tenants delete <id>

# Create or upsert up to 1000 tenants in a single request (POST /tenant/bulk)
truto tenants create-bulk -b '[{"id":"acme"},{"id":"globex"}]'
truto tenants create-bulk --mode upsert -b '[{"id":"acme","name":"Acme Corp"}]'
cat tenants.ndjson | truto tenants create-bulk --stdin
```

**Filters:** `--id`, `--name`

**Create fields:** `id` (required — URL-path-safe: letters, digits, `. _ : @ + -`, up to 255 chars), `name` (optional; defaults to `id`), `metadata` (optional JSON object)

**Bulk import:** `--mode insert` (default) skips existing ids; `--mode upsert` updates `name`/`metadata` on existing ids. Only `id`, `name`, and `metadata` are allowed per row.

**Update fields:** `name`, `metadata` (`PATCH` replaces the whole metadata object; merge client-side for partial updates)

:::callout{type="warning"}
`truto tenants delete <id>` returns `409 Conflict` if the tenant still has connected accounts. List them with `truto accounts list --tenant-id <id>` (or bulk-delete via the endpoint shown above — capped at 1000 accounts per request), then retry.
:::

See [Tenants overview](/docs/guides/tenants/overview) for concepts and [Bulk import](/docs/guides/tenants/bulk-import) for the CSV/JSON upload flow.

## Environments

```bash
truto environments list
truto environments get <id>
truto environments update <id> -b '{"name":"Production"}'
```

:::callout{type="info"}
Creating and deleting environments requires the dashboard. The CLI supports list, get, and update only.
:::

## Environment integrations

```bash
truto environment-integrations list --integration_id <id>
truto environment-integrations create -b '{"integration_id":"...","override":{...}}'
truto environment-integrations update <id> -b '{"is_enabled":false}'
truto environment-integrations delete <id>
```

## API tokens

```bash
truto api-tokens list --name ci-token
truto api-tokens get <id>
```

Create and delete tokens require the dashboard.

## Sync jobs and runs

```bash
truto sync-jobs list --integration_name hubspot
truto sync-jobs create -b '{"label":"Sync Contacts","integration_name":"hubspot","resources":{...}}'

truto sync-job-runs list --sync_job_id <id>
truto sync-job-runs create -b '{"sync_job_id":"...","integrated_account_id":"..."}'

truto sync-job-triggers list --integrated_account_id <id>
truto sync-job-triggers create -b '{"sync_job_id":"...","cron_expression":"0 */6 * * *"}'
truto sync-job-triggers schedule <id>

truto sync-job-templates list
truto sync-job-templates create -b '{"label":"CRM Sync","resources":{...},"default_runtime_version":2}'
```

**Sync job run state** (key-value checkpoint data keyed by `state_key` from the sync job definition):

```bash
truto sync-job-run-states list --state-key <state_key>
truto sync-job-run-states get <entry-key> --state-key <state_key>
truto sync-job-run-states create --state-key <state_key> --key cursor --value "..."
truto sync-job-run-states update <entry-key> --state-key <state_key> --value "..."
truto sync-job-run-states delete <entry-key> --state-key <state_key> -f
```

## Workflows

```bash
truto workflows list
truto workflows create -b '{"trigger_name":"on_new_contact","config":{...}}'

truto workflow-runs list --workflow_id <id> --status completed
```

Workflow runs cannot be created via CLI — they are triggered by the workflow.

## Webhooks and notifications

```bash
truto webhooks create -b '{"target_url":"https://example.com/hook"}'
truto webhooks test --id <id>

truto notification-destinations create -b '{"type":"slack","config":{...},"label":"Eng Alerts"}'
truto notification-destinations test --id <id>
```

## MCP tokens

Scoped to an integrated account. The **account ID is the first positional argument**:

```bash
truto mcp-tokens list <account-id>
truto mcp-tokens create <account-id> --name "my-mcp-token"
truto mcp-tokens delete <account-id> <token-id> -f
```

## Unified models and environment overrides

```bash
truto unified-models list
truto unified-models create -b '{"name":"crm","category":"crm","description":"CRM model","resources":{...}}'
truto unified-models update <id> -b '{"description":"Updated","version":1}'

truto unified-model-mappings list --integration-name hubspot --resource-name contacts
truto env-unified-models list
truto env-unified-model-mappings list
```

`version` is required on unified model updates — fetch with `get` first.

## Datastores, daemons, team

```bash
truto datastores create -b '{"label":"my-bucket","type":"s3","config":{...}}'
truto datastores test <id>

truto daemons create -b '{"label":"My Daemon"}'
truto daemon-jobs list
truto daemon-job-runs create -b '{"daemon_job_id":"...","daemon_id":"..."}'
truto daemon-job-triggers schedule <id>

truto team get
truto team update <id> -b '{"name":"New Team Name"}'
truto users list
```

## Gates, docs, link tokens, logs, files, schema

```bash
# Static IP egress proxies (command: gates, API: static-gate)
truto gates create -b '{"name":"us-west-proxy","domain":"api.example.com"}'

# User-authored integration/model documentation
truto docs list --integration_id <id>    # at least one filter required
truto docs create -b '{"content":"...","type":"readme","integration_id":"..."}'

truto link-tokens create --tenant-id <tid>
truto link-tokens create --tenant-id <tid> --integrated-account-id <id>

truto logs --log-type unified_proxy_api --integrated-account-id <id> --limit 50

truto files upload /path/to/file.csv

truto schema --out openapi.yml    # YAML output; --out not -o
```

**Log types and filters** vary by type — run `truto logs --help`. `--log-type` is required.

## Capabilities

Show what an integration or account can do — proxy methods, unified resources, auth surfaces, and **AI readiness** scoring:

```bash
truto capabilities hubspot
truto capabilities <account-uuid> --type proxy
truto capabilities acme-crm --resource contacts --methods list,get
truto capabilities hubspot --has-description          # only methods with descriptions
truto capabilities hubspot --target integration       # force integration (not account) lookup
```

UUID-shaped targets are treated as integrated accounts; otherwise integration slug/ID. Override that guess with `--target integration` or `--target account`.
