Skip to content
中文

Quickstart

A Praxis API Key is needed. Create one.

1. View templates

终端窗口
curl https://api.deepraxis.com/sandbox/v1/templates \
-H "Authorization: Bearer $PRAXIS_API_KEY"

2. Create an instance

Create an instance from a template you found in step 1. You must declare ephemeral or persistent when you create it; see two sandbox lifecycles. Pick ephemeral (ephemeral: true) for a job, and send the X-Praxis-Face: own-v1 header to select the Praxis native interface. timeout is the lifetime in seconds.

终端窗口
SANDBOX_ID=$(curl -sS https://api.deepraxis.com/sandbox/v1/sandboxes \
-H "Authorization: Bearer $PRAXIS_API_KEY" -H "X-Praxis-Face: own-v1" \
-H "Content-Type: application/json" \
-d '{"templateID": "base", "timeout": 600, "ephemeral": true}' | jq -r '.sandboxID')
echo "$SANDBOX_ID"

3. Run code

Run one command in the instance. The request waits for the command to finish and returns stdout, stderr and exitCode (a nonzero exit code is a normal result):

终端窗口
curl -sS "https://api.deepraxis.com/sandbox/v1/sandboxes/$SANDBOX_ID/commands" \
-H "Authorization: Bearer $PRAXIS_API_KEY" -H "X-Praxis-Face: own-v1" \
-H "Content-Type: application/json" \
-d '{"cmd": "echo hello from the sandbox"}'

Expected: stdout is hello from the sandbox\n and exitCode is 0.

4. Release the instance

Release it when you are done so it stops billing:

终端窗口
curl -sS -X DELETE "https://api.deepraxis.com/sandbox/v1/sandboxes/$SANDBOX_ID" \
-H "Authorization: Bearer $PRAXIS_API_KEY"

Expected: HTTP 204 with no body.

API →