Skip to content

Manage Deployments ​

Use the Nosana REST API or TypeScript SDK to list, inspect, stop, and archive deployments.

Prerequisites ​

  • API Key: See the API key guide.
  • Existing deployments: Created via the API, SDK, or dashboard.

All examples assume you have your API key set up. For the SDK, initialize the client:

ts
import { 
function createNosanaClient(network: NosanaNetwork | undefined, customConfig: PartialClientConfig & {
    connect: ConnectFactoryConfig & {
        clientSecret: string;
    };
}): NosanaClient & {
    connect: ServerConnect;
} (+3 overloads)
createNosanaClient
,
type NosanaNetwork = "mainnet" | "devnet" | "localnet"
const NosanaNetwork: {
    readonly MAINNET: "mainnet";
    readonly DEVNET: "devnet";
    readonly LOCALNET: "localnet";
}
NosanaNetwork
} from '@nosana/kit';
const const client: NosanaClientclient = function createNosanaClient(network?: NosanaNetwork, customConfig?: PartialClientConfig): NosanaClient (+3 overloads)createNosanaClient(
const NosanaNetwork: {
    readonly MAINNET: "mainnet";
    readonly DEVNET: "devnet";
    readonly LOCALNET: "localnet";
}
NosanaNetwork
.type MAINNET: "mainnet"MAINNET, {
PartialClientConfig.api?: Partial<APIConfig> | undefinedapi: { apiKey?: string | undefinedapiKey:
const process: {
    env: Record<string, string>;
}
process
.env: Record<string, string>env.stringNOSANA_API_KEY,
}, });

For the API, set your API key:

bash
export NOSANA_API_KEY="nos_xxx_your_api_key"

List Deployments ​

ts
const { const deployments: ApiDeployment[]deployments } = await const client: NosanaClientclient.NosanaClient.api: NosanaApiClientapi.deployments: DeploymentsApi | ApiDeploymentsApideployments.list: (searchParams?: DeploymentsSearchParams) => Promise<ApiDeploymentListResult>list();

Get a Deployment ​

ts
const const deployment: ApiDeploymentdeployment = await const client: NosanaClientclient.NosanaClient.api: NosanaApiClientapi.deployments: DeploymentsApi | ApiDeploymentsApideployments.get: (deployment: string) => Promise<ApiDeployment>get('YOUR_DEPLOYMENT_ID');

Get a Deployment Job ​

Fetch a single job belonging to a deployment. The returned job carries the node job API (ssh, terminal, definition, logs, …) attached — authorized by the deployment manager signing on the deployment's behalf, so it works without a local wallet. Throws if the job has no assigned node yet.

