---
title: "Check if file/dir exists"
method: POST
path: "/boxes/{boxId}/fs/exists"
tags: ["File System"]
---

# Check if file/dir exists

`POST /boxes/{boxId}/fs/exists`

## Path parameters

- `boxId` string, required

## Request body

- ExistsFile — Request parameters for checking if a file/directory exists
  - `workingDir` string — Working directory. If not provided, the file will be read from the `box.config.workingDir` directory.
  - `path` string, required — Target path in the box. If the path does not start with '/', the file/directory will be checked relative to the working directory

## Response `200`

Checks whether a file or directory exists inside a box. Use this endpoint for path validation.

- union
  - ExistsFileResult — Response after checking if a file/directory exists
    - `exists` boolean, required — Exists
    - `type` string, required — Type
  - NotExistsFileResult — Response after checking if a file/directory not exists
    - `exists` boolean, required — Exists

---

[API](https://skmtc.dev/babelcloud/apis/gbox-open-api.md) · [All operations](https://skmtc.dev/babelcloud/apis/gbox-open-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/babelcloud/gbox-open-api/revisions/d655577fa915/schema)
