Chapter 13

Run Stand commands and scripts (CLI)

Open your website project in a coding agent and ask it to “Add stand.chat”. The agent uses the Stand CLI to set up your Site. You can also run the CLI yourself or in a script to upload files, export conversations, or check for new chats every day. To ask questions or change settings from an AI chat, connect to the same Stand account with MCP.

Stand Guidebook

Chapter 13 of 17

Field guide

What to learn in this chapter

Start with what to ask your agent and what it needs. Installation, sign-in and the command sections follow, for when you or your agent need the details. Command examples use placeholder IDs: replace them with IDs returned by your own account. Ordinary examples use readable terminal output; use --json when an agent or script needs to parse the result.

Need an exact capability definition, plan requirement, or limitation? Browse the Feature Reference.

Start here

01

Tell your agent what you want.

You do not need to learn the commands. Ask in your own words. The agent installs the CLI, starts sign-in and gives you a link to approve its access in your browser. Then it runs the commands and reports back.

To use the CLI, the agent needs a computer where it can run npm with Node.js 22 or newer on macOS, Linux or WSL, with network access. Coding agents such as Codex, Claude Code, Cursor and Gemini CLI can run commands in your project. Always-on agents can run the CLI on their own computer.

To install Stand, open your website project in a coding agent and say “Add stand.chat”. It also needs to edit the project, use a real browser and publish through your usual workflow. You complete signup and consent, approve the content and changes, and authorize publishing.

Guided setup

Installing Stand with an agent?

The short setup guide explains the project, browser handoff, and final visitor check.

Follow agent setup

Install Stand on your website

Add stand.chat

This is the whole prompt. The agent finds the setup instructions on stand.chat.

Analyze conversations once

Use the Stand CLI to read my Stand Chat conversations from last week. Summarize the questions visitors asked most and the ones the Stand-in could not answer. Keep the transcripts out of any repository. Propose changes to our approved knowledge; do not apply them yet.

Every day

02

Have your agent check new conversations.

An always-on agent that can run npm, such as a dot in ChatGPT, Meta’s Muse or Grok Bot, can check your Stand conversations once a day and tell you when something interesting comes up: a question the Stand-in could not answer, a visitor comparing you with a competitor, someone who asked to be contacted.

Ask it once, in your own words. On the first run it installs the CLI and gives you a link to approve read-only access in your browser. After that it checks by itself.

Ask once

Check my Stand Chat conversations every day with the Stand CLI. Use read-only access. If anything interesting happens, tell me here.

What the agent runs

stand config set --profile review --api-url https://api.stand.chat \
  --issuer https://auth.stand.chat/realms/stand --json
stand auth login --profile review --scopes "profile:read sessions:read" --json
stand history search --profile review --closed-from 2026-11-11T08:00:00Z \
  --closed-to 2026-11-12T08:00:00Z --all --json
stand history export --profile review --closed-from 2026-11-11T08:00:00Z \
  --closed-to 2026-11-12T08:00:00Z \
  --output /absolute/path/stand-2026-11-12.json --json

The agent keeps the check in its own CLI profile, here called review, so signing in for other work never changes the check’s read-only access. It creates the profile and signs in once; later runs reuse the sign-in until it expires. On a computer without an OS keychain, add --credential-store file. Search lists each conversation with its page, message count, contact details and signals. The export adds the full transcripts in a new file each day; it never overwrites one.

Good to knowWhat it reads
DetailsConversations that ended since the last complete check; if a check fails, the next one covers the gap. One still in progress shows up after it ends. You see your own conversations, including your Stand-ins’; an organization owner can ask for the whole team’s.
Good to knowHow long access lasts
Details30 days from your approval, however often it is used. Then the agent gives you a new link to approve. Its computer has to keep the CLI’s saved sign-in between checks; otherwise you approve access every time.
Good to knowWhat it does not do
DetailsWith read-only access it changes no settings, does not join a chat and does not make you Available.
Good to knowPrivate data
DetailsThe conversations include what visitors wrote and any contact details they left. Tell the agent where it may keep them, and not to send them anywhere else.
Good to knowTo stop
DetailsAsk the agent to run stand auth logout --profile review. Signing out of the Stand app does not end its access.
Good to knowWithout an agent
DetailsStand’s email digests recap your conversations daily, weekly or monthly.

