Skip to navigation

Send input to a background command

Writes data to the stdin of a running background command. The command must have been started with stdin: true. Set close to true to end the input, so the command sees end of file. Read the reply with GET /v1/sandboxes/{sandbox_id}/execs/{exec_id} and wait_seconds.

Use this to talk to a program that reads stdin and writes stdout, such as an agent CLI in a line-based JSON mode or an MCP server on stdio.

Rules:

  • data is at most 512 KiB per call. Send more in several calls.
  • Include the newline when the command reads lines.
  • data may hold any text, including a NUL character.
  • Writes to one command are applied one at a time. A write that arrives while another is in progress waits for it, and can return 409. Retry it.
  • A call with neither data nor close returns 204 and writes nothing.

Scope: sandboxes.

Authentication

AuthorizationBearer

A Meadow API key, sent as Authorization: Bearer mdw_.... The header x-api-key: mdw_... is accepted in its place.

Path parameters

sandbox_idstringRequired

The sandbox id returned by POST /v1/sandboxes. It must belong to the key’s project.

exec_idstringRequired

The id returned when the background command was started.

Request

At most 1 MiB.
datastringOptional
Text to write, at most 512 KiB. Include the newline if the command reads lines.
closebooleanOptionalDefaults to false

End the input after writing data. Stdin cannot be reopened.

Response

Written. No body.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
409
Conflict Error
413
Content Too Large Error
429
Too Many Requests Error
500
Internal Server Error
502
Bad Gateway Error