---
title: "Get file information from the device"
method: POST
path: "/sessions/{sessionId}/device/statFile"
tags: ["Device File Management"]
---

# Get file information from the device

`POST /sessions/{sessionId}/device/statFile`

## Request

- Base URL: `https://api.us-west-1.saucelabs.com/rdc/v2`
- URL: `https://api.us-west-1.saucelabs.com/rdc/v2/sessions/{sessionId}/device/statFile`
- Auth: HTTP basic
- TypeScript: <https://skmtc.dev/saucelabs/apis/real-device-access-api-reference/docs/sessions/:sessionId/device/statFile/post.ts> (a function with typed inputs; its response is checked against the schema)

Returns metadata about a specific file or directory on the device storage, including its path, size, and whether it is a directory.

## Path parameters

- `sessionId` string, required

## Request body

- StatFileRequest
  - `path` string, required: The absolute path of the file or directory on the device to get information about.
  - `bundleId` string: The iOS app bundle identifier (e.g., `com.example.app`). Required for iOS devices, not needed for Android. On iOS, each app runs in its own **sandbox** — an isolated file system container that restricts access to only that app's data. This means you must specify which app's sandbox to operate on by providing its bundle ID. You can find the bundle ID in Xcode, in the app's `Info.plist`, or via the Sauce Labs app management API. See [Apple's File System documentation](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html) for more details.

## Response `200`

File information retrieved successfully

- FileInfo
  - `path` string: The absolute path of the file or directory on the device.
  - `size` integer: The size of the file in bytes. 0 for directories.
  - `isDirectory` boolean: Whether the path is a directory.

## Other responses

- `400`: Bad request or missing bundleId for iOS file operations
- `404`: Not Found
- `422`: Capability not supported
- `500`: Device File Operation Error

---

[API](https://skmtc.dev/saucelabs/apis/real-device-access-api-reference.md) - [All operations](https://skmtc.dev/saucelabs/apis/real-device-access-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/saucelabs/apis/real-device-access-api-reference/revisions/f845a4b66e37?raw)