Other tasks

03

Give other tasks a clear scope.

For other work, name the Site, Stand-in or knowledge you mean and the result you want. Ask the agent to inspect first and show its proposed changes. CLI permissions and --yes do not expand the work you authorized.

Ask for a useful handoff

  • Installed CLI version, selected profile, and the Site and Stand-in IDs used.
  • What changed, which existing resources were reused, and what remains unfinished.
  • Ingestion results and retrieval checks for knowledge changes.
  • For installation, the deployed page and real visitor-answer result, or the precise step that still needs access.

Audit without changing settings

Inspect the Stand Site for example.com, its Stand-ins, and their attached knowledge. Report missing setup or stale sources. Do not change any settings.

Refresh an approved knowledge source

I approve sharing support-policy.md with Stand and using its facts in visitor answers. Find the existing uploaded source for this document and propose its replacement. Preserve all other sources and attachments. After approval, check ingestion and test retrieval with three relevant questions.

Installation

04

Install the official package.

You need Node.js 22 or newer and npm on macOS, Linux, or WSL. On Windows, run these commands inside WSL; native Windows is not supported. When an agent does the work, it needs the same on the computer where it runs commands.

Install @standchat/cli globally, then check the executable and version. You can run Stand commands from any folder. If the official package cannot be installed, check the error instead of substituting a similarly named package.

The unpinned install command follows npm’s latest tag. Run the same command to update, and record stand --version when asking for help. Package versions and npm tags do not choose your API environment.

Install or update

node --version
npm install --global @standchat/cli
stand --version
stand --help

If stand is not found after installation, check that your npm global executable directory is on PATH in this terminal and in the agent’s terminal.

Your account

05

Approve access in your browser.

For website setup, use the setup permission preset. Keep the login command running. It prints a verification URL and a separate user code; open the URL yourself, sign in or create an account, and review the requested access.

After the browser says “Signed in to Stand”, return to the terminal and wait for credential storage to finish. Then check setup status. If it reports browser_onboarding_required, open the Stand app at the indicated URL with the same account, complete your profile and organization, and run the check again.

Inspect the ready and status fields, not just the command’s exit code. A ready result means account configuration can begin. JSON identifies account_readiness_only and lists website installation and visitor chat in notChecked. A ready result does not mean a widget is installed or a visitor has received an answer.

First website setup

stand auth login --setup
stand setup status
stand auth status --check

auth status alone shows local sign-in metadata. Adding --check verifies your identity through the API; it does not check completed onboarding.

If this host has no usable OS keychain

stand auth login --setup --credential-store file

macOS defaults to Keychain; Linux uses the OS secret service when available. File storage is an explicit choice for hosts such as headless Linux or WSL. Credentials stay in private user storage, outside the project.

Environments

06

Keep each target in its own profile.

The default profile targets Stand production. Create a named profile before logging in to staging or a preview. A name such as preview1936 is only a label: it does not discover URLs or start a preview environment. A named production profile keeps a separate sign-in, such as the read-only access of a daily conversation check.

Save the verified API origin and issuer together, then use --profile on each command. A preview needs its own deployed endpoints. For a custom environment, setup status also accepts --app-url with its verified Stand app origin.

config list shows saved configuration. auth status shows the endpoints resolved for the current invocation. STAND_PROFILE selects a saved profile; STAND_API_URL and STAND_ISSUER override endpoints without rewriting it. Credentials are bound to the selected API and issuer, so changing the target may require a new login.

Example: a separate staging profile

stand config set --profile staging \
  --api-url https://api.staging.stand.chat \
  --issuer https://auth.staging.stand.chat/realms/stand

stand config list
stand auth login --profile staging --setup
stand setup status --profile staging
stand sites list --profile staging

Use these endpoints only for the Stand staging environment. Use the actual preview endpoints for a preview profile. Commands without --profile use STAND_PROFILE when set, otherwise default.

Find your way

07

Inspect before you change anything.

Use --help for a readable overview and commands --json for machine-readable discovery. Each named command describes its inputs and whether it needs mutation confirmation. schema takes an operation ID and shows its required scopes and request shape.

