Skip to main content

Rexec SDK & API Reference

Official clients for the Rexec sandbox API (files + terminals). Shared REST + WebSocket surface across languages. SDK version line: v1.0.1.

Upstream (source of truth):
SDK.md · SDK_GETTING_STARTED.md · SDK_PUBLISHING.md

Hosted base URLhttps://rexec.sh
AuthAuthorization: Bearer <token>
MonorepoPipeOpsHQ/Rexec (sdk/{js,python,go,rust,ruby,dotnet,java,php})

Available SDKs

LanguagePackageInstallImport notes
JS / TSpipeops-rexecnpm install pipeops-rexecimport { RexecClient } from 'pipeops-rexec'
Pythonpipeops-rexecpip install pipeops-rexecfrom rexec import RexecClient
Gorexec-gogo get github.com/PipeOpsHQ/[email protected]import rexec "github.com/PipeOpsHQ/rexec-go"
Rustpipeops-rexeccargo add pipeops-rexecuse rexec::{…}
Rubypipeops-rexecgem install pipeops-rexecrequire "rexec"
C# / .NETPipeOps.Rexecdotnet add package PipeOps.Rexecusing Rexec;
Java / Kotlinio.pipeops:rexec:1.0.1Maven/Gradleimport io.pipeops.rexec.*
PHPpipeopshq/rexeccomposer require pipeopshq/rexecuse Rexec\RexecClient

PHP fallback (VCS):

composer config repositories.rexec-php vcs https://github.com/PipeOpsHQ/rexec-php
composer require pipeopshq/rexec:^1.0

Auth

  1. API token — Rexec UI → Settings → API Tokens (production).
  2. Guest JWTPOST /api/auth/guest with { "username", "email" } (smoke tests only).

SDKs attach Authorization: Bearer <token> on REST and terminal WebSockets.


Shared API surface (sandboxes)

Sandboxes (/api/containers)

MethodHTTPNotes
ListGET /api/containersBody often { containers: [...] | null, count, limit }. SDKs return a plain array.
CreatePOST /api/containers { image, name? }May return status: "creating" (async).
GetGET /api/containers/:idPoll until running if you need a shell.
StartPOST /api/containers/:id/start
StopPOST /api/containers/:id/stop
DeleteDELETE /api/containers/:id

Files (per sandbox)

MethodHTTP
List dirGET /api/containers/:id/files/list?path=
ReadGET /api/containers/:id/files?path=
WritePOST /api/containers/:id/files (content often base64)
MkdirPOST /api/containers/:id/files/mkdir (language-dependent)
DeleteDELETE /api/containers/:id/files?path=

Terminal

Connectwss://<host>/ws/terminal/:id?cols=&rows= + Bearer
Helperswrite, onData, resize (JSON { type: "resize", cols, rows }), close
No primary HTTP exec()

Hosted Rexec does not document a first-class exec() RPC. Run commands via the terminal WebSocket.


Image aliases

PreferAvoid on hosted
ubuntu, ubuntu-24, debian, alpine, …ubuntu:24.04, arbitrary Hub tags

Catalog: GET /api/images.


Sandbox model

FieldDescription
idSandbox id
nameDisplay name
imageAlias used at create
statuscreating | running | stopped | error
created_at / started_atTimestamps
labels / environmentOptional maps

Lifecycle

create → creating → running ⇄ stopped → delete
↘ error

List payload quirk

{ "containers": [ /* or null */ ], "count": 0, "limit": 1 }

SDKs normalize so callers never special-case null.


Client construction

LangConstructSandboxes
JSnew RexecClient({ baseURL, token })client.containers.list() / .create({ image, name? })
Pythonasync with RexecClient(url, token)await client.containers.list() / .create(image=…)
Gorexec.NewClient(url, token)client.Containers.List(ctx) / .Create(ctx, &…)
RustRexecClient::new(url, token)client.containers().list().await
RubyRexec::Client.new(url, token)client.containers.list / .create(…)
.NETnew RexecClient(url, token)await client.Containers.ListAsync()
Javanew RexecClient(url, token)client.containers().list() / .create(…)
PHPnew Rexec\RexecClient($url, $token)$client->containers()->list()

Wait until running (pattern)

async function waitRunning(client: RexecClient, id: string, ms = 60_000) {
const deadline = Date.now() + ms;
while (Date.now() < deadline) {
const c = await client.containers.get(id);
if (c.status === 'running') return c;
if (c.status === 'error') throw new Error('sandbox failed');
await new Promise((r) => setTimeout(r, 1000));
}
throw new Error('timeout waiting for running');
}

Errors

SDKType
JSRexecError (statusCode, message)
PythonRexecAPIError, RexecConnectionError
Go*rexec.APIError
Rustrexec::Error
RubyRexec::APIError
.NET / Java / PHPRexecException

E2E smoke tests

In the monorepo:

cd scripts/sdk-e2e
# list → create(image: ubuntu) → get → delete
# Runners: test-js.mjs, test_py.py, go/, rust_e2e, test_rb.rb,
# dotnet_e2e, java_e2e, test_php.php

ResourceURL
Producthttps://rexec.sh
In-app SDK docshttps://rexec.sh/docs/sdk
Monorepohttps://github.com/PipeOpsHQ/Rexec
npmhttps://www.npmjs.com/package/pipeops-rexec
PyPIhttps://pypi.org/project/pipeops-rexec/
crates.iohttps://crates.io/crates/pipeops-rexec
RubyGemshttps://rubygems.org/gems/pipeops-rexec
NuGethttps://www.nuget.org/packages/PipeOps.Rexec
Mavenhttps://repo1.maven.org/maven2/io/pipeops/rexec/
Go modulehttps://github.com/PipeOpsHQ/rexec-go
PHP source (Packagist)https://github.com/PipeOpsHQ/rexec-php