ts
const const deployment: ApiDeploymentdeployment = await const client: NosanaClientclient.NosanaClient.api: NosanaApiClientapi.deployments: DeploymentsApi | ApiDeploymentsApideployments.get: (deployment: string) => Promise<ApiDeployment>get('YOUR_DEPLOYMENT_ID');
const const job: DeploymentNodeJobjob = await const deployment: ApiDeploymentdeployment.getJob: (job: string) => Promise<DeploymentNodeJob>
One of the deployment's jobs, with the node job API (`ssh`, `terminal`, `definition`, `logs`, …) attached — authorized by the deployment manager signing on the deployment's behalf, so `(await getJob(id)).ssh.add(key)` works without a local wallet.
getJob
('YOUR_JOB_ID');
// Stream the job's task logs (history first, then live). `logs()` returns a // subscription; call close() when you're done. const const logs: StreamSubscriptionlogs = const job: DeploymentNodeJobjob.NodeJobApi.logs(handlers: NodeStreamHandlers<NodeTaskLog>, filter?: NodeLogsFilter, options?: NodeSocketOptions): NodeStreamSubscription
Task manager logs over WebSocket: history first, then live.
logs
({
NodeStreamHandlers<{ opId: string; group: string; type: string; timestamp: number; message: unknown; }>.onData: (data: {
    opId: string;
    group: string;
    type: string;
    timestamp: number;
    message: unknown;
}) => void
onData
: (
log: {
    opId: string;
    group: string;
    type: string;
    timestamp: number;
    message: unknown;
}
log
) => var console: Console
The `console` module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers. The module exports two specific components: * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstdout) and [`process.stderr`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. _**Warning**_: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v24.x/api/process.html#a-note-on-process-io) for more information. Example using the global `console`: ```js console.log('hello world'); // Prints: hello world, to stdout console.log('hello %s', 'world'); // Prints: hello world, to stdout console.error(new Error('Whoops, something bad happened')); // Prints error message and stack trace to stderr: // Error: Whoops, something bad happened // at [eval]:5:15 // at Script.runInThisContext (node:vm:132:18) // at Object.runInThisContext (node:vm:309:38) // at node:internal/process/execution:77:19 // at [eval]-wrapper:6:22 // at evalScript (node:internal/process/execution:76:60) // at node:internal/main/eval_string:23:3 const name = 'Will Robinson'; console.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ``` Example using the `Console` class: ```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err); myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err const name = 'Will Robinson'; myConsole.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```
@see[source](https://github.com/nodejs/node/blob/v24.x/lib/console.js)
console
.Console.log(message?: any, ...optionalParams: any[]): void (+1 overload)
Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args)). ```js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout ``` See [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args) for more information.
@sincev0.1.100
log
(`[${
log: {
    opId: string;
    group: string;
    type: string;
    timestamp: number;
    message: unknown;
}
log
.opId: stringopId}]`,
log: {
    opId: string;
    group: string;
    type: string;
    timestamp: number;
    message: unknown;
}
log
.message: unknownmessage),
StreamLifecycleHandlers.onError?: ((error: unknown) => void) | undefinedonError: (err: unknownerr) => var console: Console
The `console` module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers. The module exports two specific components: * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstdout) and [`process.stderr`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. _**Warning**_: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v24.x/api/process.html#a-note-on-process-io) for more information. Example using the global `console`: ```js console.log('hello world'); // Prints: hello world, to stdout console.log('hello %s', 'world'); // Prints: hello world, to stdout console.error(new Error('Whoops, something bad happened')); // Prints error message and stack trace to stderr: // Error: Whoops, something bad happened // at [eval]:5:15 // at Script.runInThisContext (node:vm:132:18) // at Object.runInThisContext (node:vm:309:38) // at node:internal/process/execution:77:19 // at [eval]-wrapper:6:22 // at evalScript (node:internal/process/execution:76:60) // at node:internal/main/eval_string:23:3 const name = 'Will Robinson'; console.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ``` Example using the `Console` class: ```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err); myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err const name = 'Will Robinson'; myConsole.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```
@see[source](https://github.com/nodejs/node/blob/v24.x/lib/console.js)
console
.Console.error(message?: any, ...optionalParams: any[]): void (+1 overload)
Prints to `stderr` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args)). ```js const code = 5; console.error('error #%d', code); // Prints: error #5, to stderr console.error('error', code); // Prints: error 5, to stderr ``` If formatting elements (e.g. `%d`) are not found in the first string then [`util.inspect()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilinspectobject-options) is called on each argument and the resulting string values are concatenated. See [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args) for more information.
@sincev0.1.100
error
('log stream error:', err: unknownerr),
}); // …later const logs: StreamSubscriptionlogs.close: () => voidclose(); // Connect over SSH: authorize a public key, then print the ready-to-run command. await const job: DeploymentNodeJobjob.NodeJobApi.ssh: NodeJobSshssh.NodeJobSsh.add(publicKey: string, options?: NodeSshAddKeyOptions): Promise<NodeSshAuthorization>add('ssh-ed25519 AAAA... you@laptop'); const const ssh: SshConnectionDescriptorssh = const job: DeploymentNodeJobjob.NodeJobApi.ssh: NodeJobSshssh.NodeJobSsh.command(options?: SshCommandOptions): SshConnectionDescriptor
The `ssh` command that reaches the job; `identityFile` picks the private key to connect with.
command
({ SshCommandOptions.identityFile?: string | undefined
The private key to connect with, passed to `ssh -i`.
identityFile
: '~/.ssh/id_ed25519' });
var console: Console
The `console` module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers. The module exports two specific components: * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstdout) and [`process.stderr`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. _**Warning**_: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v24.x/api/process.html#a-note-on-process-io) for more information. Example using the global `console`: ```js console.log('hello world'); // Prints: hello world, to stdout console.log('hello %s', 'world'); // Prints: hello world, to stdout console.error(new Error('Whoops, something bad happened')); // Prints error message and stack trace to stderr: // Error: Whoops, something bad happened // at [eval]:5:15 // at Script.runInThisContext (node:vm:132:18) // at Object.runInThisContext (node:vm:309:38) // at node:internal/process/execution:77:19 // at [eval]-wrapper:6:22 // at evalScript (node:internal/process/execution:76:60) // at node:internal/main/eval_string:23:3 const name = 'Will Robinson'; console.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ``` Example using the `Console` class: ```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err); myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err const name = 'Will Robinson'; myConsole.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```
@see[source](https://github.com/nodejs/node/blob/v24.x/lib/console.js)
console
.Console.log(message?: any, ...optionalParams: any[]): void (+1 overload)
Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args)). ```js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout ``` See [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args) for more information.
@sincev0.1.100
log
(const ssh: SshConnectionDescriptorssh.SshConnectionDescriptor.formattedCommand: string
The full command, shell-quoted for copy and paste.
formattedCommand
);

