Retrieve an environment
curl --request GET \
--url https://agp.eu.hcompany.ai/api/v2/environments/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://agp.eu.hcompany.ai/api/v2/environments/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://agp.eu.hcompany.ai/api/v2/environments/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://agp.eu.hcompany.ai/api/v2/environments/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://agp.eu.hcompany.ai/api/v2/environments/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://agp.eu.hcompany.ai/api/v2/environments/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://agp.eu.hcompany.ai/api/v2/environments/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"kind": "<string>",
"host": "<string>",
"start_url": "<string>",
"headless": true,
"session_id": {},
"mode": {},
"lazy": true,
"settle_s": 123,
"vault_id": {},
"browser_profile_id": {},
"use_default_browser_profile": true,
"persist_browser_profile": true,
"network": {}
}Environments
Retrieve an environment
Get the full specification of an environment by id, including mode, start URL, vault, and profile settings.
GET
/
api
/
v2
/
environments
/
{id}
Retrieve an environment
curl --request GET \
--url https://agp.eu.hcompany.ai/api/v2/environments/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://agp.eu.hcompany.ai/api/v2/environments/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://agp.eu.hcompany.ai/api/v2/environments/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://agp.eu.hcompany.ai/api/v2/environments/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://agp.eu.hcompany.ai/api/v2/environments/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://agp.eu.hcompany.ai/api/v2/environments/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://agp.eu.hcompany.ai/api/v2/environments/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"kind": "<string>",
"host": "<string>",
"start_url": "<string>",
"headless": true,
"session_id": {},
"mode": {},
"lazy": true,
"settle_s": 123,
"vault_id": {},
"browser_profile_id": {},
"use_default_browser_profile": true,
"persist_browser_profile": true,
"network": {}
}Retrieves one environment’s full specification, including pre-built
h/ environments.
Returns the environment object.
Path parameters
string
required
The environment’s
id (e.g. h/browser or my-browser). Slash-containing identifiers are supported.Response
The environment object, also returned by create, list, update, and patch. A browser (kind: "web") carries the fields below. A desktop (kind: "desktop") carries only id, kind, host, session_id, lazy, settle_s, and screenshot_max_width. Field meanings are on Create an environment.
string
Catalog identifier.
h/ ids are H’s reserved, read-only environments.string
web or desktop.string
cloud or user_device.string
Initial URL.
boolean
Whether the browser runs without a visible window.
string | null
Existing browser session to attach to.
object
{"type": "visual", "width", "height", "markdown"} or {"type": "text", "chunk_size"}.boolean
Whether the browser starts on first use.
number
Seconds the agent waits after each action.
string | null
Browser profile loaded at start.
boolean
Whether your default browser profile is loaded.
boolean
Whether the final browser state is saved back into the profile.
object | null
Proxy settings:
managed_proxy or proxy_url.Examples
curl "https://agp.eu.hcompany.ai/api/v2/environments/h/browser" \
-H "Authorization: Bearer $HAI_API_KEY"
from hai_agents import Client
client = Client()
environment = client.environments.get_environment("h/browser")
print(environment)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
const environment = await client.environments.getEnvironment({ id: "h/browser" });
console.log(environment);
Response
{
"id": "h/browser",
"kind": "web",
"host": "cloud",
"start_url": "https://www.bing.com",
"headless": false,
"session_id": null,
"mode": {"type": "visual", "width": 1200, "height": 1200, "markdown": false},
"lazy": false,
"settle_s": 1.0,
"vault_id": null,
"browser_profile_id": null,
"use_default_browser_profile": false,
"persist_browser_profile": false,
"network": null
}
Errors
| Status | Cause |
|---|---|
404 | Environment not found or you don’t have access. |
Was this page helpful?