Skip to main content

CLI for API sandboxes. Test your APIs in a sandbox env.

Project description

api-sandbox

api-sandbox installs the sdb CLI.

Use it to:

  • publish an API into a sandbox from an OpenAPI spec
  • consume a sandboxed API with issued credentials and bearer login
  • inspect traces and exercise customer-facing simulation behavior

Publisher + consumer only. No DAC operator workflows here.

Install

Recommended:

pipx install api-sandbox

Upgrade:

pipx upgrade api-sandbox

If you already manage your own virtualenv:

python -m pip install api-sandbox

Requirements:

  • Python 3.12+
  • pipx recommended

Verify:

sdb --help
sdb doctor --json

Configure A Profile

Hosted sandbox setup:

export API_SANDBOX_TOKEN=replace-me

sdb config init customer \
  --base-url https://control-plane.example.com \
  --runtime-base-url https://runtime.example.com \
  --control-plane-token-env API_SANDBOX_TOKEN \
  --activate

sdb doctor --json

The control-plane token stays outside config JSON.

Publisher Flow

Import a spec:

sdb spec import ./openapi.yaml

Create a sandbox:

sdb sandbox create bank-sim --api "Payments API" --mode mock

Create release inputs:

sdb auth create-profile payments-sim \
  --mode simulated \
  --scheme ApiKeyAuth=api_key \
  --scheme BearerAuth=bearer

sdb policy create scope-only

Create the release with exact names:

sdb release create bank-sim \
  --spec "Payments API@2026-04-14" \
  --auth-profile payments-sim \
  --policy-pack scope-only

List the release, then promote:

sdb release list --sandbox bank-sim
sdb release promote bank-sim --alias latest --release <RELEASE_ID>

Consumer Flow

Create an application:

sdb auth create-app bank-sim partner-app \
  --alias latest \
  --auth-profile payments-sim \
  --scheme BearerAuth

Issue client credentials by app name:

sdb auth issue-client partner-app --sandbox bank-sim --scope refunds.read

Discover auth:

sdb auth discover bank-sim --alias latest
sdb auth scopes bank-sim --alias latest

Login once:

printf '%s\n' "<CLIENT_SECRET>" | sdb auth login bank-sim \
  --alias latest \
  --client-id <CLIENT_ID> \
  --client-secret-stdin \
  --scope refunds.read

auth login saves a local bearer session by default.

Call the runtime without re-threading the bearer token:

sdb sandbox request bank-sim GET /refunds/ref_123 --alias latest

Inspect traces:

sdb trace tail bank-sim --limit 10
sdb trace list --sandbox bank-sim

Simulation

Create a customer simulation pack:

sdb simulation create-pack retail-banking-sim \
  --kind scenario_v1 \
  --seed 'getAccount@{"account_id":"{account_id}","balance":100}' \
  --scenario '{"scenario_id":"credit-ladder","name":"Credit ladder","state_patches":[{"path":"/accounts/{account_id}","body":{"status":"credited"}}]}'

List packs or attach one to a release by name:

sdb simulation list-packs --limit 10
sdb release create bank-sim \
  --spec "Payments API@2026-04-14" \
  --simulation-pack retail-banking-sim

End-User Docs

What Works

  • spec import, validate, diff, list, get
  • sandbox create, list, get, clone, archive, export-manifest, reset
  • release create, list, get, promote
  • auth profiles, apps, client credentials, discovery, scopes, login
  • exact-name selectors on hot refs: spec, sandbox, auth profile, app, policy pack, simulation pack
  • saved bearer sessions reused by sdb sandbox request
  • customer simulation packs, scenarios, snapshots, timers, webhooks, events
  • trace list, get, replay, tail
  • --dry-run, --yes, --watch, --trace

Homepage: digitalapi.ai

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

api_sandbox-0.1.2.tar.gz (85.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

api_sandbox-0.1.2-py3-none-any.whl (113.9 kB view details)

Uploaded Python 3

File details

Details for the file api_sandbox-0.1.2.tar.gz.

File metadata

  • Download URL: api_sandbox-0.1.2.tar.gz
  • Upload date:
  • Size: 85.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for api_sandbox-0.1.2.tar.gz
Algorithm Hash digest
SHA256 87e807320e549390c868cbe1d0814eec87ea5ec68c9630ee66eb4971c1c23a72
MD5 e0dd15d97753501bed05e2984a7bd75a
BLAKE2b-256 501d2940950bd09dedf46afab5452bce188556de56ed4864cf1b4adafa5c6a5f

See more details on using hashes here.

File details

Details for the file api_sandbox-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: api_sandbox-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 113.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for api_sandbox-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8e1cd7abfaef6b5781c0d49bdfec4d55b9e9d4ef21c71108c554d356c6217840
MD5 937b7ce7fc12f0c3ae79553823577b4c
BLAKE2b-256 f4c2d840de3ad96d7745fda1081ee7b0e93067c27850d516169b05d01ba60509

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page