Skip to main content
GET
/
sandboxes
/
{sandbox_id}
/
files
/
exists
File Exists
curl --request GET \
  --url https://api.declaw.ai/sandboxes/{sandbox_id}/files/exists \
  --header 'X-API-Key: <api-key>'
{
  "exists": true
}
Checks whether a file or directory exists at the given path inside the sandbox. Returns { "exists": true } or { "exists": false }. Use this endpoint to guard against re-writing files that already exist, or to verify that a command produced its expected output.

Path Parameters

sandbox_id
string
required
The sandbox identifier. Format: sbx-<8 chars>.

Query Parameters

path
string
required
Absolute path to check inside the sandbox.Example: /home/user/script.py

Response

exists
boolean
true if the path exists (as any entry type), false otherwise.

Example

curl "https://api.declaw.ai/sandboxes/sbx-a1b2c3d4/files/exists?path=/home/user/script.py" \
  -H "X-API-Key: YOUR_API_KEY"
Response (exists)
{
  "exists": true
}
Response (not found)
{
  "exists": false
}

Error Responses

StatusCause
401Missing or invalid API key
404Sandbox not found
502envd daemon unreachable
503Sandbox has no VM