The job carries the same node job API as jobs.get — inspect operations, stream stats, restart or stop operations, collect results, and open a terminal, all on the returned object.

Update Job Definition (Create a Revision) ​

Create a new revision of the job definition for an existing deployment:

ts
const const deployment: ApiDeploymentdeployment = await const client: NosanaClientclient.NosanaClient.api: NosanaApiClientapi.deployments: DeploymentsApi | ApiDeploymentsApideployments.get: (deployment: string) => Promise<ApiDeployment>get('YOUR_DEPLOYMENT_ID');

await const deployment: ApiDeploymentdeployment.createRevision: (jobDefinition: JobDefinition) => Promise<void>createRevision({
  version: stringversion: '0.1',
  type?: string | undefined
@deprecatedThe execution environment is no longer derived from the job definition — it is the node operator's `--vm`/`--cvm` choice. Retained as an optional, unvalidated field so type-less jobs and legacy jobs still carrying `'container' | 'vm' | 'cvm'` continue to validate. Do not read it.
type
: 'container',
meta?: Meta | undefinedmeta: { trigger?: string | undefinedtrigger: 'api' }, ops: Opsops: [ { type: keyof OperationArgsMaptype: 'container/run', id: OperationIdid: 'hello-world', args: ContainerRun | ContainerCreateVolume | VmRunArgsargs: { cmd: stringcmd: 'echo hello world v2', image: stringimage: 'ubuntu', }, }, ], });

The body should contain a job_definition matching the structure described in the job definition docs.

Update Replica Count ​

ts
const const deployment: ApiDeploymentdeployment = await const client: NosanaClientclient.NosanaClient.api: NosanaApiClientapi.deployments: DeploymentsApi | ApiDeploymentsApideployments.get: (deployment: string) => Promise<ApiDeployment>get('YOUR_DEPLOYMENT_ID');
await const deployment: ApiDeploymentdeployment.updateReplicaCount: (replicas: number) => Promise<void>updateReplicaCount(3);

Update Schedule (SCHEDULED Strategy Only) ​

ts
const const deployment: ApiDeploymentdeployment = await const client: NosanaClientclient.NosanaClient.api: NosanaApiClientapi.deployments: DeploymentsApi | ApiDeploymentsApideployments.get: (deployment: string) => Promise<ApiDeployment>get('YOUR_DEPLOYMENT_ID');
await const deployment: ApiDeploymentdeployment.updateSchedule: (schedule: string) => Promise<void>updateSchedule('0 0 * * *'); // daily at midnight

Note: The schedule only applies to deployments using the SCHEDULED strategy.
For cron syntax examples, see Deployment Strategies.

Update Timeout ​

ts
const const deployment: ApiDeploymentdeployment = await const client: NosanaClientclient.NosanaClient.api: NosanaApiClientapi.deployments: DeploymentsApi | ApiDeploymentsApideployments.get: (deployment: string) => Promise<ApiDeployment>get('YOUR_DEPLOYMENT_ID');
await const deployment: ApiDeploymentdeployment.updateTimeout: (timeout: number) => Promise<void>updateTimeout(120); // minutes

Update Market ​

Move a deployment to a different market. If the deployment is RUNNING, its current jobs are stopped and relisted on the new market: SIMPLE and SIMPLE-EXTEND relist the stopped count immediately, INFINITE refills each stopped replica, and SCHEDULED lists on its next scheduled run.

ts
const const deployment: ApiDeploymentdeployment = await const client: NosanaClientclient.NosanaClient.api: NosanaApiClientapi.deployments: DeploymentsApi | ApiDeploymentsApideployments.get: (deployment: string) => Promise<ApiDeployment>get('YOUR_DEPLOYMENT_ID');
await const deployment: ApiDeploymentdeployment.updateMarket: (market: string) => Promise<void>updateMarket('NEW_MARKET_ADDRESS');

