Resume a terminal session
const url = 'https://terminal.api.example.com/v1/terminal_sessions/example/resume';const options = {method: 'POST'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://terminal.api.example.com/v1/terminal_sessions/example/resumeCalled by the terminal to pick an interrupted session back up, before its recovery_deadline.
The session is active again and its last heartbeat moves to now. Resuming an active session
answers it as it is, so it is safe to repeat. Takes no body.
Past the deadline the session has expired, and the terminal opens a new one.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The object’s id.
Responses
Section titled “Responses”The session, active.
object
The session’s id, used in the path of its heartbeat, resume and close.
Always true. A terminal is a live device; there are no test terminals.
The terminal that opened it, the only one that can use it.
active while it takes heartbeats; recoverable_interrupted once it missed them, until it is
resumed or its recovery_deadline passes; expired and closed are final.
When it was opened, as a Unix timestamp.
The last time the terminal showed it was alive on it, by opening, a heartbeat or a resume, as a Unix timestamp.
When it was interrupted for missing its heartbeats, while it is recoverable_interrupted.
The last moment it can be resumed, while it is recoverable_interrupted.
When it ends, however well it heartbeats, as a Unix timestamp.
When it expired, once it is expired.
When it was closed, once it is closed.
Example
{ "id": "6d0f3b8e-2c4a-4f7e-9b1d-8a5c3e7f2b10", "object": "terminal_session", "livemode": true, "terminal_id": "3f6c2a9e-8b41-4d7a-9e25-0c1b7d4f8a63", "status": "active", "opened_at": 1791000000, "last_heartbeat_at": 1791000200, "interrupted_at": null, "recovery_deadline": null, "expires_at": 1791043200, "expired_at": null, "closed_at": null}authentication_failure with terminal_credential_refused: the certificate does not count, or the terminal is suspended or retired. See Pairing a terminal.
object
object
A stable name for this refusal. Branch on this, never on message.
For the developer reading a log. May be reworded.
The field or parameter at fault, when there is one.
Example
{ "error": { "type": "validation_failure" }}not_found with resource_missing: this terminal has no session with this id. Another terminal’s session reads the same.
object
object
A stable name for this refusal. Branch on this, never on message.
For the developer reading a log. May be reworded.
The field or parameter at fault, when there is one.
Example
{ "error": { "type": "validation_failure" }}invariant_violation: the session cannot be resumed. code says where it is:
code |
Meaning |
|---|---|
session_expired |
Its recovery window ran out, or it reached its longest lifetime. Open a new one. |
session_closed |
It is closed. Open a new one. |
object
object
A stable name for this refusal. Branch on this, never on message.
For the developer reading a log. May be reworded.
The field or parameter at fault, when there is one.
Example
{ "error": { "type": "invariant_violation", "code": "session_expired", "message": "This session has expired. Open a new one.", "param": null, "request_id": "req_8d2f6b4a9c1e" }}dependency_failure with service_unavailable: the platform did not answer, or failed part-way. Whether the call took effect is not known. Retry the same request: a heartbeat is safe to repeat, and if a retry is refused because the session is already as the call would leave it (for example session_closed after a close), the first call took effect.
object
object
A stable name for this refusal. Branch on this, never on message.
For the developer reading a log. May be reworded.
The field or parameter at fault, when there is one.
Example
{ "error": { "type": "validation_failure" }}