Skip to main content
The Agents API is a REST API. Each endpoint page has its parameters, response, errors, and a playground. This page holds the rules they all share.

Base URL and regions

H runs isolated EU and US regions. Requests stay in-region: an EU key only ever reaches EU infrastructure. The REST API lives under /api/v2 on each region’s host. The SDKs and the CLI default to EU. To target the US, see Region.

Authentication

Send your API key as a bearer token on every request. No key yet? Create one.
A missing or invalid key returns 401. The SDKs read the key from HAI_API_KEY (Authenticate). A few session reads also work without a key once the session is shared.

Requests and responses

  • Request bodies are JSON, sent with Content-Type: application/json.
  • Responses are JSON, except 204 No Content on deletes and on a changes poll with nothing new, and a 302 redirect on file downloads.
  • Timestamps are ISO 8601 strings.

Pagination

List endpoints use one of two styles. Each list page documents its defaults, its cap, and its sort options.

Page and size

Sessions, session events, agents, environments, skills, schedules, schedule runs, webhooks, and every revision list take page (1-based, default 1) and size, and return a page envelope:
Page envelope
Responses do not echo size, so track it yourself: there are more pages while page * size < total.

Limit and offset

Vaults, vault items, and browser profiles take limit and offset (default 0), and return total, limit, offset, and a named array: vaults, items, or profiles. There are more pages while offset + limit < total.

Idempotency

Create a session takes an optional Idempotency-Key header, 1 to 255 characters. Retry with the same key within 24 hours and you get the original session back instead of a second one.

Revisions and concurrency

Agents, environments, and skills keep a revision history. Retrieve, create, update, patch, and restore return the revision number in the ETag header, for example "3". A create returns "1". Send that value back as If-Match on update, patch, delete, or restore to write only if nobody changed the resource since you read it: An agent read with resolve=true returns no ETag, since it also reflects the environments, skills, and subagents it expands.

Shared sessions

Once you share a session, these endpoints answer for it without a key: Every other call needs your key. Unshare the session to revoke its link.

Errors

Errors carry a message and a detail array, one entry per problem:
Error envelope
Vault, browser profile, and session file endpoints return a single detail string instead, except on 422. Requests rejected before they reach the API, such as a 401, may carry only a message. Each endpoint page lists its own causes. Retry rules, quota details, and session failure codes: Errors.