Clipboard Read
curl --request POST \
--url https://api.example.com/browser/sessions/{id}/clipboard/readimport requests
url = "https://api.example.com/browser/sessions/{id}/clipboard/read"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/browser/sessions/{id}/clipboard/read', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/browser/sessions/{id}/clipboard/read",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/browser/sessions/{id}/clipboard/read"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/browser/sessions/{id}/clipboard/read")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/browser/sessions/{id}/clipboard/read")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"text": "<string>",
"bytes": 123,
"truncated": true
}Clipboard
Clipboard Read
Read the current clipboard contents from the session’s sandbox OS clipboard.
POST
/
browser
/
sessions
/
{id}
/
clipboard
/
read
Clipboard Read
curl --request POST \
--url https://api.example.com/browser/sessions/{id}/clipboard/readimport requests
url = "https://api.example.com/browser/sessions/{id}/clipboard/read"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/browser/sessions/{id}/clipboard/read', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/browser/sessions/{id}/clipboard/read",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/browser/sessions/{id}/clipboard/read"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/browser/sessions/{id}/clipboard/read")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/browser/sessions/{id}/clipboard/read")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"text": "<string>",
"bytes": 123,
"truncated": true
}Overview
Reads whatever is currently on the sandbox OS clipboard of a browser session. Returns an empty string when the clipboard is empty. Useful for verifying what a page copied, or for chaining clipboard-driven flows. This endpoint usesPOST with no body so the action is not cached by intermediaries.
Path Parameters
string
required
Browser session ID (UUID).
Example Request
curl -X POST "https://api.scrapengine.io/api/v1/browser/sessions/baa3f390-fa6e-4a24-b84a-a575a5f3a9c7/clipboard/read" \
-H "Authorization: Bearer $SCRAPENGINE_API_KEY"
import os, requests
response = requests.post(
"https://api.scrapengine.io/api/v1/browser/sessions/baa3f390-fa6e-4a24-b84a-a575a5f3a9c7/clipboard/read",
headers={"Authorization": f"Bearer {os.environ['SCRAPENGINE_API_KEY']}"},
)
data = response.json()
Response
Success Response (200)
string
Current clipboard text. Empty string when the clipboard is empty.
integer
Number of bytes returned (UTF-8 encoded length of
text).boolean
True when the clipboard content exceeded the maximum read size and was truncated.
{
"text": "hello world",
"bytes": 11,
"truncated": false
}
Error Responses
| Status | Description |
|---|---|
401 | Unauthorized — invalid or missing API key. |
404 | Session not found or not owned by the caller. |
Was this page helpful?