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 this public walkthrough:

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.4.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.4-py3-none-any.whl (121.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: api_sandbox-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 80f4873664abe3382c2b0538ff15a5f440466320384c238b1dc36b685ed1673d
MD5 7e748a970ad9d5f6a011047e309b96a8
BLAKE2b-256 51ca4f084d53ccb731d084ee0ab3d1305d6452488a97930357e58ae5565eac79

See more details on using hashes here.

File details

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

File metadata

  • Download URL: api_sandbox-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c912adcf0578cfc9b39e60968eddd1c3af31f12700485a6e7aa9d250c4dc7508
MD5 b50d4721a3c9effc6aa36ce841f82f1f
BLAKE2b-256 16bab32695c9aa9e5ec593358ec9244297d69dcf690eddb8eb70a5aa18b77517

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