Update Requirements ​

Replace the node requirements a deployment's jobs are reserved on, or pass null to clear them, together with the market that serves them. A number is a minimum, a string or boolean must match exactly, and a list is any of its values; see GPUs & Requirements for the metrics you can set. Every job listed from now on is reserved on a node that meets the new requirements.

The market works as when creating a deployment. Leave it out to post across markets: each job goes to the cheapest PREMIUM market with a node that meets the requirements. Pass a market to pin every job to it. Running jobs keep their hosts unless the market changes to another one: then a RUNNING deployment's jobs move to it as they do with Update Market.

ts
const const deployment: ApiDeploymentdeployment = await const client: NosanaClientclient.NosanaClient.api: NosanaApiClientapi.deployments: DeploymentsApi | ApiDeploymentsApideployments.get: (deployment: string) => Promise<ApiDeployment>get('YOUR_DEPLOYMENT_ID');
// either GPU, in whichever premium market has a matching host, cheapest first
await const deployment: ApiDeploymentdeployment.updateRequirements: (requirements: DeploymentState["requirements"], market?: string | null) => Promise<void>
Replace the node requirements, or clear them with null, together with the market that serves them. Omit the market (or pass null) to post across markets: each job goes to the cheapest PREMIUM market with a node that meets the requirements.
updateRequirements
({
name: string[]name: ['NVIDIA GeForce RTX 4090', 'NVIDIA GeForce RTX 5090'], ram_gb: numberram_gb: 64, country: stringcountry: 'NL', }); // pinned to one market await const deployment: ApiDeploymentdeployment.updateRequirements: (requirements: DeploymentState["requirements"], market?: string | null) => Promise<void>
Replace the node requirements, or clear them with null, together with the market that serves them. Omit the market (or pass null) to post across markets: each job goes to the cheapest PREMIUM market with a node that meets the requirements.
updateRequirements
({ name: stringname: 'NVIDIA GeForce RTX 5090' }, 'MARKET_ADDRESS');

Start a Deployment ​

Start an existing deployment that is in a draft or stopped state:

ts
const const deployment: ApiDeploymentdeployment = await const client: NosanaClientclient.NosanaClient.api: NosanaApiClientapi.deployments: DeploymentsApi | ApiDeploymentsApideployments.get: (deployment: string) => Promise<ApiDeployment>get('YOUR_DEPLOYMENT_ID');
await const deployment: ApiDeploymentdeployment.start: () => Promise<void>start();

Stop a Deployment ​

Stop a running deployment:

ts
const const deployment: ApiDeploymentdeployment = await const client: NosanaClientclient.NosanaClient.api: NosanaApiClientapi.deployments: DeploymentsApi | ApiDeploymentsApideployments.get: (deployment: string) => Promise<ApiDeployment>get('YOUR_DEPLOYMENT_ID');
await const deployment: ApiDeploymentdeployment.stop: () => Promise<void>stop();

The response will contain a status (for example "STOPPING") and an updated_at timestamp.

Archive a Deployment ​

Archive a deployment to remove it from your active list while keeping history:

ts
const const deployment: ApiDeploymentdeployment = await const client: NosanaClientclient.NosanaClient.api: NosanaApiClientapi.deployments: DeploymentsApi | ApiDeploymentsApideployments.get: (deployment: string) => Promise<ApiDeployment>get('YOUR_DEPLOYMENT_ID');
await const deployment: ApiDeploymentdeployment.archive: () => Promise<void>archive();

The response will include status: "ARCHIVED" when successful.

Duplicate a Deployment ​

Create a copy of an existing deployment. The copy shares the source's vault, replicas, timeout, strategy, confidentiality and SSH keys, and starts from the source's active revision as its first revision. It is named "<source name> (copy)" unless name is given, and runs on the source's market unless market is given. It is created as a DRAFT unless autostart is set. The source deployment is left untouched. The body is optional.

