Inferrex Developers

10. InferrexCLI, the cloud shell

InferrexCLI is the cloud shell: a terminal that runs in Inferrex, opened from the app or driven through the API. There is nothing to install on your own machine.

Some systems are easiest, or only, reached through their own command-line tool: a device code, a pairing address, a browser hand-off. The cloud shell gives you somewhere safe to run that tool, sign in with it, and keep what the sign-in wrote as a system's credential. The secret never reaches your browser.

What the cloud shell is

In the app

  1. Choose Cloud shell in the app's top bar, or choose Sign in in the cloud shell on the Credentials step of adding a system.
  2. Start a session. Start blank, or start with the credentials of a system you have already connected.
  3. Install the vendor's tool and sign in with it.
  4. Under Find what the sign-in left, choose where to look, then choose the token.
  5. Give the address of the API this sign-in is for. Inferrex reads it signed in before saving anything. Nothing is kept unless it answers with data.
  6. Go on to the test in Add a system, or create the system from here.

You can save commands you use often and place them at the prompt. Sharing saved commands with your workspace is a setting under Workspace settings, Adjustable settings.

From the API

Every step has a route.

Step Call
Start a session POST /v1/cli/connect
Read its state and deadlines GET /v1/cli/:id/status
Run one command and read what it printed POST /v1/cli/:id/exec
Keep it open longer POST /v1/cli/:id/extend
Find what a sign-in wrote POST /v1/cli/:id/scan
Offer the output of a token command POST /v1/cli/:id/token-command
Store the chosen values as one credential POST /v1/cli/:id/capture
End the session and destroy the sandbox DELETE /v1/cli/:id

Start a session:

curl -X POST https://api.inferrex.com/v1/cli/connect \
  -H "X-API-Key: $INFERREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Send { "connectionId": "CONNECTION_ID" } to start with that system's credentials. The response carries the sessionId, its status, and when it will close (idleExpiresAt, maxExpiresAt).

Run one command:

curl -X POST https://api.inferrex.com/v1/cli/SESSION_ID/exec \
  -H "X-API-Key: $INFERREX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"argv": ["VENDOR_TOOL", "--version"]}'

Response shape: { sessionId, stdout }.

A scan returns candidates, never values:

{
  sessionId: string;
  candidates: {
    id: string;
    source: string;
    origin: string;
    field: string;
    kind: string;
    preview: string;   // masked
    length: number;
  }[];
}

Capture returns { sessionId, credentialRef, authType, fields }. Pass credentialRef to POST /v1/connections/test and POST /v1/connections/infer (chapter 2). The system is then connected like any other: the live test must read data before anything is saved.

For a system that is reached only through its command-line tool, POST /v1/connections/infer also takes cliSessionId (the session) and cliBinary (the tool's name).

Saved commands

To do this Call
List your saved commands GET /v1/cli-snippets
Save one POST /v1/cli-snippets
Change one PATCH /v1/cli-snippets/:id
Delete one DELETE /v1/cli-snippets/:id

A saved command has a name, a command, an optional description and a shared flag.

Driving Inferrex from your own terminal

Use InferrexAPI with curl, as every chapter of this guide shows. Keep the key in INFERREX_API_KEY. Everything the platform does is an endpoint.

Back to the index.