Skip to main content

Api

Start one time profile browser

One time profile browser doesn't save it's state after stop, you have to provide proxy on every start.

One time profile request

POST /profiles/one_time

Parameters

NameRequiredPlaceTypeDescription
X-Cloud-Api-TokentrueHeaderstrProvided api token
proxyfalseBodystrDescription
open_vpnfalseBodyobjectDescription
cookiesfalseBodylist of objectsDescription
fingerprintfalseBodyobjectDescription
browser_settingsfalseBodyobjectDescription

Proxy

About proxy and open vpn

Either proxy or open vpn might be provided but not both

Proxy as an url string, allowed schemes are ['http', 'https', 'socks5', 'ssh'] with or without auth that will be used by browser

info

Required: false

Position: body

Key:

proxy

Examples:

  • http proxy with auth
http://username:[email protected]:5555
  • http proxy without auth
http://1.1.1.1:5555
  • socks5 proxy with auth
socks5://username:[email protected]:5555
  • socks5 proxy without auth
socks5://1.1.1.1:5555
  • ssh proxy with auth
ssh://username:[email protected]:22
  • ssh proxy without auth
ssh://1.1.1.1:22

Request example:

curl -X 'POST' \
'<API_URL>/profiles/one_time' \
-H 'accept: application/json' \
-H 'x-cloud-api-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"proxy": "http://1.1.1.1:5555"
}'

OpenVPN

About proxy and open vpn

Either proxy or open vpn might be provided but not both

Object with openvpn config

info

Required: false

Position: body

Key:

open_vpn
FieldRequiredTypeDescription
configtruestringContent of .ovpn file
usernametruestringUsername will be used to connect to openvpn server
passwordtruestringPassword will be used to connect to openvpn server

Request example:

curl -X 'POST' \
'<API_URL>/profiles/one_time' \
-H 'accept: application/json' \
-H 'x-cloud-api-token: <API_TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"open_vpn": {"config": "config", "username": "username", "password": "password"}
}'

Cookies

Cookies that will be loaded in browser on start

info

Required: false

Position: body

Key:

cookies

Default:

null
JSON Cookies
[
{
"domain": ".google.com",
"expirationDate": 1639134293.313654,
"hostOnly": false,
"httpOnly": false,
"name": "1P_JAR",
"path": "/",
"sameSite": "no_restriction",
"secure": true,
"value": "2021-11-10-11"
}
]
Mozilla Cookies
[
{
"Path raw":"/",
"Samesite raw":"no_restriction",
"Name raw":"NID",
"Content raw":"2021-11-10-11",
"Expires raw":"1639134293",
"Host raw":"https://.google.com/",
"This domain only raw":"false",
"HTTP only raw":"false",
"Send for raw":"true"
}
]
Nescape Cookies:
some.host\tTRUE\t/\tTRUE\t123\tname\tvalue
some2.host\tTRUE\t/\tTRUE\t111\tname2\tvalue2

Fingerprint

Customize fingerprint that will be used in browser

info

Required: false

Position: body

Key:

fingerprint

Default:

{
"os": "win"
}
FieldTypeDescription
osString
enum: [win, mac]
Operation system will be used to generate profile data
Win Profile
{
"os": "win"
}
Mac Profile
{
"os": "mac"
}

Browser settings

Customize some browser settings

info

Required: false

Position: body

Key:

browser_settings

Default:

{
"inactive_kill_timeout": 30
}
FieldTypeDescription
inactive_kill_timeoutPositive IntegerIn case no requests to browser will be made during this period browser will be shut down

Example

import asyncio

import httpx

async def main():
headers = {"X-Cloud-Api-Token": "<API_TOKEN>"}
body = {"proxy": "<proxy>", "browser_settings": {"inactive_kill_timeout": 30}}

async with httpx.AsyncClient(base_url="https://api-public.surfsky.io") as client:
response = await client.post("/profiles/one_time", json=body, headers=headers, timeout=30)

print(response.json())

if __name__ == "__main__":
asyncio.run(main())

Response: 200

{
"browser_uuid": "{browser_uuid}",
"ws_url": "wss://<API_URL>/proxy/{browser_uuid}",
"inspector": {
"list": "https://<API_URL>/proxy/{browser_uuid}/inspector",
"pages": [{
"page_title": "New Tab",
"page_url": "chrome://newtab/",
"devtools_url": "https://<API_URL>/proxy/{browser_uuid}/inspector/devtools/..."
}]
},
"success": true
}

Response: 400

{
"error": "Internal error",
"success": false
}
{
"error": "Bad proxy",
"success": false
}

Response 429