List existing Sites, Stand-ins, and knowledge bases before creating more. Keep their returned IDs in your working notes, reuse the intended resources, and check the account’s plan and usage. A display name is not a reliable resource identifier.

For an operation without a named shortcut, stand api accepts its published method and /v1/ path. It uses the same authentication and permissions and only supports operations in the bundled public API contract.

Reference

Look up the full command and API contract.

The reference covers scopes, request shapes, output, and operations beyond these walkthroughs.

Open the reference

Discover commands and read the account

stand --help
stand auth --help
stand help workflows
stand commands --json
stand schema createStandin
stand sites list
stand standins list
stand knowledge list
stand org plan
stand org usage
stand sessions count

stand sessions count returns how many conversations you and your Stand-ins have open, as numbers only. It needs analytics:read, not access to the conversations.

A generic API read

stand api GET /v1/knowledge-bases/KNOWLEDGE_BASE_ID/tasks \
  --query-param view=inspection --query-param limit=20

Explicit knowledge inspection returns bounded metadata pages. Follow nextCursor as after with the same filters when another page is available.

Website setup

08

Create, configure, then verify.

Start with the Site and Stand-in lists. If the website has no matching authorized Site, create one using its hostname, such as example.com, rather than a full URL. Read its returned snippet field for the installation code.

For a new Stand-in, save the example below as standin.json, replace SITE_ID, and write an approved briefing. Creation leaves the Stand-in disabled. Add and verify its knowledge before enabling it.

When updating an existing Stand-in, read it and inspect updateStandin first. The update body is a complete set of writable settings; omitted values can clear existing configuration. Keep the standinProfileId returned by the save, because it can change. Attachment writes likewise replace the full list.

Guided setup

Prefer to hand this workflow to your agent?

The short setup guide explains the project, browser handoff, and final visitor check.

Follow agent setup

Finish the installation

  • Check that the Site is enabled as well as the individual Stand-in and account-wide Stand-in switch. Approve any change to existing availability first. Changing the master switch can activate other enabled Stand-ins, so approve that shared effect first.
  • Install the exact returned snippet once, using your framework’s supported mechanism and preserving consent and Content Security Policy. Keep CLI credentials out of website code and source control.
  • Publish through the website’s authorized workflow. On the configured hostname, open the widget as a visitor, send a real question, and verify an answer grounded in the approved content.
  • Report any remaining deployment or browser test explicitly. A saved configuration, script load, or queued crawl alone is not a working chat.

Create a Site only when needed

stand sites create --domain example.com --name Example
stand sites get SITE_ID
stand schema createStandin

Interactive mutation commands ask for confirmation. These commands create real account resources after approval.

standin.json — a new, Site-specific Stand-in

{
  "name": "Website help",
  "displayName": "Alex",
  "prompt": "Answer using our approved support material. Say when the answer is unknown.",
  "siteId": "SITE_ID"
}

Create it, then inspect the result

stand standins create --body-file standin.json
stand standins get STANDIN_ID
stand standins status

Use the ID returned by creation. Enable the intended Stand-in with stand standins set-enabled STANDIN_ID --enabled true only after reviewing its configuration and knowledge.

Keep answers current

09

Add approved sources and check the result.

Read knowledge list for effective capabilities, ingestion availability, remaining capacity, and graceReadOnly before a change. Check each base’s ownedByCurrentRep value: uploads, replacements, recrawls, cancellations, and deletions require that base’s owner, even if you own the organization. The Base plan can use approved instructions and supported public website crawling. Uploads require documentUploadAllowed, normally on Pro or Business; sitemap creation needs sitemapAllowed, and nightly refresh needs automaticRefreshAllowed.

Use a public crawl for approved website content. For local documents, upload the file directly when permitted. Approve sharing private content with Stand and using its facts in visitor answers; do not publish a private document just to make it crawlable.

Uploads accept nonempty PDF, DOCX, Markdown (.md or .markdown), and TXT files up to 10 MiB each. The separate 11 MiB CLI content budget and 12 MiB encoded API request limit do not increase that document limit.

knowledge.json — create a base if one is needed

{
  "name": "Support material",
  "description": "Approved visitor-facing facts"
}

crawl.json — one approved public page

