Clipboard Paste
curl --request POST \
--url https://api.example.com/browser/sessions/{id}/clipboard/paste \
--header 'Content-Type: application/json' \
--data '
{
"selector": "<string>",
"text": "<string>"
}
'import requests
url = "https://api.example.com/browser/sessions/{id}/clipboard/paste"
payload = {
"selector": "<string>",
"text": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({selector: '<string>', text: '<string>'})
};
fetch('https://api.example.com/browser/sessions/{id}/clipboard/paste', 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/paste",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'selector' => '<string>',
'text' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/browser/sessions/{id}/clipboard/paste"
payload := strings.NewReader("{\n \"selector\": \"<string>\",\n \"text\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
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/paste")
.header("Content-Type", "application/json")
.body("{\n \"selector\": \"<string>\",\n \"text\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/browser/sessions/{id}/clipboard/paste")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"selector\": \"<string>\",\n \"text\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true
}Clipboard
Clipboard Paste
Dispatch a real Ctrl+V paste event into a selector or the currently focused element.
POST
/
browser
/
sessions
/
{id}
/
clipboard
/
paste
Clipboard Paste
curl --request POST \
--url https://api.example.com/browser/sessions/{id}/clipboard/paste \
--header 'Content-Type: application/json' \
--data '
{
"selector": "<string>",
"text": "<string>"
}
'import requests
url = "https://api.example.com/browser/sessions/{id}/clipboard/paste"
payload = {
"selector": "<string>",
"text": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({selector: '<string>', text: '<string>'})
};
fetch('https://api.example.com/browser/sessions/{id}/clipboard/paste', 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/paste",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'selector' => '<string>',
'text' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/browser/sessions/{id}/clipboard/paste"
payload := strings.NewReader("{\n \"selector\": \"<string>\",\n \"text\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
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/paste")
.header("Content-Type", "application/json")
.body("{\n \"selector\": \"<string>\",\n \"text\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/browser/sessions/{id}/clipboard/paste")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"selector\": \"<string>\",\n \"text\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true
}Overview
Pastes into the page by dispatching a native Ctrl+V keystroke (Cmd+V on macOS targets) against the session. Ifselector is provided the target element is focused first; otherwise the keystroke is delivered to whatever element is currently focused. If text is provided it is placed on the clipboard immediately before the paste event fires, so this endpoint can both set and paste in a single call.
Path Parameters
string
required
Browser session ID (UUID).
Body
string
CSS selector of the element to paste into. Defaults to the currently focused element.
string
Optional text to place on the clipboard right before pasting. Maximum 1 MiB.
Example Request
curl -X POST "https://api.scrapengine.io/api/v1/browser/sessions/baa3f390-fa6e-4a24-b84a-a575a5f3a9c7/clipboard/paste" \
-H "Authorization: Bearer $SCRAPENGINE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"selector": "#comment-input",
"text": "hello world"
}'
curl -X POST "https://api.scrapengine.io/api/v1/browser/sessions/baa3f390-fa6e-4a24-b84a-a575a5f3a9c7/clipboard/paste" \
-H "Authorization: Bearer $SCRAPENGINE_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
Response
Success Response (200)
boolean
True when the paste event was dispatched.
{
"success": true
}
Error Responses
| Status | Description |
|---|---|
400 | Invalid body — selector didn’t match, or text exceeded 1 MiB. |
401 | Unauthorized — invalid or missing API key. |
404 | Session not found or not owned by the caller. |
Was this page helpful?
⌘I