API reference · Pods
A single-use ticket (valid for seconds) to open the pod’s terminal WebSocket
/v1/pods/{pod_id}/terminal-tickets- TypeScript
client.pods.createTerminalTicket()- Python
client.pods.create_terminal_ticket()- CLI
hayonix api createPodTerminalTicket
Issues a short-lived, single-use ticket for an interactive terminal in the running container, opened as a WebSocket at websocket_path. Refused unless the pod is running.
Project API key (Authorization: Bearer sk_…), or a console session. Requires the workload:update permission (a key's scope, or a role that includes it).
Examples
The samples read API_KEY and API_BASE_URL from the environment (see Setup). Values are examples.
curl -sS "$API_BASE_URL/pods/pod_01jc5zq4m8k3v6x9t2w7r0b1e4/terminal-tickets" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"rows": 40,
"cols": 120
}'Request
| Header | Required | Description |
|---|---|---|
Authorization | yes | Bearer and your API key. The key implies its project. |
X-Project-Id | session only | The project to act in, for console sessions. Requests with an API key leave it out. |
Path parameters
pod_idstringrequiredID of the pod
ID with prefix pod_
Body
JSON (application/json): TerminalTicketRequest, optional.
rowsintegerInitial terminal height in rows; resize later over the WebSocket
1–500 · default 24
colsintegerInitial terminal width in columns
1–500 · default 80
Response
200 TerminalTicket — The ticket and where to use it
objectstringrequiredAlways `terminal_ticket`: the type of this object
One of
terminal_ticketticketstringrequiredSingle-use credential for one terminal; already in `websocket_path`
expires_atstring (date-time)requiredWhen it expires (null: never) (ISO 8601, UTC)
websocket_pathstringrequiredOpen a WebSocket to this path on the API origin within the expiry. Single use. From a browser the connection must come from the console origin. Binary frames: stdin (client → server) and terminal output; text frames: JSON control messages — client → {"type":"resize","rows","cols"}, {"type":"signal","signal":"SIGINT"}, {"type":"eof"}; server → {"type":"started"} and finally {"type":"exit","exit_code","error"}.
Example response
{
"object": "terminal_ticket",
"ticket": "string",
"expires_at": "2026-01-01T00:00:00.000Z",
"websocket_path": "/v1/pods/pod_01jc5zq4m8k3v6x9t2w7r0b1e4/terminal?ticket=ttk_…"
}Errors
Errors use the standard envelope. What this operation can answer:
| Status | Type | When |
|---|---|---|
400 | invalid_request_error | A parameter or body field is missing or not allowed; param names it. |
401 | authentication_error | The key or session is missing, revoked or expired. |
403 | permission_error | The credential lacks the permission this needs, or the organization is suspended. |
404 | not_found_error | No such resource in this project (an ID from another project is answered the same way). |
409 | conflict_error | The resource's current state does not allow this. |
429 | rate_limit_error rate_limited | Too many requests; retry after retry-after seconds. |