{
  "domain": "example.com",
  "urlPrefix": "https://example.com/docs/",
  "maxDepth": 0
}

Replace the example with the approved host and starting page. Depth zero fetches only that page; a deeper crawl stays in its host and path subtree and is subject to the returned page allowance.

Create a base, queue the crawl, and inspect ingestion

stand knowledge create --body-file knowledge.json
stand knowledge crawl KNOWLEDGE_BASE_ID --body-file crawl.json
stand knowledge tasks KNOWLEDGE_BASE_ID
stand knowledge documents KNOWLEDGE_BASE_ID

Use the returned base ID. Skip creation when reusing an intended existing base. Queue acceptance is not completed ingestion; wait for the task and inspect its indexed documents.

Optional document upload, when permitted

stand knowledge upload KNOWLEDGE_BASE_ID \
  --file /absolute/path/approved-document.md
stand knowledge tasks KNOWLEDGE_BASE_ID
stand knowledge documents KNOWLEDGE_BASE_ID

Use this instead of a public crawl for an approved local document when documentUploadAllowed and ingestionAllowed permit it. Base-plan installation does not require an upload.

Inspect the content and test retrieval

stand knowledge documents get DOCUMENT_ID
stand knowledge documents chunks DOCUMENT_ID
stand knowledge search KNOWLEDGE_BASE_ID \
  --query "What is our support policy?" --top-k 5

Search scores are relevance scores, not confidence percentages; they can exceed 1. Preserve the returned order and do not compare scores across different queries or scopes.

attachments.json — the complete intended attachment list

{ "knowledgeBaseIds": ["KNOWLEDGE_BASE_ID"] }

Read the existing attachments first and include any other bases that should remain connected.

Read, review, then attach

stand standins knowledge get STANDIN_ID
stand standins knowledge set STANDIN_ID --body-file attachments.json
Next taskCrawl a public website
Command and decisionUse stand knowledge crawl KNOWLEDGE_BASE_ID --body-file crawl.json. Inspect schema crawlKnowledgeBase first for its domain, URL prefix, and crawl settings.
Next taskReplace an uploaded source
Command and decisionUse stand knowledge upload KNOWLEDGE_BASE_ID --file /absolute/path/replacement.md --source SOURCE_ID. The source must be an upload in this base; any open indexing task must finish or be cancelled first. Old completed content remains active until replacement succeeds.
Next taskRefresh website content
Command and decisionUse stand knowledge sources recrawl SOURCE_ID. For a sitemap source with automaticRefreshAllowed, use stand knowledge sources refresh SITEMAP_SOURCE_ID --enabled true after approving the schedule.
Next taskInspect or cancel ingestion
Command and decisionUse stand knowledge tasks KNOWLEDGE_BASE_ID and, when needed, stand knowledge tasks cancel TASK_ID. Check the final task and document state.
Next taskRemove outdated content
Command and decisionUse stand knowledge documents delete DOCUMENT_ID or stand knowledge sources delete SOURCE_ID. Source deletion also removes its indexed documents; inspect the target before confirming.

Maintain an existing website

10

Change one setting, preserve the rest.

A Site rename can use the name flag alone. Site instructions are a separate complete replacement: read the existing text, prepare all the intended content in a file, and review it before saving. Both changes require sites:write and the organization owner; reads also need sites:read.

Personal chat coverage is different from the Site’s enabled state. Use sites preferences get to inspect your selection and sites preferences update SITE_ID --enabled true to change just that Site while preserving the other selections. This does not make you available for incoming chats.

Inspect and rename an existing Site

stand sites get SITE_ID
stand sites update SITE_ID --name "Support website"
stand sites get SITE_ID

The setup permission preset already includes these scopes. Changing enabled state, deleting the Site, or replacing its behavior needs its own decision.

site-instructions.json — the complete intended instruction

{
  "content": "Answer questions about our support service using the approved sources. Say when a fact is unknown."
}

Read, review the file, then replace the instruction

stand sites prompt get SITE_ID
stand schema updateSitePrompt
stand sites prompt set SITE_ID --body-file site-instructions.json
stand sites prompt get SITE_ID

Visual identity

11

Upload to the intended image target.

