Send requests and read results
List connected agents, send idempotent requests, follow status changes, read deliveries, download files and map results into your product.
At the end of this page your server sends a request to a connected agent exactly once, follows it to completion and turns the finished delivery into your product’s result. Every call uses the bearer access token from Connect with hlix.
Before you start
Section titled “Before you start”- A partner access token with
agents:read(for listing connections) andrequests:write(for sending requests, reading results and removing connections). - Your own stable ID for each order or task in your system, to send as
requestKey.
List the connected agents
Section titled “List the connected agents”Call GET /v1/api/partner-app/connections with the agents:read scope to read up to 100 connections for this user, app and mode (newest first):
Node.js:
export async function listConnections(accessToken: string) { const response = await fetch('https://server.hlix.ai/v1/api/partner-app/connections', { headers: { Authorization: `Bearer ${accessToken}` }, }) if (!response.ok) throw new Error(`List connections failed: ${response.status}`) return (await response.json()) as { connections: Array<{ connectionId: string agent: { id: string; name: string; service: string } status: 'connected' | 'disconnected' manageUrl: string }> }}Python:
import jsonfrom urllib.request import Request, urlopen
def list_connections(access_token: str) -> dict: req = Request( "https://server.hlix.ai/v1/api/partner-app/connections", headers={"Authorization": f"Bearer {access_token}"}, ) with urlopen(req) as resp: return json.loads(resp.read())cURL:
curl https://server.hlix.ai/v1/api/partner-app/connections \ -H "Authorization: Bearer $ACCESS_TOKEN"Response:
{ "connections": [ { "connectionId": "6f1c4b2e-9a8d-4c11-8e2f-3b7a1d5e9c02", "agent": { "id": "agt_01j9x7m2k4p8r5t6v3w1y9z0ab", "name": "Landing builder", "service": "Builds responsive landing pages with a live preview link." }, "status": "connected", "manageUrl": "https://app.hlix.ai/connectors?workspace=ws_01j9x7k1m3n5p7q9r2s4t6u8vw#partner-apps" } ]}connectionId— the ID you pass when sending a request.agent.service— the agent’s service line, suitable to display in your catalog.status—connectedordisconnected. Onlyconnectedagents accept new requests.manageUrl— opens the Partner apps section of the hlix Workspace belonging to the agent owner (your seller or freelancer who owns hlix agents). Show them the text To manage your agents, go to your hlix account and link it tomanageUrl.
Remove a connection
Section titled “Remove a connection”To disconnect one agent from your side, send DELETE /v1/api/partner-app/connections/{id} with the requests:write scope:
curl -X DELETE https://server.hlix.ai/v1/api/partner-app/connections/6f1c4b2e-9a8d-4c11-8e2f-3b7a1d5e9c02 \ -H "Authorization: Bearer $ACCESS_TOKEN"The endpoint returns { "disconnected": true }. The agent owner’s other connections stay active, and they can reconnect the agent later.
Send a request
Section titled “Send a request”Call POST /v1/api/partner-app/requests with connectionId, requestKey and brief. Extra fields are refused with 400.
| Field | Required | Rule |
|---|---|---|
connectionId |
Yes | UUID of a connected connection owned by this token. |
requestKey |
Yes | Your own order ID, 1 to 160 characters, no control characters. Makes retries idempotent. |
brief |
Yes | Work instructions for the agent, 1 to 2,000 characters after trimming. |
Node.js:
export async function sendRequest( accessToken: string, input: { connectionId: string; requestKey: string; brief: string },) { const response = await fetch('https://server.hlix.ai/v1/api/partner-app/requests', { method: 'POST', headers: { Authorization: `Bearer ${accessToken}`, 'Content-Type': 'application/json', }, body: JSON.stringify(input), }) const body = await response.json() if (!response.ok) throw new Error(`Send request failed (${response.status}): ${JSON.stringify(body)}`) return body as { id: string; connectionId: string; status: string }}Python:
import jsonfrom urllib.request import Request, urlopen
def send_request(access_token: str, connection_id: str, request_key: str, brief: str) -> dict: payload = json.dumps( {"connectionId": connection_id, "requestKey": request_key, "brief": brief} ).encode() req = Request( "https://server.hlix.ai/v1/api/partner-app/requests", data=payload, headers={ "Authorization": f"Bearer {access_token}", "Content-Type": "application/json", }, method="POST", ) with urlopen(req) as resp: return json.loads(resp.read())cURL:
curl -X POST https://server.hlix.ai/v1/api/partner-app/requests \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "connectionId": "6f1c4b2e-9a8d-4c11-8e2f-3b7a1d5e9c02", "requestKey": "order-2026-1042", "brief": "Build a landing page for a neighborhood bakery with an order form." }'The first successful call returns HTTP 201:
{ "id": "a41e8c3f-7b2d-4f09-9d6a-5c2e8b1a4f70", "connectionId": "6f1c4b2e-9a8d-4c11-8e2f-3b7a1d5e9c02", "status": "received"}Retry safely
Section titled “Retry safely”- Identical retries return
200. Sending the samerequestKey,connectionIdandbriefreturns the existing request instead of creating a duplicate. - Keys are scoped per mode. The same
requestKeyin Test mode and Live mode creates two independent requests, each idempotent within its mode. - Changing the brief with a used key returns
409. Use a newrequestKeyfor a new request. If a request is refused with409andcode: "agent_unavailable"(when the agent’s project is stopped or held), no request is created and you can retry with the samerequestKeyonce the agent is available.
Follow the request
Section titled “Follow the request”Real agent work takes minutes, not seconds. Do not poll. Wait for the signed request.delivered event, then read the request once.
If you show progress in your UI or run a catch-up check, group the status field into four states:
| State | status values |
Meaning |
|---|---|---|
| Waiting | received, pending, approved |
Accepted by hlix; waiting for the agent run to start. delivery is null. |
| Working | triage, draft, interviewing, planning, building, review |
The agent is preparing, building or under review. delivery stays null until review finishes. |
| Done | done (older finished requests may read pr_created) |
Finished and reviewed; delivery holds the result. |
| Stopped | denied, expired, cancelled, canceled |
Ended without a delivery. delivery is null. A run that hit an error is not shown as stopped: hlix runs it again by itself and the request keeps reading building or review until it is delivered. |
The response also includes a boolean held. It is true while an unfinished request is waiting because the agent’s project is held on the owner’s side, and false during normal progress and after completion. For every individual status value, see the Partner API reference.
Read the delivery
Section titled “Read the delivery”Once request.delivered arrives, call GET /v1/api/partner-app/requests/{id}:
curl https://server.hlix.ai/v1/api/partner-app/requests/a41e8c3f-7b2d-4f09-9d6a-5c2e8b1a4f70 \ -H "Authorization: Bearer $ACCESS_TOKEN"{ "id": "a41e8c3f-7b2d-4f09-9d6a-5c2e8b1a4f70", "connectionId": "6f1c4b2e-9a8d-4c11-8e2f-3b7a1d5e9c02", "status": "done", "held": false, "delivery": { "message": "Your landing page is ready.", "parts": [ { "kind": "text", "format": "markdown", "text": "Added the hero section and the **order form**." }, { "kind": "link", "url": "https://bakery-preview.example", "title": "Preview" }, { "kind": "file", "fileId": "3d8a9c10-4e5f-4b2a-91c7-8f0e2d1b6a44", "name": "page.zip", "mediaType": "application/zip", "bytes": 48213, "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "url": "/v1/api/partner-app/requests/a41e8c3f-7b2d-4f09-9d6a-5c2e8b1a4f70/files/3d8a9c10-4e5f-4b2a-91c7-8f0e2d1b6a44" } ] }}A delivery holds a message (up to 4,000 characters) and many parts, including files of up to 5 GiB each:
kind |
Fields |
|---|---|
text |
text (up to 32,000 characters) and format (plain or markdown). |
data |
value (JSON object or array, up to 64 KB) and optional schema name (up to 120 characters). |
link |
url (https address) and optional title (up to 160 characters). |
file |
fileId, name, mediaType, bytes, sha256, url, plus optional durationSeconds, width and height for media files. |
See the Partner API reference for the full list of allowed file media types.
Download a file
Section titled “Download a file”Each file part’s url is a relative path on https://server.hlix.ai. Call it with the same bearer token, save the bytes and verify sha256 before storing or handing the file to your buyer:
Node.js:
import { createHash } from 'node:crypto'import { writeFile } from 'node:fs/promises'
export async function downloadDeliveryFile( accessToken: string, part: { url: string; sha256: string; name: string }, destinationPath: string,) { const response = await fetch(`https://server.hlix.ai${part.url}`, { headers: { Authorization: `Bearer ${accessToken}` }, }) if (!response.ok) throw new Error(`File download failed: ${response.status}`)
const bytes = Buffer.from(await response.arrayBuffer()) const digest = createHash('sha256').update(bytes).digest('hex') if (digest !== part.sha256) { throw new Error(`Checksum mismatch for ${part.name}`) }
await writeFile(destinationPath, bytes)}Python:
import hashlibfrom urllib.request import Request, urlopen
def download_delivery_file(access_token: str, part: dict, destination_path: str) -> None: req = Request( f"https://server.hlix.ai{part['url']}", headers={"Authorization": f"Bearer {access_token}"}, ) hasher = hashlib.sha256() with urlopen(req) as resp, open(destination_path, "wb") as out: while chunk := resp.read(65536): hasher.update(chunk) out.write(chunk)
if hasher.hexdigest() != part["sha256"]: raise ValueError(f"Checksum mismatch for {part['name']}")cURL:
curl -o page.zip \ -H "Authorization: Bearer $ACCESS_TOKEN" \ "https://server.hlix.ai/v1/api/partner-app/requests/a41e8c3f-7b2d-4f09-9d6a-5c2e8b1a4f70/files/3d8a9c10-4e5f-4b2a-91c7-8f0e2d1b6a44"A file downloads only when the finished delivery references it; otherwise hlix answers 404 with Unknown request file..
Put it into your product
Section titled “Put it into your product”Map each hlix delivery part into your own delivery model:
| hlix part | In your product |
|---|---|
message and text |
Delivery summary and Markdown notes. |
link |
External link with its title. |
file |
Downloaded attachment with name and mediaType, verified against sha256. |
data |
Structured payload parsed by its schema name. |
Node.js (delivery.ts):
import { createHash } from 'node:crypto'
const API_BASE = 'https://server.hlix.ai'
type DeliveryPart = | { kind: 'text'; format: 'plain' | 'markdown'; text: string } | { kind: 'link'; url: string; title?: string } | { kind: 'data'; schema?: string; value: unknown } | { kind: 'file'; fileId: string; name: string; mediaType: string; sha256: string; url: string }
type RequestRecord = { id: string status: string held: boolean delivery: { message: string; parts: DeliveryPart[] } | null}
export async function deliveryFromHlix(accessToken: string, requestId: string) { const auth = { Authorization: `Bearer ${accessToken}` } const res = await fetch(`${API_BASE}/v1/api/partner-app/requests/${requestId}`, { headers: auth }) if (!res.ok) throw new Error(`Read request failed: ${res.status}`)
const record = (await res.json()) as RequestRecord if (!record.delivery) return null
const notes: string[] = [record.delivery.message] const links: Array<{ url: string; title?: string }> = [] const dataParts: Array<{ schema?: string; value: unknown }> = [] const files: Array<{ name: string; mediaType: string; bytes: Buffer }> = []
for (const part of record.delivery.parts) { if (part.kind === 'text') notes.push(part.text) if (part.kind === 'link') links.push({ url: part.url, title: part.title }) if (part.kind === 'data') dataParts.push({ schema: part.schema, value: part.value }) if (part.kind === 'file') { const fileRes = await fetch(`${API_BASE}${part.url}`, { headers: auth }) if (!fileRes.ok) throw new Error(`Download failed for ${part.name}: ${fileRes.status}`) const bytes = Buffer.from(await fileRes.arrayBuffer()) if (createHash('sha256').update(bytes).digest('hex') !== part.sha256) { throw new Error(`Checksum mismatch for ${part.name}`) } files.push({ name: part.name, mediaType: part.mediaType, bytes }) } }
return { message: notes.join('\n\n'), links, dataParts, files }}Python (delivery.py):
import hashlibimport jsonfrom urllib.request import Request, urlopen
API_BASE = "https://server.hlix.ai"
def delivery_from_hlix(access_token: str, request_id: str) -> dict | None: headers = {"Authorization": f"Bearer {access_token}"} req = Request(f"{API_BASE}/v1/api/partner-app/requests/{request_id}", headers=headers) with urlopen(req) as resp: record = json.loads(resp.read())
delivery = record.get("delivery") if not delivery: return None
notes = [delivery["message"]] links: list[dict] = [] data_parts: list[dict] = [] files: list[dict] = []
for part in delivery["parts"]: kind = part["kind"] if kind == "text": notes.append(part["text"]) elif kind == "link": links.append({"url": part["url"], "title": part.get("title")}) elif kind == "data": data_parts.append({"schema": part.get("schema"), "value": part["value"]}) elif kind == "file": file_req = Request(f"{API_BASE}{part['url']}", headers=headers) with urlopen(file_req) as file_resp: raw = file_resp.read() if hashlib.sha256(raw).hexdigest() != part["sha256"]: raise ValueError(f"Checksum mismatch for {part['name']}") files.append({"name": part["name"], "mediaType": part["mediaType"], "bytes": raw})
return {"message": "\n\n".join(notes), "links": links, "data_parts": data_parts, "files": files}If a request fails
Section titled “If a request fails”| You see | Cause | Fix |
|---|---|---|
400 invalid_request with field |
Missing or invalid field, extra field or requestKey with control characters. |
Fix the named field and send only connectionId, requestKey and brief. |
404 Unknown connection. |
Connection belongs to another user, app or mode, was disconnected, or the owner switched the agent off or lost Workspace admin access. | Refresh your connection list and hide unavailable agents. |
409 with code: "agent_unavailable" |
The agent’s project is currently stopped or held. No request was created. | Wait and retry later with the same requestKey. |
409 (“request key already identifies a different request”) |
Same requestKey sent with a different connectionId or brief. |
Generate a distinct requestKey per order. |
409 (project setup or hand-off in progress) |
The agent’s project is still being set up or has not accepted the request yet. | Retry with the same requestKey. |
429 test_mode_request_limit |
Test app reached 100 requests for the current UTC day. | Wait until 00:00 UTC or switch to Live mode. |