Reference
View as MarkdownTerminal API
6 operations. Every call needs a session cookie or an Authorization: Bearer nct_… token unless marked Public. Conventions, errors and scopes
/projects/{projectId}/terminal-settingsA project's terminal settings
| Parameter | In | Type | Description |
|---|---|---|---|
projectIdrequired | path | string |
Response 200 · OK · application/json
- allowProductionFileWritesbooleanrequiredLet the file browser upload files in production environments of this project (default off: read-only).
401Unauthorized403Forbidden404Not Found422Unprocessable Entity500Internal Server Error
Errors are RFC 9457 application/problem+json with a stable code field.
/projects/{projectId}/terminal-settingsChange a project's terminal settings
Admins and Owners only. allowProductionFileWrites lets the file browser upload files in the project's production environments (default off). Audited.
| Parameter | In | Type | Description |
|---|---|---|---|
projectIdrequired | path | string |
Request body · application/json · required
- allowProductionFileWritesbooleanrequiredLet the file browser upload files in production environments of this project (default off: read-only).
Response 200 · OK · application/json
- allowProductionFileWritesbooleanrequiredLet the file browser upload files in production environments of this project (default off: read-only).
401Unauthorized403Forbidden404Not Found422Unprocessable Entity500Internal Server Error
Errors are RFC 9457 application/problem+json with a stable code field.
/servers/{serverId}/host-shellHost shell availability of a server
Whether the caller can open a shell on the server itself, and why not: the setting is off (the default), the caller's account has no two-factor authentication, or the server is offline. Owners and Admins with a signed-in session only; a token gets 403 session_required.
**Shell.** GET /servers/{serverId}/shell/ws upgrades to a WebSocket with the protocol of the service terminal (see getServiceTerminal): the first message is JSON {"type":"open","cols":80,"rows":24,"confirmProduction":false} (no command: it is always the host's login shell). It answers 403 host_shell_disabled when the setting is off and 403 two_factor_required when the account has no 2FA, before the upgrade. A server that runs any service of a production environment needs confirmProduction: true. A person may hold 2 host shells; an idle session (no input for 15 minutes) is closed. Sessions are audited (server.shell.open, server.shell.close: who, server, duration); their I/O is never recorded.
| Parameter | In | Type | Description |
|---|---|---|---|
serverIdrequired | path | string |
Response 200 · OK · application/json
- activeSessionsinteger (int64)requiredHost shells the caller has open.
- availablebooleanrequiredA session can be opened now: enabled, the server online and the caller's account has two-factor authentication.
- enabledbooleanrequiredAn admin switched the host shell on for this server (default off).
- idleTimeoutSecondsinteger (int64)required
- maxSessionsinteger (int64)required
- productionbooleanrequiredA service of a production environment runs on this server: opening a shell needs confirmProduction.
- reasonstringWhy Available is false, in a sentence.
- serverIdstringrequired
- serverNamestringrequired
- twoFactorEnabledbooleanrequiredThe caller's account has two-factor authentication.
401Unauthorized403Forbiddensession_requiredhost_shell_disabledtwo_factor_required404Not Found422Unprocessable Entity500Internal Server Error
Errors are RFC 9457 application/problem+json with a stable code field.
/servers/{serverId}/host-shellSwitch a server's host shell on or off
Owners and Admins only (signed-in session). Off by default. The host shell is a root shell on the server: switching it on is audited (server.shell.enable, server.shell.disable), and switching it off ends the sessions that are open.
| Parameter | In | Type | Description |
|---|---|---|---|
serverIdrequired | path | string |
Request body · application/json · required
- enabledbooleanrequiredAllow Owners and Admins with two-factor authentication to open a root shell on this server.
Response 200 · OK · application/json
- enabledbooleanrequiredAllow Owners and Admins with two-factor authentication to open a root shell on this server.
401Unauthorized403Forbidden404Not Found422Unprocessable Entity500Internal Server Error
Errors are RFC 9457 application/problem+json with a stable code field.
/services/{serviceId}/filesList a directory inside a replica container
Lists the immediate children of an absolute path (directories first, at most 2000 entries). The listing reads the container's own filesystem through the Docker API; nothing on the host is reachable. Requires the Owner, Admin or Developer role.
| Parameter | In | Type | Description |
|---|---|---|---|
serviceIdrequired | path | string | |
replica | query | integer (int64) | Replica index. |
path | query | string | Absolute directory path inside the container. |
Response 200 · OK · application/json
- FileEntry[] | nullrequired
- pathstringrequiredThe resolved directory path.
- readOnlyReasonstring
- replicainteger (int64)required
- truncatedbooleanrequiredThe directory has more entries than are listed.
- writablebooleanrequiredUploads are allowed here.
401Unauthorized403Forbidden404Not Found409Conflict422Unprocessable Entity500Internal Server Error
Errors are RFC 9457 application/problem+json with a stable code field.
/services/{serviceId}/terminalTerminal and file browser availability
What the caller can do with the service's web terminal and file browser: its replicas, whether a terminal can be opened now, whether production needs a confirmation and whether the file browser may write. Requires the Owner, Admin or Developer role and deployments:write; a Viewer gets 403.
**Terminal.** GET /services/{serviceId}/terminal/ws upgrades to a WebSocket (browser session cookie, same origin). The first client message is JSON {"type":"open","replica":0,"command":[…],"cols":80,"rows":24,"confirmProduction":false}; binary messages are terminal input/output; JSON {"type":"resize","cols":…,"rows":…} resizes and {"type":"close"} ends the session. The server answers opened, idle_warning, exit, error and closed JSON messages. Production services need confirmProduction: true. A principal may hold 3 sessions; an idle session (no input for 15 minutes) is closed. Sessions are audited (terminal.open, terminal.close); their I/O is never recorded.
**Files.** GET /services/{serviceId}/files/content?replica=&path=&preview= streams a file (preview=true returns at most 1 MiB as text/plain); POST /services/{serviceId}/files/upload?replica=&path=<dir>&name=<file> stores the request body (Content-Length required, 50 MB at most). Uploads are refused in production unless an admin allowed writes for the project.
| Parameter | In | Type | Description |
|---|---|---|---|
serviceIdrequired | path | string |
Response 200 · OK · application/json
- activeSessionsinteger (int64)requiredTerminal sessions the caller has open right now.
- availablebooleanrequiredA terminal can be opened now.
- FileWritePolicyrequired
- idleTimeoutSecondsinteger (int64)required
- maxSessionsinteger (int64)required
- maxUploadBytesinteger (int64)required
- previewBytesinteger (int64)required
- productionbooleanrequiredThe service runs in a production environment: opening a terminal needs confirmProduction.
- reasonstringWhy not, when unavailable.
- ReplicaView[] | nullrequired
- serverNamestring
- serviceIdstringrequired
401Unauthorized403Forbidden404Not Found422Unprocessable Entity500Internal Server Error
Errors are RFC 9457 application/problem+json with a stable code field.