Skip to main content
For the available API endpoints, refer to the OpenHands API Reference.

Obtaining an API Key

To use the OpenHands Cloud API, you’ll need to generate an API key:
  1. Log in to your OpenHands Cloud account.
  2. Navigate to the Settings > API Keys page.
  3. Click Create API Key.
  4. Give your key a descriptive name (Example: “Development” or “Production”) and select Create.
  5. Copy the generated API key and store it securely. It will only be shown once.

API Usage Example (V1)

Starting a New Conversation

To start a new conversation with OpenHands to perform a task, make a POST request to the V1 app-conversations endpoint.
curl -X POST "https://app.all-hands.dev/api/v1/app-conversations" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "initial_message": {
      "content": [{"type": "text", "text": "Check whether there is any incorrect information in the README.md file and send a PR to fix it if so."}]
    },
    "selected_repository": "yourusername/your-repo"
  }'

Response

The API will return a JSON object with details about the conversation start task:
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "WORKING",
  "app_conversation_id": "660e8400-e29b-41d4-a716-446655440001",
  "sandbox_id": "sandbox-abc123",
  "created_at": "2025-01-15T10:30:00Z"
}
The status field indicates the current state of the conversation startup process:
  • WORKING - Initial processing
  • WAITING_FOR_SANDBOX - Waiting for sandbox to be ready
  • PREPARING_REPOSITORY - Cloning and setting up the repository
  • READY - Conversation is ready to use
  • ERROR - An error occurred during startup
You may receive an authentication error if:
  • You provided an invalid API key.
  • You provided the wrong repository name.
  • You don’t have access to the repository.

Streaming Conversation Start (Optional)

For real-time updates during conversation startup, you can use the streaming endpoint:
curl -X POST "https://app.all-hands.dev/api/v1/app-conversations/stream-start" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "initial_message": {
      "content": [{"type": "text", "text": "Your task description here"}]
    },
    "selected_repository": "yourusername/your-repo"
  }'

Streaming Response

The endpoint streams a JSON array incrementally. Each element represents a status update:
[
  {"id": "550e8400-e29b-41d4-a716-446655440000", "status": "WORKING", "created_at": "2025-01-15T10:30:00Z"},
  {"id": "550e8400-e29b-41d4-a716-446655440000", "status": "WAITING_FOR_SANDBOX", "created_at": "2025-01-15T10:30:00Z"},
  {"id": "550e8400-e29b-41d4-a716-446655440000", "status": "PREPARING_REPOSITORY", "created_at": "2025-01-15T10:30:00Z"},
  {"id": "550e8400-e29b-41d4-a716-446655440000", "status": "READY", "app_conversation_id": "660e8400-e29b-41d4-a716-446655440001", "sandbox_id": "sandbox-abc123", "created_at": "2025-01-15T10:30:00Z"}
]
Each update is streamed as it occurs, allowing you to provide real-time feedback to users about the conversation startup progress.

Rate Limits

If you have too many conversations running at once, older conversations will be paused to limit the number of concurrent conversations. If you’re running into issues and need a higher limit for your use case, please contact us at contact@all-hands.dev.

Migrating from V0 to V1 API

The V0 API (/api/conversations) is deprecated and scheduled for removal on April 1, 2026. Please migrate to the V1 API (/api/v1/app-conversations) as soon as possible.

Key Differences

FeatureV0 APIV1 API
EndpointPOST /api/conversationsPOST /api/v1/app-conversations
Message formatinitial_user_msg (string)initial_message.content (array of content objects)
Repository fieldrepositoryselected_repository
ResponseImmediate conversation_idStart task with status and eventual app_conversation_id

Migration Steps

  1. Update the endpoint URL: Change from /api/conversations to /api/v1/app-conversations
  2. Update the request body:
    • Change repository to selected_repository
    • Change initial_user_msg (string) to initial_message (object with content array):
    // V0 format
    { "initial_user_msg": "Your message here" }
    
    // V1 format
    { "initial_message": { "content": [{"type": "text", "text": "Your message here"}] } }
    
  3. Update response handling: The V1 API returns a start task object. The conversation ID is in the app_conversation_id field (available when status is READY), or use the id field for the start task ID.

Legacy API (V0) - Deprecated

The V0 API is deprecated since version 1.0.0 and will be removed on April 1, 2026. New integrations should use the V1 API documented above.

Starting a New Conversation (V0)

curl -X POST "https://app.all-hands.dev/api/conversations" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "initial_user_msg": "Check whether there is any incorrect information in the README.md file and send a PR to fix it if so.",
    "repository": "yourusername/your-repo"
  }'

Response (V0)

{
  "status": "ok",
  "conversation_id": "abc1234"
}