Examples

Practical examples for common API tasks.

Use these examples as direct starting points for account checks, key management, and asynchronous execution.

Hello World run

Submit a minimal Python script and get back an execution_id.

curl -s -X POST https://api.disposable-exec.com/run \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{"script":"print(\"hello world\")"}'

Check current plan with /me

Confirm subscription status, quota, and current usage for the API key you are holding.

curl -s https://api.disposable-exec.com/me \ -H "Authorization: Bearer YOUR_API_KEY"

Create a new API key

Issue a replacement or scoped working key from an already authenticated account.

curl -s -X POST https://api.disposable-exec.com/apikey \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{"name":"laptop-key"}'

Full async flow

Submit work, poll status, then retrieve the final result once execution completes.

# 1. Submit work curl -s -X POST https://api.disposable-exec.com/run \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{"script":"print(sum(range(5)))"}' # 2. Check status curl -s https://api.disposable-exec.com/status/EXECUTION_ID \ -H "Authorization: Bearer YOUR_API_KEY" # 3. Fetch result curl -s https://api.disposable-exec.com/result/EXECUTION_ID \ -H "Authorization: Bearer YOUR_API_KEY"

Python example

Call the execution API from Python with a standard JSON request.

import requests api_key = "YOUR_API_KEY" base = "https://api.disposable-exec.com" response = requests.post( f"{base}/run", headers={ "Authorization": f"Bearer {api_key}", "Content-Type": "application/json", }, json={"script": "print('hello from python')"}, ) print(response.json())