Scrapybara Filesystem API
Read, write, list, and manipulate files on an instance via file and edit actions, and upload binary files directly into the instance filesystem for agents to operate on.
Read, write, list, and manipulate files on an instance via file and edit actions, and upload binary files directly into the instance filesystem for agents to operate on.
openapi: 3.0.3
info:
title: Scrapybara API
description: >-
Scrapybara provides virtual desktops for AI agents. This representative
OpenAPI describes the public REST surface for starting and managing
cloud instances (ubuntu / browser / windows), running computer actions,
driving a Chromium browser over Playwright CDP, executing bash and code,
managing the filesystem and Jupyter notebooks, saving browser auth
states, and setting instance environment variables. All requests
authenticate with the `x-api-key` header.
termsOfService: https://scrapybara.com/terms
contact:
name: Scrapybara Support
url: https://scrapybara.com
email: hello@scrapybara.com
version: '1.0'
servers:
- url: https://api.scrapybara.com/v1
description: Scrapybara production API
security:
- ApiKeyAuth: []
tags:
- name: Instances
- name: Computer Actions
- name: Browser
- name: Code Execution
- name: Filesystem
- name: Notebook
- name: Auth States
- name: Environment
paths:
/start:
post:
operationId: startInstance
tags:
- Instances
summary: Start instance
description: Start a new cloud instance of type ubuntu, browser, or windows.
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/StartInstanceRequest'
responses:
'200':
description: Instance started
content:
application/json:
schema:
$ref: '#/components/schemas/InstanceResponse'
/instances:
get:
operationId: getInstances
tags:
- Instances
summary: List all instances
responses:
'200':
description: List of instances
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/InstanceResponse'
/instances/{instance_id}:
get:
operationId: getInstance
tags:
- Instances
summary: Get instance by ID
parameters:
- $ref: '#/components/parameters/InstanceId'
responses:
'200':
description: Instance details
content:
application/json:
schema:
$ref: '#/components/schemas/InstanceResponse'
/instances/{instance_id}/stop:
post:
operationId: stopInstance
tags:
- Instances
summary: Stop instance
description: Terminate the instance and release its resources.
parameters:
- $ref: '#/components/parameters/InstanceId'
responses:
'200':
description: Instance stopped
content:
application/json:
schema:
$ref: '#/components/schemas/StatusResponse'
/instances/{instance_id}/pause:
post:
operationId: pauseInstance
tags:
- Instances
summary: Pause instance
description: Pause the instance, preserving its state for a later resume.
parameters:
- $ref: '#/components/parameters/InstanceId'
responses:
'200':
description: Instance paused
content:
application/json:
schema:
$ref: '#/components/schemas/StatusResponse'
/instances/{instance_id}/resume:
post:
operationId: resumeInstance
tags:
- Instances
summary: Resume instance
description: Resume a previously paused instance.
parameters:
- $ref: '#/components/parameters/InstanceId'
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
timeout_hours:
type: number
minimum: 0.01
maximum: 24
responses:
'200':
description: Instance resumed
content:
application/json:
schema:
$ref: '#/components/schemas/InstanceResponse'
/instances/{instance_id}/screenshot:
get:
operationId: takeScreenshot
tags:
- Computer Actions
summary: Take screenshot
description: Capture a base64-encoded screenshot of the instance desktop.
parameters:
- $ref: '#/components/parameters/InstanceId'
responses:
'200':
description: Screenshot captured
content:
application/json:
schema:
type: object
properties:
base_64_image:
type: string
/instances/{instance_id}/stream-url:
get:
operationId: getStreamUrl
tags:
- Computer Actions
summary: Get stream URL
description: Get the interactive streaming URL for the instance desktop.
parameters:
- $ref: '#/components/parameters/InstanceId'
responses:
'200':
description: Stream URL
content:
application/json:
schema:
type: object
properties:
stream_url:
type: string
format: uri
/instances/{instance_id}/computer:
post:
operationId: runComputerAction
tags:
- Computer Actions
summary: Run computer actions
description: >-
Run a computer action such as move_mouse, click_mouse, drag_mouse,
scroll, press_key, type_text, wait, take_screenshot, get_cursor_position.
parameters:
- $ref: '#/components/parameters/InstanceId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ComputerActionRequest'
responses:
'200':
description: Action result
content:
application/json:
schema:
$ref: '#/components/schemas/ComputerActionResponse'
/instances/{instance_id}/bash:
post:
operationId: runBash
tags:
- Code Execution
summary: Run bash actions
description: Execute a bash command on the instance.
parameters:
- $ref: '#/components/parameters/InstanceId'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
command:
type: string
restart:
type: boolean
responses:
'200':
description: Command output
content:
application/json:
schema:
$ref: '#/components/schemas/CommandResponse'
/instances/{instance_id}/edit:
post:
operationId: runEdit
tags:
- Filesystem
summary: Run edit actions
description: >-
Run a text-editor file action (view, create, str_replace, insert,
undo_edit) against a path on the instance.
parameters:
- $ref: '#/components/parameters/InstanceId'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
command:
type: string
path:
type: string
file_text:
type: string
old_str:
type: string
new_str:
type: string
responses:
'200':
description: Edit result
content:
application/json:
schema:
$ref: '#/components/schemas/CommandResponse'
/instances/{instance_id}/file:
post:
operationId: runFile
tags:
- Filesystem
summary: Run file actions
description: >-
Run a filesystem action (read, write, list, exists, delete) against a
path on the instance.
parameters:
- $ref: '#/components/parameters/InstanceId'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
command:
type: string
path:
type: string
content:
type: string
responses:
'200':
description: File action result
content:
application/json:
schema:
$ref: '#/components/schemas/CommandResponse'
/instances/{instance_id}/upload:
post:
operationId: uploadFile
tags:
- Filesystem
summary: Upload file
description: Upload a binary file to a path on the instance filesystem.
parameters:
- $ref: '#/components/parameters/InstanceId'
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
properties:
file:
type: string
format: binary
path:
type: string
responses:
'200':
description: Upload result
content:
application/json:
schema:
$ref: '#/components/schemas/StatusResponse'
/instances/{instance_id}/browser/start:
post:
operationId: startBrowser
tags:
- Browser
summary: Start browser
description: Start a Chromium browser on the instance.
parameters:
- $ref: '#/components/parameters/InstanceId'
responses:
'200':
description: Browser started
content:
application/json:
schema:
type: object
properties:
cdp_url:
type: string
format: uri
/instances/{instance_id}/browser/stop:
post:
operationId: stopBrowser
tags:
- Browser
summary: Stop browser
parameters:
- $ref: '#/components/parameters/InstanceId'
responses:
'200':
description: Browser stopped
content:
application/json:
schema:
$ref: '#/components/schemas/StatusResponse'
/instances/{instance_id}/browser/cdp-url:
get:
operationId: getCdpUrl
tags:
- Browser
summary: Get CDP URL
description: Get the Playwright Chrome DevTools Protocol URL for the browser.
parameters:
- $ref: '#/components/parameters/InstanceId'
responses:
'200':
description: CDP URL
content:
application/json:
schema:
type: object
properties:
cdp_url:
type: string
format: uri
/instances/{instance_id}/browser/current-url:
get:
operationId: getCurrentUrl
tags:
- Browser
summary: Get current URL
parameters:
- $ref: '#/components/parameters/InstanceId'
responses:
'200':
description: Current URL
content:
application/json:
schema:
type: object
properties:
current_url:
type: string
format: uri
/instances/{instance_id}/browser/save-auth:
post:
operationId: saveAuth
tags:
- Auth States
summary: Save auth state
description: Save the current browser session as a reusable auth state.
parameters:
- $ref: '#/components/parameters/InstanceId'
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
name:
type: string
responses:
'200':
description: Auth state saved
content:
application/json:
schema:
$ref: '#/components/schemas/AuthStateResponse'
/instances/{instance_id}/browser/authenticate:
post:
operationId: authenticateBrowser
tags:
- Auth States
summary: Authenticate with saved state
description: Load a previously saved auth state into the browser session.
parameters:
- $ref: '#/components/parameters/InstanceId'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
auth_state_id:
type: string
responses:
'200':
description: Authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/StatusResponse'
/instances/{instance_id}/auth-states/{auth_state_id}:
post:
operationId: modifyAuth
tags:
- Auth States
summary: Modify auth state
parameters:
- $ref: '#/components/parameters/InstanceId'
- name: auth_state_id
in: path
required: true
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
name:
type: string
responses:
'200':
description: Auth state modified
content:
application/json:
schema:
$ref: '#/components/schemas/AuthStateResponse'
/auth-states:
get:
operationId: getAuthStates
tags:
- Auth States
summary: List auth states
responses:
'200':
description: List of auth states
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/AuthStateResponse'
/instances/{instance_id}/code/execute:
post:
operationId: executeCode
tags:
- Code Execution
summary: Execute code
description: Execute code against a named kernel on the instance.
parameters:
- $ref: '#/components/parameters/InstanceId'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
code:
type: string
kernel_name:
type: string
timeout:
type: integer
responses:
'200':
description: Execution result
content:
application/json:
schema:
$ref: '#/components/schemas/CommandResponse'
/instances/{instance_id}/notebooks/kernels:
get:
operationId: listKernels
tags:
- Notebook
summary: List kernels
parameters:
- $ref: '#/components/parameters/InstanceId'
responses:
'200':
description: List of kernels
content:
application/json:
schema:
type: array
items:
type: object
/instances/{instance_id}/notebooks:
post:
operationId: createNotebook
tags:
- Notebook
summary: Create notebook
parameters:
- $ref: '#/components/parameters/InstanceId'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
kernel_name:
type: string
responses:
'200':
description: Notebook created
content:
application/json:
schema:
$ref: '#/components/schemas/NotebookResponse'
/instances/{instance_id}/notebooks/{notebook_id}:
get:
operationId: getNotebook
tags:
- Notebook
summary: Get notebook
parameters:
- $ref: '#/components/parameters/InstanceId'
- $ref: '#/components/parameters/NotebookId'
responses:
'200':
description: Notebook details
content:
application/json:
schema:
$ref: '#/components/schemas/NotebookResponse'
delete:
operationId: deleteNotebook
tags:
- Notebook
summary: Delete notebook
parameters:
- $ref: '#/components/parameters/InstanceId'
- $ref: '#/components/parameters/NotebookId'
responses:
'200':
description: Notebook deleted
content:
application/json:
schema:
$ref: '#/components/schemas/StatusResponse'
/instances/{instance_id}/notebooks/{notebook_id}/cells:
post:
operationId: addCell
tags:
- Notebook
summary: Add cell
parameters:
- $ref: '#/components/parameters/InstanceId'
- $ref: '#/components/parameters/NotebookId'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
type:
type: string
enum: [code, markdown]
content:
type: string
responses:
'200':
description: Cell added
content:
application/json:
schema:
type: object
/instances/{instance_id}/notebooks/{notebook_id}/cells/{cell_id}/execute:
post:
operationId: executeCell
tags:
- Notebook
summary: Execute cell
parameters:
- $ref: '#/components/parameters/InstanceId'
- $ref: '#/components/parameters/NotebookId'
- name: cell_id
in: path
required: true
schema:
type: string
responses:
'200':
description: Cell execution result
content:
application/json:
schema:
$ref: '#/components/schemas/CommandResponse'
/instances/{instance_id}/notebooks/{notebook_id}/execute:
post:
operationId: executeNotebook
tags:
- Notebook
summary: Execute all cells
parameters:
- $ref: '#/components/parameters/InstanceId'
- $ref: '#/components/parameters/NotebookId'
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
timeout:
type: integer
responses:
'200':
description: Notebook execution result
content:
application/json:
schema:
$ref: '#/components/schemas/NotebookResponse'
/instances/{instance_id}/env:
get:
operationId: getEnv
tags:
- Environment
summary: Get environment variables
parameters:
- $ref: '#/components/parameters/InstanceId'
responses:
'200':
description: Environment variables
content:
application/json:
schema:
type: object
properties:
variables:
type: object
additionalProperties:
type: string
post:
operationId: setEnv
tags:
- Environment
summary: Set environment variables
parameters:
- $ref: '#/components/parameters/InstanceId'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
variables:
type: object
additionalProperties:
type: string
responses:
'200':
description: Variables set
content:
application/json:
schema:
$ref: '#/components/schemas/StatusResponse'
delete:
operationId: deleteEnv
tags:
- Environment
summary: Delete environment variables
parameters:
- $ref: '#/components/parameters/InstanceId'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
keys:
type: array
items:
type: string
responses:
'200':
description: Variables deleted
content:
application/json:
schema:
$ref: '#/components/schemas/StatusResponse'
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: x-api-key
parameters:
InstanceId:
name: instance_id
in: path
required: true
schema:
type: string
NotebookId:
name: notebook_id
in: path
required: true
schema:
type: string
schemas:
StartInstanceRequest:
type: object
properties:
instance_type:
type: string
enum: [ubuntu, browser, windows]
default: ubuntu
timeout_hours:
type: number
minimum: 0.01
maximum: 24
blocked_domains:
type: array
items:
type: string
resolution:
type: array
items:
type: integer
minItems: 2
maxItems: 2
InstanceResponse:
type: object
properties:
id:
type: string
launch_time:
type: string
format: date-time
instance_type:
type: string
enum: [ubuntu, browser, windows]
status:
type: string
enum: [pending, running, paused, resuming, terminated, error]
resolution:
type: array
nullable: true
items:
type: integer
StatusResponse:
type: object
properties:
status:
type: string
ComputerActionRequest:
type: object
properties:
action:
type: string
enum:
- move_mouse
- click_mouse
- drag_mouse
- scroll
- press_key
- type_text
- wait
- take_screenshot
- get_cursor_position
coordinates:
type: array
items:
type: integer
button:
type: string
enum: [left, right, middle]
text:
type: string
keys:
type: array
items:
type: string
duration:
type: number
ComputerActionResponse:
type: object
properties:
output:
type: string
base_64_image:
type: string
cursor_position:
type: array
items:
type: integer
CommandResponse:
type: object
properties:
output:
type: string
error:
type: string
exit_code:
type: integer
AuthStateResponse:
type: object
properties:
id:
type: string
name:
type: string
NotebookResponse:
type: object
properties:
id:
type: string
name:
type: string
kernel_name:
type: string
cells:
type: array
items:
type: object