Image uploads use stand api with a local file. Read the target first and inspect the upload schema. The example changes an existing Stand-in avatar immediately; it does not need a later Stand-in settings save and keeps the same ID.

Avatars accept PNG, JPEG, GIF and WebP up to 5 MiB. Animated avatars have tighter dimensions, frame and size limits in the operation schema. Do not confuse these image limits with the 10 MiB knowledge-document limit.

Public API guide

Check the image route and replacement rules.

Use the target’s schema and read scopes; preserve profile and pin settings when applying a staged image.

Read the image workflow

Replace an existing Stand-in avatar

stand auth login --scopes "profile:read standins:read standins:write"
stand standins get STANDIN_ID
stand schema uploadStandinAvatar
stand api POST /v1/reps/me/standins/STANDIN_ID/avatar \
  --form-file file=/absolute/path/approved-avatar.png
stand standins get STANDIN_ID

An explicit scope list replaces the previous selection: retain other permissions your task still needs. Review the image and target before confirming the upload.

TargetYour representative avatar
What happens after uploaduploadRepAvatar stages an image. Save its returned filename as avatarUrl in the complete updateRepProfile body after browser onboarding. The response avatarUrl is a preview URL, not the value to copy into that body.
TargetA new Stand-in avatar
What happens after uploaduploadDraftAvatar stages an image without creating a Stand-in. Add its filename as avatarUrl in the reviewed createStandin body.
TargetPersonal, organization or Stand-in pin
What happens after uploadThe appropriate icon or logo upload applies immediately but retains the pin’s other settings. It does not enable a pin whose pinType is none. Organization pin changes require the owner.

Review conversations

12

Search history or make a private export.

Conversation reads need sessions:read, which is not included in the setup preset. Request it explicitly for the approved task; add other scopes only if that task needs them. Organization-wide history remains subject to account roles.

Use a bounded search to inspect results before exporting. The --site filter matches text anywhere in the stored page URL, not an exact hostname; check returned URLs when you need an exact-site sample. Date filters use timestamps with a timezone; closed-to is an exclusive upper bound. If you request all search pages, inspect complete and nextPage rather than assuming every matching conversation was returned.

Read a selected conversation with sessions get SESSION_ID; it returns at most 500 messages. Use an export for complete retained transcripts. Export writes validated JSON to a new private file and refuses to overwrite an existing destination. Keep it outside the website repository and share it only with approved people or tools.

Search, then export your own history

stand auth login --scopes "profile:read sessions:read"
stand history search --scope myself --query pricing \
  --page 0 --size 20
stand history export --scope myself \
  --closed-from 2026-10-01T00:00:00Z \
  --closed-to 2026-11-01T00:00:00Z \
  --output /absolute/path/new-history.json

Replace the example dates and destination. Export defaults to a 600-second timeout and 100 MiB limit; documented options can raise these to at most 3,600 seconds and 1 GiB.

An active conversation

13

Send an approved reply with a saved message ID.

Use sessions list and sessions get to inspect an active conversation you are allowed to handle. Polling with sessions get --watch does not make you available or subscribe you to background notifications. Organization-wide archived reads do not grant access to another rep’s live conversation.

Agree the exact reply before sending. A message to a Stand-in conversation can take over that conversation as you, so approve the handoff as well as the text. The named send command verifies your identity before writing and checks the returned message against that identity and the approved body.

Generate a UUID and save it as clientMessageId alongside body in message.json before sending. Keep that file for this one logical message. If the field is absent, the CLI generates an ID but does not write it back to your file, so a forced process exit could leave you without the key needed to reconcile the result.

Inspect the conversation and generate a message ID

stand auth login --scopes "profile:read sessions:read sessions:write"
stand whoami
stand sessions get SESSION_ID
node -p "crypto.randomUUID()"

Copy the generated UUID into the file below. Use a new UUID for each new intended message.

message.json — replace both illustrative values

{
  "body": "Your reviewed reply to this visitor",
  "clientMessageId": "UUID_FROM_THE_PREVIOUS_COMMAND"
}

Confirm the reply, then inspect the conversation

stand sessions send SESSION_ID --body-file message.json
stand sessions get SESSION_ID

Repeatable work

14

Use structured output and explicit approval.

