Skip to content
Hayonix

API reference · Pods

A single-use ticket (valid for seconds) to open the pod’s terminal WebSocket

POST/v1/pods/{pod_id}/terminal-tickets
API keyworkload:updateProject
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

Headers
HeaderRequiredDescription
AuthorizationyesBearer and your API key. The key implies its project.
X-Project-Idsession onlyThe project to act in, for console sessions. Requests with an API key leave it out.

Path parameters

  • pod_idstringrequired

    ID of the pod

    ID with prefix pod_

Body

JSON (application/json): TerminalTicketRequest, optional.

  • rowsinteger

    Initial terminal height in rows; resize later over the WebSocket

    1–500 · default 24

  • colsinteger

    Initial terminal width in columns

    1–500 · default 80

Response

200 TerminalTicket — The ticket and where to use it

  • objectstringrequired

    Always `terminal_ticket`: the type of this object

    One ofterminal_ticket

  • ticketstringrequired

    Single-use credential for one terminal; already in `websocket_path`

  • expires_atstring (date-time)required

    When it expires (null: never) (ISO 8601, UTC)

  • websocket_pathstringrequired

    Open 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
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:

Errors
StatusTypeWhen
400invalid_request_errorA parameter or body field is missing or not allowed; param names it.
401authentication_errorThe key or session is missing, revoked or expired.
403permission_errorThe credential lacks the permission this needs, or the organization is suspended.
404not_found_errorNo such resource in this project (an ID from another project is answered the same way).
409conflict_errorThe resource's current state does not allow this.
429rate_limit_error rate_limitedToo many requests; retry after retry-after seconds.