Docs
Desktop ›

Set desktop clipboard

PUT/v1/sandboxes/{id}/desktop/clipboard

Puts text on the clipboard of the sandbox's desktop, in place of what was on it, for a paste there to take. It pastes nothing: POST /v1/sandboxes/{id}/desktop/key with ctrl+v does, where the keyboard's focus is. Up to 1000000 bytes of UTF-8, which is pasted at once where POST /desktop/type would type about a hundred characters a second.

RequestTypeScript
  1. import { Agental } from "agental-sdk";
  2. const agental = new Agental();
  3. const sandbox = await agental.sandboxes.get("sbx_2a9a47e50daec64a");
  4. await sandbox.desktop.setClipboard("hello");
Answer204 No Content

No body: the status says it was done.

The text is on the clipboard.

Path

idrequired
string
e.g. "sbx_0123456789abcdef"

Headers

Authorizationrequired
Bearer key
An API key that may make this call.

Body

textrequired
string
e.g. "a long text to paste"

Returns

204 The text is on the clipboard.

Errors and other answers

400invalid_request text is missing, or is more than 1000000 bytes of UTF-8.
404 Not found.
409 sandbox_not_running, or
409desktop_not_running no desktop is turned on for the sandbox, or it is turned on and is not running yet, as in the moments after a start. PUT /v1/sandboxes/{id}/desktop turns it on, and starts one that ended.
501desktop_not_configured sandboxes here have no desktop. GET /v1/policy says so as desktop.

Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.