Skip to main content
POST
/
browsers
/
{id}
/
curl
JavaScript
import Kernel from '@onkernel/sdk';

const client = new Kernel({
  apiKey: process.env['KERNEL_API_KEY'], // This is the default and can be omitted
});

const response = await client.browsers.curl('id', { url: 'url' });

console.log(response.body);
import os
from kernel import Kernel

client = Kernel(
api_key=os.environ.get("KERNEL_API_KEY"), # This is the default and can be omitted
)
response = client.browsers.curl(
id="id",
url="url",
)
print(response.body)
package main

import (
"context"
"fmt"

"github.com/kernel/kernel-go-sdk"
"github.com/kernel/kernel-go-sdk/option"
)

func main() {
client := kernel.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Browsers.Curl(
context.TODO(),
"id",
kernel.BrowserCurlParams{
URL: "url",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Body)
}
curl --request POST \
--url https://api.onkernel.com/browsers/{id}/curl \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"method": "GET",
"headers": {},
"body": "<string>",
"timeout_ms": 30000,
"response_encoding": "utf8"
}
'
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.onkernel.com/browsers/{id}/curl",
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([
'url' => '<string>',
'method' => 'GET',
'headers' => [

],
'body' => '<string>',
'timeout_ms' => 30000,
'response_encoding' => 'utf8'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
HttpResponse<String> response = Unirest.post("https://api.onkernel.com/browsers/{id}/curl")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"method\": \"GET\",\n \"headers\": {},\n \"body\": \"<string>\",\n \"timeout_ms\": 30000,\n \"response_encoding\": \"utf8\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.onkernel.com/browsers/{id}/curl")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"method\": \"GET\",\n \"headers\": {},\n \"body\": \"<string>\",\n \"timeout_ms\": 30000,\n \"response_encoding\": \"utf8\"\n}"

response = http.request(request)
puts response.read_body
{
  "status": 123,
  "headers": {},
  "body": "<string>",
  "duration_ms": 123
}
{
"code": "bad_request",
"message": "Missing required field: app_name",
"details": [
{
"code": "invalid_input",
"message": "Provided version string is not semver compliant"
}
],
"inner_error": {
"code": "invalid_input",
"message": "Provided version string is not semver compliant"
}
}
{
"code": "bad_request",
"message": "Missing required field: app_name",
"details": [
{
"code": "invalid_input",
"message": "Provided version string is not semver compliant"
}
],
"inner_error": {
"code": "invalid_input",
"message": "Provided version string is not semver compliant"
}
}
{
"code": "bad_request",
"message": "Missing required field: app_name",
"details": [
{
"code": "invalid_input",
"message": "Provided version string is not semver compliant"
}
],
"inner_error": {
"code": "invalid_input",
"message": "Provided version string is not semver compliant"
}
}
{
"message": "<string>",
"net_error": 123,
"net_error_name": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

Browser session ID

Body

application/json

Request to make an HTTP request through the browser's network stack.

url
string
required

Target URL (must be http or https).

method
enum<string>
default:GET

HTTP method.

Available options:
GET,
HEAD,
POST,
PUT,
PATCH,
DELETE,
OPTIONS
headers
object

Custom headers merged with browser defaults.

body
string

Request body (for POST/PUT/PATCH).

timeout_ms
integer
default:30000

Request timeout in milliseconds.

Required range: 1000 <= x <= 60000
response_encoding
enum<string>
default:utf8

Encoding for the response body. Use base64 for binary content.

Available options:
utf8,
base64

Response

Response from target URL

Structured response from the browser curl request.

status
integer
required

HTTP status code from target.

headers
object
required

Response headers (multi-value).

body
string
required

Response body (UTF-8 string or base64 depending on request).

duration_ms
integer
required

Total request duration in milliseconds.