dots.v2.microvms.byMicrovm_id().exec.post()

Generated on 13 Nov 2026 from DoTs version v1.24.0

Usage

client.v2.microvms.byMicrovm_id(microvm_id).exec.post(body: Exec_request, requestConfiguration?: RequestConfiguration<object>): Promise<undefined | Exec_response>

Description

To run a command in a MicroVM’s workload container, send a POST request to /v2/microvms/{microvm_id}/exec.

argv runs directly, not through a shell, with standard input closed. If the MicroVM is paused and auto-resume is on, the request resumes it and waits until it is running.

A command has 60 seconds to finish. Your team can run 32 commands at once and 60 commands per minute. Rejected requests count toward the per-minute limit.

Parameters

Path Parameters

microvm_id string required

Example: 01a0ef1a-d873-793d-ae6a-5dd6239be62a

The unique ID of the MicroVM.

Request Body

argv array of strings required

Example: ["nginx", "-v"]

The command and its arguments.

cwd string optional

Example: /usr/share/nginx/html

The working directory to run the command in.

outputEncoding string optional

How stdout and stderr are returned. utf-8 (the default) is a JSON string; bytes that are not valid UTF-8 become U+FFFD. base64 returns the exact bytes. Use base64 when the command may emit binary output.

One of: utf-8, base64

Default: utf-8

Request Sample

Show Request Sample
import { FetchRequestAdapter } from "@microsoft/kiota-http-fetchlibrary";
import {
    createDigitalOceanClient,
    DigitalOceanApiKeyAuthenticationProvider,
} from "@digitalocean/dots";

const authProvider = new DigitalOceanApiKeyAuthenticationProvider(process.env.DIGITALOCEAN_TOKEN!);
const adapter = new FetchRequestAdapter(authProvider);
const client = createDigitalOceanClient(adapter);

const response = await client.v2.microvms
    .byMicrovm_id("01a0ef1a-d873-793d-ae6a-5dd6239be62a").exec.post({
    argv: [
        "nginx",
        "-v",
    ],
});

Response Example

Show Response Example
{
  "stdout": "",
  "stderr": "nginx version: nginx/1.29.1\n",
  "exit_code": 0
}

More Information

See /v2/microvms/{microvm_id}/exec in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.