ts
const const deployment: ApiDeploymentdeployment = await const client: NosanaClientclient.NosanaClient.api: NosanaApiClientapi.deployments: DeploymentsApi | ApiDeploymentsApideployments.get: (deployment: string) => Promise<ApiDeployment>get('YOUR_DEPLOYMENT_ID');
const const copy: ApiDeploymentcopy = await const deployment: ApiDeploymentdeployment.duplicate: (options?: DeploymentDuplicateOptions) => Promise<ApiDeployment>
Copy this deployment into a new one; the source is left untouched.
duplicate
({ name?: string | undefined
@descriptionName for the new deployment. Defaults to "<source name> (copy)".
name
: 'my-copy' }); // new DRAFT deployment
// pass `market` to run the copy on a different market, or omit the options entirely await const copy: ApiDeploymentcopy.start: () => Promise<void>start(); // the copy is a full deployment object

The response is the new deployment. In the SDK, duplicate() returns a full deployment object with the same methods as get(), so you can call start(), updateReplicaCount(), stream() and so on directly on the copy. Pass autostart: true to have the API start it for you instead, and market to place the copy on a different market than the source.

Manage SSH Keys ​

Grant or revoke SSH access to a deployment's jobs. Keys are stored on the deployment (no new revision or restart) and injected into every job posted from then on. Running jobs are updated in place where their node allows it; a removed key stops working on a running job only when that job restarts.

ts
const const deployment: ApiDeploymentdeployment = await const client: NosanaClientclient.NosanaClient.api: NosanaApiClientapi.deployments: DeploymentsApi | ApiDeploymentsApideployments.get: (deployment: string) => Promise<ApiDeployment>get('YOUR_DEPLOYMENT_ID');
const const publicKey: "ssh-ed25519 AAAA... [email protected]"publicKey = 'ssh-ed25519 AAAA... [email protected]';

const { 
const jobs: {
    job: string;
    node: string;
    status: "authorized" | "revoked" | "failed";
    error?: string;
}[]
jobs
} = await const deployment: ApiDeploymentdeployment.ssh: DeploymentSshssh.add: (publicKeys: string | string[]) => Promise<DeploymentSshKeysResult>
Grant one or more OpenSSH public keys access. Keys already present are left as they are: a key is identified by its type and material, so a differing comment does not add it twice.
add
(const publicKey: "ssh-ed25519 AAAA... [email protected]"publicKey); // per running job: did its node accept the key?
const const keys: string[]keys = await const deployment: ApiDeploymentdeployment.ssh: DeploymentSshssh.keys: () => Promise<string[]>
The SSH public keys currently granted access to the deployment's jobs.
keys
(); // now includes publicKey
await const deployment: ApiDeploymentdeployment.ssh: DeploymentSshssh.remove: (publicKeys: string | string[]) => Promise<DeploymentSshKeysResult>
Revoke one or more OpenSSH public keys. A key is identified by its type and material, so a differing comment still revokes it; access is removed from every running job at once, not only when a job restarts.
remove
(const publicKey: "ssh-ed25519 AAAA... [email protected]"publicKey);

add and remove accept one key or a list, and identify a key by its type and material, so a differing comment neither adds a duplicate nor misses a removal. Both return the stored set plus jobs, one entry per running job, saying whether its node accepted the change. The HTTP API replaces the whole set in one call.

Pipe Multiple Deployment Operations (SDK Only) ​

The pipe function allows you to chain multiple actions on a deployment in a functional programming style. It can either create a new deployment or operate on an existing one.

