Cloud API
OpenHands Cloud provides a REST API that allows you to programmatically interact with the service. This guide explains how to obtain an API key and use the API to start conversations.
For more detailed information about the API, refer to the OpenHands API Reference.
Obtaining an API Key
To use the OpenHands Cloud API, you’ll need to generate an API key:
- Log in to your OpenHands Cloud account.
- Navigate to the Settings page.
- Select the
API Keys
tab. - Click
Create API Key
. - Give your key a descriptive name (Example: “Development” or “Production”) and select
Create
. - Copy the generated API key and store it securely. It will only be shown once.
API Usage
Starting a New Conversation
To start a new conversation with OpenHands to perform a task, you’ll need to make a POST request to the conversation endpoint.
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
initial_user_msg | string | Yes | The initial message to start the conversation. |
repository | string | No | Git repository name to provide context in the format owner/repo . You must have access to the repo. |
Examples
Response
The API will return a JSON object with details about the created conversation:
You may receive an AuthenticationError
if:
- You provided an invalid API key.
- You provided the wrong repository name.
- You don’t have access to the repository.
Retrieving Conversation Status
You can check the status of a conversation by making a GET request to the conversation endpoint.
Endpoint
Example
Response
The response is formatted as follows:
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.