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
cURL
cURL
Python (with requests)
Python (with requests)
TypeScript/JavaScript (with fetch)
TypeScript/JavaScript (with fetch)
Response
The API will return a JSON object with details about the created conversation: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
cURL
cURL