Skip to Content
kosemdocs
ReferenceAPIEnvironments

Open terminal

Issues a short-lived ticket to connect to an interactive shell in a running environment. For environments owned by an agent, also requires agents.agents.send on that agent. Pass the returned token to AttachTerminal in Sec-WebSocket-Protocol as kosem.auth.<token>.

POST
/v1/projects/{project}/environments/{environment}/terminals

Issues a short-lived ticket to connect to an interactive shell in a running environment.

For environments owned by an agent, also requires agents.agents.send on that agent. Pass the returned token to AttachTerminal in Sec-WebSocket-Protocol as kosem.auth..

Authorization

bearer
headerAuthorizationBearer <token>

An access token, or an API key.

Path Parameters

project*string

The project's ID.

Match^prj_[0-7][0-9a-hjkmnp-tv-z]{25}$
environment*string

The environment's ID.

Match^env_[0-7][0-9a-hjkmnp-tv-z]{25}$

Request Body

application/json
  1. body
sessionId?string

Existing terminal session ID to reattach to; leave empty to start a new session.

Match^trm_[0-7][0-9a-hjkmnp-tv-z]{25}$

Response Body

OK

application/json
  1. response
expireTime*string

When the ticket expires.

Formatdate-time
sessionId*string

Terminal session ID to pass to AttachTerminal.

token*string

Short-lived attach ticket. Pass it in Sec-WebSocket-Protocol as kosem.auth. (don't pass it in the URL).

Example Request
curl -X POST 'https://api.kosem.ai/v1/projects/string/environments/string/terminals' \
  -H 'Content-Type: application/json' \
  -d '{}'
Example Response
{
  "expireTime": "2019-08-24T14:15:22Z",
  "sessionId": "string",
  "token": "string"
}