Platform APIs
The Python SDK also exposes platform-level managers for computer-use, API keys, audit logs, and webhooks.
Computer use
Use computer_use for noVNC viewer links and proxying computer-use paths.
from instavm import InstaVM
client = InstaVM("your_api_key")
# Viewer URL
viewer = client.computer_use.viewer_url(session_id="session_123")
print(viewer.get("viewer_url"))
# Proxy calls
state = client.computer_use.get(session_id="session_123", path="state")
click = client.computer_use.post(
session_id="session_123",
path="actions/click",
json_data={"x": 200, "y": 300},
)
API keys
# Create
created = client.api_keys.create(description="ci-key")
print(created)
# List
keys = client.api_keys.list()
for key in keys:
print(key.get("id"), key.get("key_prefix"))
# Update / Delete
client.api_keys.update(item_id=123, description="rotated-ci-key")
client.api_keys.delete(item_id=123)
Audit logs
catalog = client.audit.catalog()
print(catalog)
events = client.audit.events(
event_group="vm",
status="success",
limit=20,
)
print(events.get("items", []))
event = client.audit.get_event(event_id="evt_abc123")
print(event)
Webhooks
endpoint = client.webhooks.create_endpoint(
url="https://example.com/webhooks/instavm",
event_patterns=["vm.*", "snapshot.*"],
)
print(endpoint)
deliveries = client.webhooks.list_deliveries(
endpoint_id=endpoint["id"],
limit=10,
)
print(deliveries)
client.webhooks.send_test_event(endpoint["id"])
client.webhooks.verify_endpoint(endpoint["id"])
client.webhooks.rotate_secret(endpoint["id"])
Next steps
- REST API: Computer Use -- see endpoint categories for availability
- REST API: API Keys -- key lifecycle endpoints
- REST API: Audit Logs -- audit catalog and events
- REST API: Webhooks -- endpoint and delivery operations