ts
// Create and execute multiple actions in sequence
const const deployment: ApiDeploymentdeployment = await const client: NosanaClientclient.NosanaClient.api: NosanaApiClientapi.deployments: DeploymentsApi | ApiDeploymentsApideployments.pipe: (deploymentIDorCreateObject: string | CreateDeployment, ...actions: Array<(deployment: ApiDeployment) => Promise<void> | void>) => Promise<ApiDeployment>pipe(
  {
    name: stringname: 'My Application',
    market?: string | undefined
@descriptionMarket to post every job in. Omit to post across markets: each job goes to the cheapest PREMIUM market with a node that meets `requirements`.
market
: '7AtiXMSH6R1jjBxrcYjehCkkSF7zvYWte63gwEDBcGHq',
replicas: numberreplicas: 3, timeout: number
@descriptionTimeout in minutes, must be at least 1 minute.@descriptionTimeout in minutes, must be at least 60 minute.
timeout
: 300,
strategy: "SIMPLE" | "SIMPLE-EXTEND" | "SCHEDULED" | "INFINITE"
@enum@enum
strategy
: 'SIMPLE',
job_definition: JobDefinitionjob_definition: { version: stringversion: '0.1', type?: string | undefined
@deprecatedThe execution environment is no longer derived from the job definition — it is the node operator's `--vm`/`--cvm` choice. Retained as an optional, unvalidated field so type-less jobs and legacy jobs still carrying `'container' | 'vm' | 'cvm'` continue to validate. Do not read it.
type
: 'container',
meta?: Meta | undefinedmeta: { trigger?: string | undefinedtrigger: 'api' }, ops: Opsops: [ { type: keyof OperationArgsMaptype: 'container/run', id: OperationIdid: 'my-application', args: ContainerRun | ContainerCreateVolume | VmRunArgsargs: { cmd: stringcmd: 'echo hello world', image: stringimage: 'ubuntu', }, }, ], }, }, async (deployment: ApiDeploymentdeployment) => { var console: Console
The `console` module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers. The module exports two specific components: * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstdout) and [`process.stderr`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. _**Warning**_: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v24.x/api/process.html#a-note-on-process-io) for more information. Example using the global `console`: ```js console.log('hello world'); // Prints: hello world, to stdout console.log('hello %s', 'world'); // Prints: hello world, to stdout console.error(new Error('Whoops, something bad happened')); // Prints error message and stack trace to stderr: // Error: Whoops, something bad happened // at [eval]:5:15 // at Script.runInThisContext (node:vm:132:18) // at Object.runInThisContext (node:vm:309:38) // at node:internal/process/execution:77:19 // at [eval]-wrapper:6:22 // at evalScript (node:internal/process/execution:76:60) // at node:internal/main/eval_string:23:3 const name = 'Will Robinson'; console.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ``` Example using the `Console` class: ```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err); myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err const name = 'Will Robinson'; myConsole.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```
@see[source](https://github.com/nodejs/node/blob/v24.x/lib/console.js)
console
.Console.log(message?: any, ...optionalParams: any[]): void (+1 overload)
Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args)). ```js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout ``` See [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args) for more information.
@sincev0.1.100
log
('Starting deployment');
await deployment: ApiDeploymentdeployment.start: () => Promise<void>start(); }, async (deployment: ApiDeploymentdeployment) => { var console: Console
The `console` module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers. The module exports two specific components: * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstdout) and [`process.stderr`](https://nodejs.org/docs/latest-v24.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. _**Warning**_: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v24.x/api/process.html#a-note-on-process-io) for more information. Example using the global `console`: ```js console.log('hello world'); // Prints: hello world, to stdout console.log('hello %s', 'world'); // Prints: hello world, to stdout console.error(new Error('Whoops, something bad happened')); // Prints error message and stack trace to stderr: // Error: Whoops, something bad happened // at [eval]:5:15 // at Script.runInThisContext (node:vm:132:18) // at Object.runInThisContext (node:vm:309:38) // at node:internal/process/execution:77:19 // at [eval]-wrapper:6:22 // at evalScript (node:internal/process/execution:76:60) // at node:internal/main/eval_string:23:3 const name = 'Will Robinson'; console.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ``` Example using the `Console` class: ```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err); myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err const name = 'Will Robinson'; myConsole.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```
@see[source](https://github.com/nodejs/node/blob/v24.x/lib/console.js)
console
.Console.log(message?: any, ...optionalParams: any[]): void (+1 overload)
Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args)). ```js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout ``` See [`util.format()`](https://nodejs.org/docs/latest-v24.x/api/util.html#utilformatformat-args) for more information.
@sincev0.1.100
log
('Updating replicas');
await deployment: ApiDeploymentdeployment.updateReplicaCount: (replicas: number) => Promise<void>updateReplicaCount(5); }, ); // Or operate on an existing deployment const const existing: ApiDeploymentexisting = await const client: NosanaClientclient.NosanaClient.api: NosanaApiClientapi.deployments: DeploymentsApi | ApiDeploymentsApideployments.pipe: (deploymentIDorCreateObject: string | CreateDeployment, ...actions: Array<(deployment: ApiDeployment) => Promise<void> | void>) => Promise<ApiDeployment>pipe( 'existing-deployment-id', async (deployment: ApiDeploymentdeployment) => { await deployment: ApiDeploymentdeployment.start: () => Promise<void>start(); }, async (deployment: ApiDeploymentdeployment) => { await deployment: ApiDeploymentdeployment.stop: () => Promise<void>stop(); }, );

This example gets a deployment, updates its replica count and timeout, and then starts it in one composed call.

Full API Reference ​

For all deployment endpoints and fields, consult the API Swagger reference.