Scripts and list queries
When saving query results to files or passing them to other programs, use the command’s supported JSON options and check exit codes.
Save JSON results
aipctl skill list --org ORG_SLUG --json > skills.json
aipctl agent list --org ORG_SLUG --json > agents.json
aipctl org list --json > organizations.json--json is not a shared option for every command. Check support with aipctl COMMAND --help first. For example, do not add it to config status, auth whoami, or chat messages.
Sensitive information may be masked in JSON too. Plain text output may include instructions or progress messages, so data-processing scripts should use supported JSON output.
Retrieve subsequent pages
For shared organization skills, use --page to select a page and --page-size to set the number of items per query.
aipctl admin skill list --page 1 --page-size 20 --json
aipctl admin skill list --page 2 --page-size 20 --jsonIncrement --page by one for each subsequent page. Keep the organization, search criteria, and --page-size unchanged. admin skill list requires AI Operator permissions.
Options vary by list
| Command | Search and page options | JSON output |
|---|---|---|
skill list | --search | --json |
skill library, skill built-in | --search | Not supported |
drive list | None | Not supported |
chat list | None | --json |
admin skill list | --search, --page, --page-size | --json |
automation list | --name | --json |
Do not add item-count or next-page options to commands that do not support pagination. If you cannot find an item in a list, also check the web interface.
Preserve option capitalization and hyphens exactly. Items added or removed during a query can cause duplicates or omissions across pages. For important full collections, check result IDs and run during a period with fewer changes.
Check for failures
Supported JSON query commands write API errors to standard error (stderr). You can save successful data separately from errors.
aipctl skill list --json > skills.json 2> skills-error.jsonCheck the exit code rather than judging success by file size. An empty list can be a successful result. Use these codes as a guide for general management commands.
| Exit code | Meaning and next step |
|---|---|
0 | Command completed. For multiple items, also check each result. |
1 | Request, authentication, or other failure. Check the error code and message. |
2 | Used for cases such as rejecting a command unavailable in the general release. |
130 | Interrupted with Ctrl+C. Check separately whether server-side work finished or was canceled. |
Do not assume option parsing errors and MCP connection commands use the same JSON error format.
Run commands repeatedly
- Specify the organization with
--orgto reduce mistakes caused by changes to the default organization. - Limit request frequency and concurrency rather than sending many requests at once.
- On
429, wait for the indicated period, then reduce request frequency. - If creation, editing, or deletion stops, query lists and details first. Do not repeat a change while its outcome is unknown.
- To pin the execution version, see Update the CLI.