Browser profiles
Initiate a profile upload
Initiate a direct upload of a browser profile archive to storage.
POST
/
api
/
v2
/
browser-profiles
/
initiate-upload
from hai_agents import Client
client = Client()
upload = client.browser_profiles.initiate_browser_profile_upload()
print(upload.profile_id, upload.upload_url)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
const upload = await client.browserProfiles.initiateBrowserProfileUpload();
console.log(upload.profileId, upload.uploadUrl);
curl -X POST https://agp.eu.hcompany.ai/api/v2/browser-profiles/initiate-upload \
-H "Authorization: Bearer $HAI_API_KEY"
{
"profile_id": "9b2e4c1a-7d3f-4e8b-a6c5-2f1d0e9b8a76",
"upload_url": "https://...",
"upload_fields": {
"key": "...",
"Content-Type": "application/zip",
"...": "..."
},
"upload_expires_in": 3600
}
Behavior
This starts the profile upload flow. The archive bytes never pass through the Agents API.- Call this endpoint. No request body.
POSTthe archive toupload_urlasmultipart/form-data: everyupload_fieldsentry exactly as returned, then the file as the last field.- Call Complete upload with the returned
profile_id.
Response
200 with the presigned upload target. It expires after upload_expires_in seconds.
string
ID (UUID) reserved for the profile. Pass it to Complete upload.
string
Presigned object-storage URL to
POST the archive to.object
Form fields that must accompany the upload, sent before the file.
integer
Seconds until the presigned target expires.
from hai_agents import Client
client = Client()
upload = client.browser_profiles.initiate_browser_profile_upload()
print(upload.profile_id, upload.upload_url)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
const upload = await client.browserProfiles.initiateBrowserProfileUpload();
console.log(upload.profileId, upload.uploadUrl);
curl -X POST https://agp.eu.hcompany.ai/api/v2/browser-profiles/initiate-upload \
-H "Authorization: Bearer $HAI_API_KEY"
{
"profile_id": "9b2e4c1a-7d3f-4e8b-a6c5-2f1d0e9b8a76",
"upload_url": "https://...",
"upload_fields": {
"key": "...",
"Content-Type": "application/zip",
"...": "..."
},
"upload_expires_in": 3600
}
Upload the archive
Initiate the upload, then postprofile.zip to the presigned target:
import httpx
from hai_agents import Client
client = Client()
upload = client.browser_profiles.initiate_browser_profile_upload()
with open("profile.zip", "rb") as f:
httpx.post(
upload.upload_url,
data=upload.upload_fields,
files={"file": ("profile.zip", f, "application/zip")},
).raise_for_status()
print(upload.profile_id)
UPLOAD=$(curl -s -X POST https://agp.eu.hcompany.ai/api/v2/browser-profiles/initiate-upload \
-H "Authorization: Bearer $HAI_API_KEY")
args=()
while IFS= read -r field; do args+=(--form-string "$field"); done \
< <(echo "$UPLOAD" | jq -r '.upload_fields | to_entries[] | "\(.key)=\(.value)"')
curl -X POST "$(echo "$UPLOAD" | jq -r .upload_url)" "${args[@]}" \
-F "file=@profile.zip;type=application/zip"
echo "$UPLOAD" | jq -r .profile_id
--form-string, since -F would read a value starting with < (such as tagging) as a file.Was this page helpful?
⌘I
from hai_agents import Client
client = Client()
upload = client.browser_profiles.initiate_browser_profile_upload()
print(upload.profile_id, upload.upload_url)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
const upload = await client.browserProfiles.initiateBrowserProfileUpload();
console.log(upload.profileId, upload.uploadUrl);
curl -X POST https://agp.eu.hcompany.ai/api/v2/browser-profiles/initiate-upload \
-H "Authorization: Bearer $HAI_API_KEY"
{
"profile_id": "9b2e4c1a-7d3f-4e8b-a6c5-2f1d0e9b8a76",
"upload_url": "https://...",
"upload_fields": {
"key": "...",
"Content-Type": "application/zip",
"...": "..."
},
"upload_expires_in": 3600
}