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

Guided Setup

Hosted sandbox setup:

export API_SANDBOX_TOKEN=replace-me

sdb init \
  --mode hosted \
  --base-url https://control-plane.example.com \
  --runtime-base-url https://runtime.example.com

sdb --profile customer doctor --json

Local evaluation:

sdb init --mode local
sdb doctor --json

The control-plane token stays outside config JSON.

Advanced hosted setup still works through sdb config init.

Shell Completion

Zsh:

mkdir -p ~/.zfunc
sdb completion show zsh > ~/.zfunc/_sdb

Bash:

sdb completion show bash > ~/.sdb-completion.bash

Fish:

mkdir -p ~/.config/fish/completions
sdb completion show fish > ~/.config/fish/completions/sdb.fish

10-Minute Quickstarts

Video Walkthroughs

PyPI renders Markdown reliably, but not embedded video players. Use these public links:

Publisher Flow

For the shortest path, start with the publisher quickstart above.

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

For the shortest path, start with the consumer quickstart above.

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.

Inspect or clear saved sessions:

sdb auth session list --sandbox bank-sim
sdb auth session get bank-sim@latest
sdb --yes auth session clear --expired

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.3.tar.gz (91.4 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.3-py3-none-any.whl (121.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: api_sandbox-0.1.3.tar.gz
  • Upload date:
  • Size: 91.4 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.3.tar.gz
Algorithm Hash digest
SHA256 19a78f98dc27d50c3eecfeed881ee240faee635c32b70a26b775ae1b5770709b
MD5 3c92768452541c8a77d2557204a4856f
BLAKE2b-256 0a4b5519130f20e8767365e4edfc82cde92a0b91ef1c3fd5a67332cd4a3e166a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: api_sandbox-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 121.0 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 47697aeb919bd7d9d7a34eee3c9d1f8fb854f790b2cf0084c5a582253c701216
MD5 26a42fb00436e1e8216e7871caa2c9db
BLAKE2b-256 7bf58c882a05eddcd34826b44776de4e5f22b20aa9e0d1de4f6255b746ee0446

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