JSON is automatic when stdout is not a terminal; --json makes the choice explicit. Read results from stdout and diagnostics or login progress from stderr. Use commands --json for machine discovery, not --help --json, which remains readable help text.

Pass JSON requests with --body-file FILE, or --body-file - for standard input. Without an interactive terminal, mutations need --yes. Add it only after the specific changes have been authorized; keep read-only discovery separate from writes.

For unattended work, use an authorized credential in private user storage or inject STAND_ACCESS_TOKEN through your secret manager together with the matching STAND_TOKEN_API_URL. Do not put tokens in command arguments, URLs, source files, logs, or agent prompts. STAND_CONFIG_HOME can select an absolute private configuration directory.

GET requests retry a bounded number of transient failures. Writes do not automatically retry. After a timeout, lost response, cancellation after dispatch, or server error, read the affected resource and reconcile its ID and content before deciding what to do next. The original change may already have succeeded.

An explicitly approved, noninteractive rename

stand sites get SITE_ID --profile staging --json
stand sites update SITE_ID --profile staging \
  --name "Approved site name" --yes --json
stand sites get SITE_ID --profile staging --json

Inspect before and after. There is no general multi-resource transaction or conditional revision guard, so coordinate concurrent changes and stop when the outcome is uncertain.

Get unstuck

15

Check the target, permission, and result.

Include the CLI version, command, selected profile, and sanitized error when asking for help. Check the installed command schema before trying a flag from a newer release. Keep credentials and private conversation content out of reports.

Permissions

Understand delegated access.

See what the agent can request and what remains under your control.

Review permissions

Reference

Look up an exact operation.

Use the API and CLI reference alongside the schema from your installed version.

Read the API guide
What you seeOIDC_DISCOVERY with HTTP 404
What to checkInspect the resolved issuer and its /.well-known/openid-configuration endpoint. A profile name does not configure a preview, and a preview must be deployed before login works. Verify the realm path and environment availability.
What you seeUnknown profile
What to checkCreate it with config set --profile NAME --api-url URL --issuer URL, then log in to that profile.
What you seeBrowser approval succeeded, setup not ready
What to checkWait for the terminal’s credential-storage result. Inspect setup status; finish any browser onboarding using the same account, then check again.
What you seeAuthentication or permission error
What to checkCheck auth status --check and the operation schema’s scopes. Re-authorize the required set if necessary. Scope consent cannot grant a different account’s resources or paid capabilities.
What you seeCredential store unavailable
What to checkCheck the OS keychain. If this host has none, explicitly choose --credential-store file when logging in.
What you seeUpload rejected or knowledge not updated
What to checkCheck the five supported extensions, 10 MiB file limit, effective capabilities, capacity, and open ingestion tasks. A queued task is not completed ingestion.
What you seeNot found or an unfamiliar command
What to checkCheck the resource ID, environment, and installed version. Run commands --json and schema for what this installation supports.
What you seeWrite timed out
What to checkRead the resource or list before retrying. Preserve returned IDs and stop if you cannot establish whether the original write completed.

Questions

Common reader notes

Which AI agents can use the Stand CLI?

Any agent that can run npm, with Node.js 22 or newer on macOS, Linux or WSL and network access. Coding agents such as Codex, Claude Code, Cursor and Gemini CLI can also install Stand in your website project. Always-on agents such as dots in ChatGPT, Meta’s Muse and Grok Bot can check your conversations every day. We don’t test every agent, but they generally work as long as they can run npm. A chat that cannot run commands can explain the steps but cannot run them.

Do I need an AI agent to use the CLI?

No. You can run the same commands yourself or use them in scripts. An agent saves you learning the commands, and for installation it can also edit your website project and check the result in a browser.

Can an AI agent create my account and accept terms for me?

No. You complete signup, terms, consent, and any required profile or organization onboarding in your browser. The agent can continue with the work you authorize afterward.

Does installing a different npm tag switch environments?

No. npm tags select a package version. The saved CLI profile and its API and issuer endpoints select the environment.

Can I set up Stand on the free Base plan?

Yes. Use the plan’s supported public crawling and approved instructions. Document uploads, sitemaps, and scheduled refresh depend on effective account capabilities; they are not prerequisites for a Base-plan installation.

Try the guide on one real page.