Skip to content

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.

  • A partner access token with agents:read (for listing connections) and requests: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.

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
}>
}
}

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 — connected or disconnected. Only connected agents 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 to manageUrl.

To disconnect one agent from your side, send DELETE /v1/api/partner-app/connections/{id} with the requests:write scope:

Terminal window
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.

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 }
}

The first successful call returns HTTP 201:

{
"id": "a41e8c3f-7b2d-4f09-9d6a-5c2e8b1a4f70",
"connectionId": "6f1c4b2e-9a8d-4c11-8e2f-3b7a1d5e9c02",
"status": "received"
}
  • Identical retries return 200. Sending the same requestKey, connectionId and brief returns the existing request instead of creating a duplicate.
  • Keys are scoped per mode. The same requestKey in 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 new requestKey for a new request. If a request is refused with 409 and code: "agent_unavailable" (when the agent’s project is stopped or held), no request is created and you can retry with the same requestKey once the agent is available.

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.

Once request.delivered arrives, call GET /v1/api/partner-app/requests/{id}:

Terminal window
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.

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)
}

A file downloads only when the finished delivery references it; otherwise hlix answers 404 with Unknown request file..

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 }
}
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.