> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrapengine.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Clipboard Write

> Write UTF-8 text to the session's sandbox OS clipboard. Survives navigation and works before any page is loaded.

## Overview

Places UTF-8 text on the operating system clipboard inside the session's sandbox. The value survives navigation, tab switches, and page reloads, and can be written before any page has loaded. Maximum payload is 1 MiB, measured as UTF-8 byte length.

## Path Parameters

<ParamField path="id" type="string" required={true}>
  Browser session ID (UUID). Create via `POST /browser/sessions`.
</ParamField>

## Body

<ParamField body="text" type="string" required={true}>
  UTF-8 text to place on the session clipboard. Maximum 1 MiB (1,048,576 bytes).
</ParamField>

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.scrapengine.io/api/v1/browser/sessions/baa3f390-fa6e-4a24-b84a-a575a5f3a9c7/clipboard/write" \
    -H "Authorization: Bearer $SCRAPENGINE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "text": "hello world"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.scrapengine.io/api/v1/browser/sessions/baa3f390-fa6e-4a24-b84a-a575a5f3a9c7/clipboard/write",
    {
      method: "POST",
      headers: {
        "Authorization": `Bearer ${process.env.SCRAPENGINE_API_KEY}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ text: "hello world" }),
    },
  );
  const data = await response.json();
  ```
</CodeGroup>

## Response

### Success Response (200)

<ResponseField name="success" type="boolean">
  True when the clipboard contents were replaced successfully.
</ResponseField>

<ResponseField name="bytes" type="integer">
  Number of bytes written (UTF-8 encoded length of `text`).
</ResponseField>

**Example Response:**

```json theme={null}
{
  "success": true,
  "bytes": 11
}
```

### Error Responses

| Status | Description                                                    |
| ------ | -------------------------------------------------------------- |
| `400`  | Invalid body — `text` missing, not a string, or exceeds 1 MiB. |
| `401`  | Unauthorized — invalid or missing API key.                     |
| `404`  | Session not found or not owned by the caller.                  |