Body
{
"error": "Your access to the API has been temporarily suspended. Please check the API documentation and handle 429 errors on your side",
"sucess": false
}
Headers
{
"Retry-After": 0, # if 0 - feel free to send next request
"X-Ratelimit-Limit": 200, # RPM (requests per minute) limit
"X-Ratelimit-Limit-Hour": 3000, # RPH (requests per hour) limit
"X-Ratelimit-Remaining": 4, # remaining RPM
"X-Ratelimit-Remaining-Hour": 2999, # remaining RPH
"X-Ratelimit-Reset": 1671789217 # unix timestamp
}

Browser ws url

Endpoint that proxy ws connection to browser, mostly used by third party apps like playwright or puppeteer.

Request

WS /proxy/{browser_uuid}
Parameters
NamePlaceTypeDescription
browser_uuidPathstrBrowser uuid returned by /profiles/one_time endpoint
Response: 404
{
"error": "Profile not found"
}

Persistent profiles

Persistent profiles are not deleted after stop, you can create/modify/delete them, export/import cookies.

Create

Create new persistent profile

POST /profiles
NameRequiredPlaceTypeDescription
X-Cloud-Api-TokentrueHeaderstrProvided api token
titletrueBodystrProfile title
fingerprinttrueBodyobjectDescription
proxyfalseBodystrProxy as an url string
cookiesfalseBodystr or list of objectsJson, Mozilla or netspace cookies

Fingerprint

Fingerprint will be used to create new persistent profile

info

Required: true

Position: body

Key:

fingerprint

Default:

{
"os": "win"
}
FieldTypeDescription
osString
enum: [win, mac]
Operation system will be used to generate profile data
Win Profile
{
"os": "win"
}
Mac Profile
{
"os": "mac"
}

Get

Get profile info

GET /profiles/{uuid}
NameRequiredPlaceTypeDescription
X-Cloud-Api-TokentrueHeaderstrProvided api token
uuidtruePathstrProfile uuid

Update

Update persistent profile

About unchangable fields

Note that you can't update profile's os, os_arch and os_version fields

PATCH /profiles/{uuid}
NameRequiredPlaceTypeDescription
X-Cloud-Api-TokentrueHeaderstrProvided api token
uuidtruePathstrProfile uuid

Delete

Delete persistent profile

DELETE /profiles/{uuid}
NameRequiredPlaceTypeDescription
X-Cloud-Api-TokentrueHeaderstrProvided api token
uuidtruePathstrProfile uuid

Delete batch

Delete persistent profile

DELETE /profiles
NameRequiredPlaceTypeDescription
X-Cloud-Api-TokentrueHeaderstrProvided api token
uuidstrueBodylist of strList of uuids of profiles

List

Get persistent profiles

GET /profiles
NameRequiredPlaceTypeDescription
X-Cloud-Api-TokentrueHeaderstrProvided api token
pagefalse (default: 0)QueryintPage number
page_lenfalse (default: 100)QueryintNumber of profiles per page
orderingfalse (default: active)QueryEnum{'created', '-created', 'active', '-active', 'title', '-title'}How to order profiles, "-" prefix means reverse order

Start

Start persistent profile

POST /profiles/{uuid}/start
NameRequiredPlaceTypeDescription
X-Cloud-Api-TokentrueHeaderstrProvided api token
uuidtruePathstrProfile uuid
proxyfalseBodystrProxy as an url string, allowed schemes are ['http', 'https', 'socks5', 'ssh'] with or without auth that will be used by persistent browser instead of proxy saved in profile
open_vpnfalseBodyobject {config: str(required), username: str, password: str}Open config object that will be used by persistent browser instead of proxy saved in profile
About proxy and open vpn
Either proxy or open vpn has to be provided in case profile doesn't have proxy

Stop

Stop persistent profile

POST /profiles/{uuid}/stop
NameRequiredPlaceTypeDescription
X-Cloud-Api-TokentrueHeaderstrProvided api token
uuidtruePathstrProfile uuid

Active

Get running profiles

GET /profiles/active
NameRequiredPlaceTypeDescription
X-Cloud-Api-TokentrueHeaderstrProvided api token

Export cookies

Export profile cookies

GET /profiles/{uuid}/cookies?export_format={export_format}
NameRequiredPlaceTypeDescription
X-Cloud-Api-TokentrueHeaderstrProvided api token
uuidtruePathstrProfile uuid
export_formatfalse (default: json)PathEnum{json, netscape}json or netscape format to export

Import cookies

Import cookies to profile

POST /profiles/{uuid}/cookies
NameRequiredPlaceTypeDescription
X-Cloud-Api-TokentrueHeaderstrProvided api token
uuidtruePathstrProfile uuid
cookiestrueBodyobjectCookies to import in json, netscape or mozilla format