Overview
This guide walks you through migrating from OpenHands V0 APIs to the new V1 APIs. We’ll take you step-by-step through a typical migration, showing exactly what changes and why.What’s Different in V1?
The most important change: Conversations and Sandboxes are now decoupled. In V0, creating a conversation automatically created and managed the underlying sandbox (runtime environment). In V1, sandboxes are independent resources you can:- Pause and resume without losing state
- Reuse across multiple conversations
- Manage with explicit lifecycle controls
- App Server API (
app.all-hands.dev) - Manage conversations and sandboxes (this guide’s focus) - Agent Server API (per-sandbox URL) - Direct access to workspace and runtime operations
Why Migrate? Key Benefits
Why Migrate? Key Benefits
| Theme | Key Result |
|---|---|
| Reliability | 61% reduction in system failures — eliminated entire classes of infrastructure errors |
| Performance | Lighter-weight runtime with co-located execution — removes inter-pod communication overhead |
| Developer Experience | Modern API patterns — dedicated search, filtering, batch operations, webhooks, and flexible sandbox controls |
- 61% reduction in system-attributable failures (78.0 → 30.0 errors per 1k conversations)
- Eliminated infrastructure errors from inter-pod communication
- Event-sourced state enables replay-based recovery
- Lighter-weight agent server reduces resource overhead
- Independent sandbox lifecycle for better resource control
- Pause/resume sandboxes, explicit status tracking (
STARTING,RUNNING,PAUSED,ERROR) - Dedicated search and count endpoints
- Batch operations and enhanced filtering
- Webhook support for lifecycle events
- Stream conversation updates from creation
Migration Walkthrough
Follow along as we migrate a typical V0 integration to V1. Each step shows your existing V0 code and the V1 equivalent.Step 1: Create and Start a Conversation
V0 Approach In V0, you called a single endpoint and got a conversation ID immediately:Key Changes:
- Endpoint:
/api/conversations→/api/v1/app-conversations - Field:
initial_user_msg(string) →initial_message(object with content array) - Field:
repository→selected_repository - The conversation ID isn’t immediately available—see Step 2
Step 2: Track Conversation Startup
In V0, your conversation was ready immediately. In V1, you need to wait for initialization to complete. You have two options: Option A: Poll for Readinessstatus field tells you where things stand:
STARTING→ Still initializing, keep pollingREADY→ Conversation is ready, useconversation_idfor subsequent callsERROR→ Something went wrong, check theerrorfield
Step 3: Work with Events and Messages
Once your conversation is ready, here’s how to send messages and retrieve events. Sending Messages- V0 (Deprecated)
- V1 (Recommended)
- V0 (Deprecated)
- V1 (Recommended)
Step 4: Manage Sandbox Lifecycle
This is entirely new in V1. You now have explicit control over sandbox resources. Search for Your SandboxesSandbox Status Values:
STARTING- Sandbox is initializingRUNNING- Sandbox is active and readyPAUSED- Sandbox is suspended (no billing)ERROR- Something went wrongMISSING- Sandbox no longer exists
Step 5: Access the Agent Server (When Needed)
For direct workspace operations (file uploads, bash commands, git operations), you’ll use the Agent Server API. This runs on each sandbox and requires a different authentication method. Getting the Agent Server URL First, get your sandbox details:session_api_key with the X-Session-API-Key header:
Step 6: Handle Files and Workspace
File operations have moved from the App Server to the Agent Server in V1.| V0 Operation | V1 Equivalent |
|---|---|
GET /api/conversations/{id}/list-files | Agent Server: POST /api/bash/execute_bash_command with ls |
GET /api/conversations/{id}/select-file | Agent Server: GET /api/file/download/{path} |
POST /api/conversations/{id}/upload-files | Agent Server: POST /api/file/upload/{path} |
GET /api/conversations/{id}/zip-directory | Agent Server: GET /api/file/download/{path} for individual files |
Quick Reference: Endpoint Mapping
Use this section to look up specific endpoint mappings when you need them.Conversation Lifecycle
| Operation | V0 Endpoint | V1 Endpoint |
|---|---|---|
| Create conversation | POST /api/conversations | POST /api/v1/app-conversations |
| Start (streaming) | POST /api/conversations/{id}/start | POST /api/v1/app-conversations/stream-start |
| Search conversations | GET /api/conversations | GET /api/v1/app-conversations/search |
| Get by ID | GET /api/conversations/{id} | GET /api/v1/app-conversations?id={id} |
| Get count | N/A | GET /api/v1/app-conversations/count |
| Update | PATCH /api/conversations/{id} | PATCH /api/v1/app-conversations/{id} |
| Delete | DELETE /api/conversations/{id} | DELETE /api/v1/app-conversations/{id} |
Events & Messages
| Operation | V0 Endpoint | V1 Endpoint |
|---|---|---|
| Send message | POST /api/conversations/{id}/messages | POST /api/v1/conversation/{id}/events |
| Get events | GET /api/conversations/{id}/events | GET /api/v1/conversation/{id}/events/search |
| Get event count | N/A | GET /api/v1/conversation/{id}/events/count |
| Batch get events | N/A | GET /api/v1/conversation/{id}/events |
Sandbox Management (New in V1)
| Operation | V1 Endpoint |
|---|---|
| Create sandbox | POST /api/v1/sandboxes |
| Search sandboxes | GET /api/v1/sandboxes/search |
| Get sandboxes | GET /api/v1/sandboxes |
| Pause | POST /api/v1/sandboxes/{id}/pause |
| Resume | POST /api/v1/sandboxes/{id}/resume |
| Delete | DELETE /api/v1/sandboxes/{id} |
Development Tools
| Operation | V0 Endpoint | V1 Equivalent |
|---|---|---|
| Get VSCode URL | GET /api/conversations/{id}/vscode-url | Get sandbox, find VSCODE in exposed_urls |
| Get web hosts | GET /api/conversations/{id}/web-hosts | Get sandbox, find AGENT_SERVER in exposed_urls |
Health & Status (Unchanged)
| Operation | Endpoint |
|---|---|
| Health check | GET /health |
| Alive check | GET /alive |
| Ready check | GET /ready |
Agent Server API Reference
The Agent Server runs on each sandbox and provides direct access to workspace operations.Authentication
Use thesession_api_key from your sandbox info with the X-Session-API-Key header.
Available Endpoints
File Operations
File Operations
| Endpoint | Description |
|---|---|
POST /api/file/upload/{path} | Upload files to workspace |
GET /api/file/download/{path} | Download individual files |
GET /api/file/download-trajectory/{conversation_id} | Download conversation trajectory |
Git Operations
Git Operations
| Endpoint | Description |
|---|---|
GET /api/git/changes/{path} | Get git changes |
GET /api/git/diff/{path} | Get git diff |
Bash Operations
Bash Operations
| Endpoint | Description |
|---|---|
POST /api/bash/execute_bash_command | Execute bash command (blocking) |
POST /api/bash/start_bash_command | Start bash command (async) |
GET /api/bash/bash_events/search | Search bash events |
Conversation Operations
Conversation Operations
| Endpoint | Description |
|---|---|
POST /api/conversations/{id}/events | Send user message |
GET /api/conversations/{id}/events/search | Search events |
GET /api/conversations/{id}/events/count | Count events |
POST /api/conversations/{id}/pause | Pause conversation |
POST /api/conversations/{id}/run | Resume/run conversation |
DELETE /api/conversations/{id} | Delete conversation |
Development Tools
Development Tools
| Endpoint | Description |
|---|---|
GET /api/vscode/url | Get VSCode URL |
GET /api/vscode/status | Check VSCode status |
GET /api/desktop/url | Get desktop URL |
GET /api/tools/ | List available tools |
The Agent Server requires an active (running) sandbox. For operations on paused or inactive sandboxes, use the App Server API.
Accessing Agent Server API Documentation
The Agent Server provides its own Swagger UI and OpenAPI specification, but you need a running sandbox to access them. Step 1: Get the Agent Server URL First, retrieve your sandbox info to get the Agent Server URL (see Step 5 above):AGENT_SERVER URL from exposed_urls.
Step 2: Access the Documentation
Once you have the Agent Server URL, you can access:
| Resource | URL |
|---|---|
| Swagger UI | {agent_server_url}/docs |
| OpenAPI JSON | {agent_server_url}/openapi.json |
https://sandbox-abc123.runtime.all-hands.dev:
Known Gaps and Workarounds
Some V0 capabilities don’t have direct V1 App Server equivalents yet:| Gap | V0 Endpoint | Workaround |
|---|---|---|
| Download workspace as zip | GET /api/conversations/{id}/zip-directory | Use Agent Server to download individual files, or Agent SDK workspace.get_workspace_zip() |
| Get trajectory (inactive runtime) | GET /api/conversations/{id}/trajectory | Trajectory available while sandbox is active via Agent Server |
| List workspace files | GET /api/conversations/{id}/list-files | Use Agent Server POST /api/bash/execute_bash_command with ls, or Agent SDK workspace.list_files() |
Authentication Summary
| API | Authentication |
|---|---|
| App Server (both V0 and V1) | API key via Authorization: Bearer YOUR_API_KEY header |
| Agent Server | Session API key via X-Session-API-Key: {session_api_key} header |
/api/keys endpoint and work for both V0 and V1 App Server APIs.
Additional Resources
- V1 REST API Overview
- Cloud API Guide
- OpenHands Agent SDK — Python SDK with
workspace.read_file(),workspace.write_file(),workspace.list_files(), and more - V1 API Swagger Docs — Interactive API documentation
- V1 API OpenAPI Spec — OpenAPI JSON specification for the App Server

